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.
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.
NodeUpdate
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§

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.

Type Aliases§

SceneUpdates
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).