Skip to main content

Crate cranpose_render_common

Crate cranpose_render_common 

Source
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 GPOS table.
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 TextMeasurer used 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§

SceneUpdates
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§

HitTestTarget
Trait implemented by hit-test targets stored inside a RenderScene.
RenderScene
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.