MCPcopy Create free account
hub / github.com/MyGUI/mygui / saveRgba

Function saveRgba

MyGUIEngine/src/msdfgen/core/save-rgba.cpp:43–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41};
42
43bool 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
59bool saveRgba(BitmapConstSection<byte, 3> bitmap, const char *filename) {
60 RgbaFileOutput output(filename, bitmap.width, bitmap.height);

Callers 1

writeOutputFunction · 0.85

Calls 3

pixelFloatToByteFunction · 0.85
writePixelMethod · 0.80
reorientMethod · 0.45

Tested by

no test coverage detected