34 m_pixels.resize(size.
area() * bpp, 0);
36 memcpy(&m_pixels[0], pixels, m_pixels.size());
55 std::stringstream fin;
73 std::stringstream data;
75 fin->
write(data.str().c_str(), data.str().length());
85 uint8& r = m_pixels[p*4 + 0];
86 uint8& g = m_pixels[p*4 + 1];
87 uint8& b = m_pixels[p*4 + 2];
88 uint8& a = m_pixels[p*4 + 3];
90 Color pixelColor(r,g,b,a);
91 Color writeColor = (pixelColor == maskedColor) ? insideColor : outsideColor;
107 uint8* otherPixels = other->getPixelData();
108 for(
int p = 0; p < other->getPixelCount(); ++p) {
109 int x = p % other->getWidth();
110 int y = p / other->getWidth();
111 int pos = ((dest.
y + y) * m_size.
width() + (dest.
x + x)) * 4;
113 if (otherPixels[p*4+3] != 0) {
114 m_pixels[pos+0] = otherPixels[p*4+0];
115 m_pixels[pos+1] = otherPixels[p*4+1];
116 m_pixels[pos+2] = otherPixels[p*4+2];
117 m_pixels[pos+3] = otherPixels[p*4+3];
129 uint8* otherPixels = other->getPixelData();
130 for(
int p = 0; p < other->getPixelCount(); ++p) {
131 int x = p % other->getWidth();
132 int y = p / other->getWidth();
133 int pos = (y * m_size.
width() + x) * 4;
135 m_pixels[pos+0] = otherPixels[p*4+0];
136 m_pixels[pos+1] = otherPixels[p*4+1];
137 m_pixels[pos+2] = otherPixels[p*4+2];
138 m_pixels[pos+3] = otherPixels[p*4+3];
147 int iw = m_size.
width();
149 if(iw == 1 && ih == 1)
152 int ow = iw > 1 ? iw/2 : 1;
153 int oh = ih > 1 ? ih/2 : 1;
155 std::vector<uint8> pixels(ow*oh*4, 0xFF);
158 if(iw != 1 && ih != 1) {
159 for(
int x=0;x<ow;++x) {
160 for(
int y=0;y<oh;++y) {
162 inPixel[0] = &m_pixels[((y*2)*iw + (x*2))*4];
163 inPixel[1] = &m_pixels[((y*2)*iw + (x*2)+1)*4];
164 inPixel[2] = &m_pixels[((y*2+1)*iw + (x*2))*4];
165 inPixel[3] = &m_pixels[((y*2+1)*iw + (x*2)+1)*4];
166 uint8 *outPixel = &pixels[(y*ow + x)*4];
173 for(
int j=0;j<4;++j) {
175 if(inPixel[j][3] < 16)
179 pixelsSum[i] += inPixel[j][i];
185 for(
int i=0;i<4;++i) {
187 outPixel[i] = pixelsSum[i] / usedPixels;
191 outPixel[3] = pixelsSum[3]/4;
197 m_size =
Size(ow, oh);