Module blend

Source
Expand description

Blend modes and the per-pixel composite of a straight-alpha RGBA layer onto an opaque canvas.

Functionsยง

blend_channel
Blend one channel: s = layer (source), d = canvas (destination), both 0..1. Returns 0..1.
composite_rect
Composite layer (straight-alpha RGBA, same size as dst) onto dst (opaque canvas) with the given blend mode and global opacity, restricted to the pixel rect [x0, x1) ร— [y0, y1) (clamped to the canvas). Pixels with alpha 0 are skipped.
composite_row
Composite one row of straight-alpha RGBA pixels (src) onto one row of opaque canvas pixels (dst). Both slices are 4 * n bytes; opacity is 0..1. Canvas alpha stays 255.
div255 ๐Ÿ”’
x / 255 rounded, for x <= 255*255.