Expand description
§Cranpose Render Common
cranpose-render-common defines scene, renderer and hit-test contracts for
Cranpose backends. Backend authors implement Renderer and RenderScene.
App developers select a renderer through
cranpose.
Create a graph from a root layer and inspect its node count:
use cranpose_render_common::graph::{LayerNode, RenderGraph};
let graph = RenderGraph::new(LayerNode::default());
assert_eq!(graph.node_count(), 1);The Renderer contract accepts a LayoutTree or a MemoryApplier root and a
logical-pixel viewport. AppShell installs renderer services before the first
composition pass. Default features include embedded-default-font, which
supplies a fallback font. See the Renderer API,
the renderer architecture guide,
the renderer source
and the crate source.
Modules§
- brush_
sampling - CPU sampling of brushes at a point, for the software renderers.
- byte_
blend - Source-over blending of straight-alpha byte pixels.
- dev_
overlay - Debug switches read from environment variables, with programmatic overrides. Renderer-drawn dev overlay (fps counter): one shared graph builder so every backend draws the identical overlay without composition impact.
- font_
source - Turning app-declared font families into parsed faces.
- geometry
- Blur kernel and rectangle helpers shared by the renderers.
- glyph_
mask - Glyph masks and the cache renderers keep them in. Glyph masks: the coverage of a glyph at one size, drawn filled or stroked and with the weight or slant a face lacks synthesized, and the cache the renderers keep them in.
- glyph_
reach - Where a laid-out text’s glyphs draw: across the visible text of its lines, and wherever the ink of a glyph reaches past them.
- graph
- The render graph: the layers and primitives that a scene builds for a renderer to draw.
- graph_
scene - The retained scene: the render graph together with the hit targets built from it.
- hit_
graph - Collecting hit targets from a render graph.
- image_
compare - Pixel comparison and resampling of RGBA images, for renderer tests.
- installed_
fonts - Font files an app installs while it runs, such as a font pack it downloaded after launch.
- layer_
composition - Rules for when a graphics layer is drawn into its own offscreen buffer and with which alpha.
- layer_
shadow - Elevation shadows as Jetpack Compose draws them: Android’s renderer and
Compose Multiplatform’s both light a layer from one point above the window
and hand the caster to Skia’s
SkShadowUtils, which draws an ambient and a spot shadow. The constants below are theirs. - layer_
transform - Transform math of a graphics layer, re-exported from
cranpose_ui_graphics. - primitive_
emit - Lowering of draw primitives to the shape, image and text draw calls of a renderer.
- raster_
cache - Keys of the cached rasters of layers.
- render_
contract - Shared cases that every renderer backend is checked against.
- rgb565
- 16-bit pixels of the format most small displays take. Pixels of 16 bits, 5 of red, 6 of green and 5 of blue, as most small displays take them, stored in either byte order.
- scene_
builder - Building and updating the render graph from the layout tree.
- scene_
pick - Which mesh surface of a 3D scene a window point shows.
- shape_
sdf - CPU mirror of the signed-distance functions in
shaders/shape.wgsl. - space
- Where a window’s scenes put their 3D layers: frames, spaces, doorways and what the eye sees. Where the scenes a window shows put their 3D layers, as one map that drawing, picking, window geometry and the eye’s walking all read.
- style_
shared - Colors, brushes and corner radii resolved against the properties of a graphics layer.
- text_
atlas - A laid-out text’s glyphs placed for a renderer that draws from an atlas. A laid-out text’s glyphs for a renderer that draws solid glyphs from an atlas of their masks.
- text_
canvas - The pixels a text’s glyph masks are painted into. The pixels a text’s glyph masks are painted into: an image of the text’s own, or a renderer’s pixels, and how a glyph’s coverage blends there.
- text_
decoration - Span backgrounds and the lines under and through a text. What a text draws besides its glyphs: the background of its spans and the lines under and through them, line by line from its layout.
- text_
fonts - The typefaces a renderer hands the app its text lays out with. The typefaces a renderer hands the app it draws, which the app’s text lays out with.
- text_
glyphs - The glyphs of a laid-out text placed on pixels with their paints. The glyphs of a laid-out text placed on a renderer’s pixels, each with the paint of the span it draws.
- text_
mask_ gamma - Skia’s glyph mask gamma: the coverage correction Jetpack Compose’s text gets before it is blended.
- text_
paint - What a renderer reads of a text’s style and string to draw its glyphs, worked out once per text node so that drawing a plain text never loads its style, and drawing a cached run never loads its string.
- text_
raster - A laid-out text’s glyphs rasterized into pixels. A laid-out text’s glyphs rasterized into pixels: an image of the text’s own, or a renderer’s pixels painted over directly.
Enums§
- Brush
- Describes how a shape, path or text is filled: a flat color or a gradient. Compose’s
Brush. - Node
Update - What changed in a node since the scene last drew it, and so how the scene updates what it drew for that node.
Constants§
- FRAME_
CLEAR_ COLOR - The frame background every renderer clears to (linear values; sRGB surfaces display this as rgb(75, 75, 86)). One definition so backends cannot drift.
Traits§
- HitTest
Target - Trait implemented by hit-test targets stored inside a
RenderScene. - Render
Scene - Trait describing the minimal surface area required by the application shell to process pointer events and refresh the frame graph.
- Renderer
- Abstraction implemented by concrete renderer backends.
Type Aliases§
- Scene
Updates - The nodes whose drawing changed since the last scene, each with the
update it needs. A node may be named more than once: its updates merge
(see
NodeUpdate::merge).