Skip to main content

Module pixmap

Module pixmap 

Source
Expand description

The two raster buffers the engine and the backends share: Pixmap, a premultiplied RGBA8 image, and AlphaMask, an 8-bit coverage plane.

Part of the backend seam. Both are in RasterBackend’s own signatures; the alpha arithmetic beside them — mul255, alpha_merge, alpha_byte_truncating — is here because a backend must round its alpha the way the oracle rounds it. The oracle’s own buffers are straight (non-premultiplied) and ours are premultiplied, and the conversions that forces are owned here rather than in a backend, so the engine’s arithmetic stays bit-identical whichever rasterizer is in use.

Structs§

AlphaMask
An 8-bit coverage plane: one byte per pixel, 255 fully opaque.
Pixmap
A premultiplied RGBA8 image: four bytes per pixel, row-major, no padding.

Functions§

alpha_byte_truncating
alpha * 255 cast to an integer: truncating, so ca 0.5 is 127.
alpha_merge
AlphaMerge(d, s, a) = (d*(255-a) + s*a) / 255, truncating and unclamped.
mul255
a * b / 255, truncating — the oracle’s ubiquitous 8-bit product.