[DEV] update resize
This commit is contained in:
parent
8ef121b698
commit
37c83f9728
@ -96,9 +96,10 @@ namespace egami {
|
|||||||
}
|
}
|
||||||
void swap(egami::Image& _obj);
|
void swap(egami::Image& _obj);
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
// -- basic tools :
|
// -- basic tools:
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
public :
|
public :
|
||||||
|
void move(const ivec2& _offset);
|
||||||
void resize(const ivec2& _size, const ivec2& _startPos=ivec2(0,0));
|
void resize(const ivec2& _size, const ivec2& _startPos=ivec2(0,0));
|
||||||
// TODO : Create a template function ...
|
// TODO : Create a template function ...
|
||||||
void resize(const ivec2& _size, const etk::Color<>& _color, const ivec2& _startPos=ivec2(0,0));
|
void resize(const ivec2& _size, const etk::Color<>& _color, const ivec2& _startPos=ivec2(0,0));
|
||||||
|
@ -49,6 +49,7 @@ namespace egami {
|
|||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
public :
|
public :
|
||||||
void resize2__(const ivec2& _size, const ivec2& _startPos=ivec2(0,0)) {
|
void resize2__(const ivec2& _size, const ivec2& _startPos=ivec2(0,0)) {
|
||||||
|
move(-_startPos);
|
||||||
if (_size == m_size) {
|
if (_size == m_size) {
|
||||||
// same size == > nothing to do ...
|
// same size == > nothing to do ...
|
||||||
return;
|
return;
|
||||||
@ -126,6 +127,13 @@ namespace egami {
|
|||||||
m_size=_size;
|
m_size=_size;
|
||||||
m_data.resize(m_size.x()*m_size.y(), _color);
|
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) {
|
void resize(const ivec2& _size, const etk::Color<uint8_t, 4>& _color, const ivec2& _startPos) {
|
||||||
resize__(_size, _color);
|
resize__(_size, _color);
|
||||||
|
@ -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 << "'");
|
EGAMI_WARNING("egami not compile with the JPEG dependency for file '" << _fileName << "'");
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
return false;
|
|
||||||
} else if (etk::end_with(tmpName, ".j2k") == true) {
|
} else if (etk::end_with(tmpName, ".j2k") == true) {
|
||||||
EGAMI_ERROR("Can not store in JPEG 2000 file '" << _fileName << "'");
|
EGAMI_ERROR("Can not store in JPEG 2000 file '" << _fileName << "'");
|
||||||
return false;
|
return false;
|
||||||
|
@ -183,7 +183,8 @@ bool egami::storeJPG(const etk::String& _fileName, const egami::Image& _inputIma
|
|||||||
* RGB color and is described by:
|
* 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) {
|
bool egami::storeJPG(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputImage) {
|
||||||
_buffer.clear();
|
_buffer.clear();
|
||||||
|
@ -1 +1,2 @@
|
|||||||
tools/viewer
|
tools/viewer
|
||||||
|
tools/cutter
|
Loading…
x
Reference in New Issue
Block a user