Skip to main content

Module pyramid

Module pyramid 

Source
Expand description

The preview pyramid of one canvas (docs/ARCHITECTURE.md §八): each level halves the one below it, four child tiles per parent tile, alpha-weighted so unobserved pixels never darken observed ones. Level 0 stays at source resolution and is never rewritten.

PyramidSession builds one canvas’s levels as a resumable job the host drives. The pyramid does not go through the tile cache: the host reads stored child tiles and writes parent tiles straight to and from storage. Per level, PyramidSession::step first asks for the stored tile index of the level below (Step::NeedIndex: the host passes every row to PyramidSession::queue, which names the parent tile to queue), then works through the queued parents in storage-key order: Step::NeedChildren names the four child tiles to read (PyramidSession::provide), Step::Parent hands back the assembled parent (or None when no child exists) for the host to store before it drops the parent from its queue and checks for pause and stop. Step::LevelDone reports a finished level, Step::Done the last one.

Structs§

PyramidSession
One canvas’s pyramid in progress.

Enums§

PyramidError
Step

Functions§

level_count
Levels above level 0: how many times size doubles before it reaches the larger bound dimension, i.e. ceil(log2(max(width, height) / size)) clamped to 0, counted by doubling so it never depends on a floating-point logarithm.
queue_key
The storage-key suffix of a queued parent, x_y; the queue runs in the byte order of these keys, which is the order the host’s store iterates them in.