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.
- debug_
toggles - Debug switches read from environment variables, with programmatic overrides.
- dev_
overlay - Renderer-drawn dev overlay (fps counter): one shared graph builder so every backend draws the identical overlay without composition impact.
- font_
layout - Glyph layout and vertical metrics of a font at one pixel size.
- font_
source - Turning app-declared font families into parsed faces.
- geometry
- Blur kernel and rectangle helpers shared by the renderers.
- gpos_
kerning - Pair kerning read out of a font’s
GPOStable. - 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.
- scene_
builder - Building and updating the render graph from the layout tree.
- shape_
sdf - CPU mirror of the signed-distance functions in
shaders/shape.wgsl. - software_
text_ raster - CPU text rasterization: fonts, glyph layout and glyph masks.
- style_
shared - Colors, brushes and corner radii resolved against the properties of a graphics layer.
- text_
hyphenation - Automatic hyphenation of text, using dictionaries that the app registers.
- text_
mask_ gamma - Skia’s glyph mask gamma: the coverage correction Jetpack Compose’s text gets before it is blended.
- text_
measure - Shared CPU
TextMeasurerused by the software rasterizer backends (pixels, vulkan). Both backends draw text by rasterizing glyphs directly into a pixel buffer rather than through a GPU glyph atlas, so they share one font-backed measurer plus its fallback-metrics path for when no font is installed. - 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.
Structs§
- Scene
Updates - Describes scene nodes whose recorded content or layer properties changed.
Enums§
- Brush
- Describes how a shape, path or text is filled: a flat color or a gradient. Compose’s
Brush.
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.