Skip to main content

Module geometry

Module geometry 

Source
Expand description

Blur kernel and rectangle helpers shared by the renderers.

Structs§

BlurKernel
The separable Gaussian kernel of a blur of radius source texels as the blur pass samples it: pair_count pairs on each side, total_weight the kernel’s sum with the centre tap’s one, computed once per draw.
BlurTapPair
One pair of kernel taps on one side of the pixel: the Gaussian weights of the inner and outer tap, and the one bilinear fetch that stands for both, its offset in taps from the pixel and its weight their sum. The outer weight is zero past an odd tap count, which leaves the fetch on the inner tap alone.

Constants§

BLUR_MAX_TAPS
The most taps a blur pass takes on one side of a pixel; a kernel wider than this in scratch texels truncates there.
BLUR_TAP_PAIRS
The tap pairs of a kernel of BLUR_MAX_TAPS taps: the taps at i and i + 1 on one side share one bilinear fetch.

Functions§

blur_reach
blur_reach_px in logical pixels for a blur of blur_radius logical pixels drawn at scale device pixels per logical pixel.
blur_reach_for_minimum_scale
An upper bound on blur_reach for every finite scale at least minimum_scale. A nonpositive or nonfinite minimum has no finite bound.
blur_reach_px
How far, in device pixels, a blur of radius_px carries a source pixel: the kernel’s taps at the scratch grid, the block each scratch texel averages on the way down and interpolates on the way back, and the source’s own antialiased pixel, rounded up to whole blocks so the scratch grid sits on the source the same way whatever the margin. Past this distance the blur is exactly zero, so nothing reads or draws beyond it.
blur_scratch_block
The block of device pixels one scratch texel of a blur stands for: a wide blur runs at a coarser grid, its kernel scaled with it.
expand_blurred_rect
Grows rect on every side by the reach of a blur of blur_radius logical pixels drawn at scale device pixels per logical pixel, then intersects it with clip when one is given. Returns None when the grown rectangle does not meet clip.
union_rect
Returns lhs grown to cover rhs. A rhs with no area leaves lhs unchanged, and a None lhs becomes rhs.