| 22 | virtual void set(size_t x, size_t y, const Color4& c) = 0; |
| 23 | void set(size_t x, size_t y, const Color& c) { set(x,y,Color4(c.r,c.g,c.b,1.0f)); } |
| 24 | void convertToRGBA8(unsigned char *dest) |
| 25 | { |
| 26 | for (size_t y=0;y<height;y++) |
| 27 | for (size_t x=0;x<width;x++) |
| 28 | { |
| 29 | size_t offset = 4 * (y * width + x); |
| 30 | Color4 c = get(x,y); |
| 31 | dest[offset+0] = (unsigned char)(c.r * 255.0f); |
| 32 | dest[offset+1] = (unsigned char)(c.g * 255.0f); |
| 33 | dest[offset+2] = (unsigned char)(c.b * 255.0f); |
| 34 | dest[offset+3] = (unsigned char)(c.a * 255.0f); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | private: |
| 39 | Image (const Image& other) DELETED; // do not implement |