Expand description
Entity and Contents layer: backend-agnostic description of what to draw. An Entity carries a transform, blend, clip depth, contents, and geometry.
What is built here is coverage, and only coverage. The canvas above already records into a batch directly and does not route through this layer, so anything else would be shaped around a guess about a caller that does not exist yet. Coverage is the exception because it is not a guess: the canvas computes it today in four scattered places – bounds expanded by a stroke, a layer’s outward reach, what a mask blur covers, and the device bounds a save layer is sized to – and every one of them is this same composition done by hand. Writing it once, with the rules stated and tested, is worthwhile whether or not the rest of the layer is ever built.
The composition, in order: geometry bounds in the entity’s own coordinates, carried through the transform into device coordinates, grown by however far the contents reach outward, and finally narrowed by the clip. The order matters at both ends. A filter reaches in device pixels rather than in the entity’s units, so growing before the transform would scale the reach along with the shape. And the clip narrows last because it is the only step that can make coverage empty for a reason other than the shape being empty.
Structs§
- Contents
- What an entity draws with, so far as coverage is concerned.
- Entity
- One thing to draw, described without reference to a device.