[DEV] update resize

This commit is contained in:
Edouard DUPIN 2018-09-08 11:12:18 +02:00
parent 8ef121b698
commit 37c83f9728
5 changed files with 14 additions and 4 deletions

View File

@ -96,9 +96,10 @@ namespace egami {
}
void swap(egami::Image& _obj);
// -----------------------------------------------
// -- basic tools :
// -- basic tools:
// -----------------------------------------------
public :
void move(const ivec2& _offset);
void resize(const ivec2& _size, const ivec2& _startPos=ivec2(0,0));
// TODO : Create a template function ...
void resize(const ivec2& _size, const etk::Color<>& _color, const ivec2& _startPos=ivec2(0,0));

View File

@ -49,6 +49,7 @@ namespace egami {
// -----------------------------------------------
public :
void resize2__(const ivec2& _size, const ivec2& _startPos=ivec2(0,0)) {
move(-_startPos);
if (_size == m_size) {
// same size == > nothing to do ...
return;
@ -126,6 +127,13 @@ namespace egami {
m_size=_size;
m_data.resize(m_size.x()*m_size.y(), _color);
}
void move(const ivec2& _offset) {
for (int32_t xxx=0; xxx<m_size.x(); ++xxx) {
for (int32_t yyy=0; yyy<m_size.y(); ++yyy) {
set(ivec2(xxx,yyy), get(ivec2(xxx-_offset.x(),yyy-_offset.y())));
}
}
}
void resize(const ivec2& _size, const etk::Color<uint8_t, 4>& _color, const ivec2& _startPos) {
resize__(_size, _color);

View File

@ -170,7 +170,6 @@ bool egami::store(const egami::Image& _input, const etk::String& _fileName) {
EGAMI_WARNING("egami not compile with the JPEG dependency for file '" << _fileName << "'");
return false;
#endif
return false;
} else if (etk::end_with(tmpName, ".j2k") == true) {
EGAMI_ERROR("Can not store in JPEG 2000 file '" << _fileName << "'");
return false;

View File

@ -183,7 +183,8 @@ bool egami::storeJPG(const etk::String& _fileName, const egami::Image& _inputIma
* RGB color and is described by:
*/
int quality = 250;
//int quality = 250;
int quality = 200;
bool egami::storeJPG(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputImage) {
_buffer.clear();

View File

@ -1 +1,2 @@
tools/viewer
tools/viewer
tools/cutter