std :: gui::gui_png
Struct std::GuiImage
struct GuiImage {
&heap unsigned char pixels;
int width;
int height;
int premultiplied;
}Fields
widthheight4 bytes, RGBA8888, R first
1: color channels are premultiplied by alpha (an image a GuiCanvas drew into); 0: straight alpha (as decoded from PNG)
Methods
A transparent width x height image (premultiplied; ready for GuiCanvas::for_image). Free with free().
A premultiplied copy of a window's pixel buffer (a screenshot).
Reads and decodes a PNG file. 1 = ok.
Writes the image as an RGBA PNG file (stored, uncompressed DEFLATE; straight alpha). 1 = ok.
Converts between straight and premultiplied alpha in place (no-op when already in that form).
A resampled copy: area-averaging when shrinking (no aliasing), bilinear when enlarging. Keeps the alpha form.
0xRRGGBBAA as stored / unblended store; 0 / no-op out of bounds.
Decodes a PNG file's bytes (already read into memory) into this image in place ('struct GuiImage img; img.load_png(data)'). Returns 1 on success, 0 on failure (unsupported feature or malformed input) — the image is left zeroed on failure.
Draws this image with its top-left at (x, y) into 'win' (straight copy through GuiWindow::set_pixel(), no blending) — works with any GuiImage, PNG-decoded or otherwise constructed.
= drop()