/** @file * @author Edouard DUPIN * @copyright 2011, Edouard DUPIN, all right reserved * @license MPL v2.0 (see license file) */ #include #include egami::ImageMono::ImageMono(const ivec2& _size) : m_size(_size) { // basic element : uint8_t tmpBg(0); // preallocate data with a basic bg elements : m_data.resize(m_size.x()*m_size.y(), tmpBg); if ((uint32_t)m_size.x()*m_size.y() > m_data.size()) { EGAMI_ERROR("Allocation of data buffer in error"); return; } } void egami::ImageMono::resize(const ivec2& _size, const uint8_t& _color) { m_size=_size; m_data.resize(m_size.x()*m_size.y(), _color); } void egami::ImageMono::resize(const ivec2& _size, const ivec2& _startPos) { if (_size == m_size) { // same size == > nothing to do ... return; } // grow size : egami::ImageMono tmpImage(*this); m_size=_size; uint8_t tmpBg(0); m_data.resize(m_size.x()*m_size.y(), tmpBg); for (int32_t jjj=0; jjj0 && _pos.x()0 && _pos.y()=0 && _pos.x()=0 && _pos.y()