Expand description
RGBA framebuffer — the rendering target for the entire widget tree.
§Memory layout
Pixels are stored in bottom-up row order (Y-up): row 0 is at the start
of the Vec<u8> and corresponds to the bottom edge of the image (Y = 0).
Row height - 1 is at the end and corresponds to the top edge.
This matches OpenGL’s texture layout: glTexImage2D treats the first byte
as the bottom-left pixel, so the buffer can be uploaded directly without
any Y-flip at the GL boundary.
For display targets that use a top-down layout (e.g. HTML Canvas
putImageData), use Framebuffer::pixels_flipped to obtain a copy with
rows reversed.
Structs§
- Framebuffer
- RGBA framebuffer with bottom-up (Y-up) row ordering.
Functions§
- premultiply_
rgba_ inplace - Convert an RGBA8 buffer from straight to premultiplied alpha in place. Each colour channel is multiplied by the alpha.
- unpremultiply_
rgba_ inplace - Convert an RGBA8 buffer from premultiplied to straight alpha in place. For each pixel, divides the colour channels by the alpha. Zero-alpha pixels are zeroed out (there is no colour information to recover).