| 41 | }; |
| 42 | |
| 43 | bool saveRgba(BitmapConstSection<byte, 1> bitmap, const char *filename) { |
| 44 | RgbaFileOutput output(filename, bitmap.width, bitmap.height); |
| 45 | if (output) { |
| 46 | byte rgba[4] = { byte(0), byte(0), byte(0), byte(0xff) }; |
| 47 | bitmap.reorient(Y_DOWNWARD); |
| 48 | for (int y = 0; y < bitmap.height; ++y) { |
| 49 | for (const byte *p = bitmap(0, y), *end = p+bitmap.width; p < end; ++p) { |
| 50 | rgba[0] = rgba[1] = rgba[2] = *p; |
| 51 | output.writePixel(rgba); |
| 52 | } |
| 53 | } |
| 54 | return true; |
| 55 | } |
| 56 | return false; |
| 57 | } |
| 58 | |
| 59 | bool saveRgba(BitmapConstSection<byte, 3> bitmap, const char *filename) { |
| 60 | RgbaFileOutput output(filename, bitmap.width, bitmap.height); |
no test coverage detected