Skip to main content

Crate cranpose_ui_graphics

Crate cranpose_ui_graphics 

Source
Expand description

Pure math/data for drawing & units in Cranpose

This crate contains geometry primitives, color definitions, brushes, and unit types that are used throughout the Cranpose framework.

Re-exports§

pub use alpha_mask::*;
pub use liquid_glass::*;
pub use render_effect::*;
pub use unit::*;

Modules§

alpha_mask
Alpha-mask helpers for graphics-layer effects.
framework_shaders
WGSL sources for the framework’s rendering pipelines.
liquid_glass
LiquidGlass effect: a refractive glass material rendered via RuntimeShader.
prelude
render_effect
Render effects that can be applied to graphics layers.
unit
Length units: Dp, Sp, Px, and the Density that converts between them.

Structs§

ArcGeometry
A resolved circular band between two radii, limited to an angular sweep.
Color
CommandRecording
One draw command’s recording in compact typed form: pure-numeric records for the common solid shapes (no Brush destructor branch, roughly half the bytes of the DrawPrimitive they materialize into) and ordinary primitives for everything else, with tape preserving global order. The index each tape entry carries into its per-kind store is the stable compact handle for the rare resource-bearing entries (others holds gradients, images, text, blends, and content markers whole).
CommandReplayFrame
A command’s replay verdict translated into the space its consumers see: spans address the run’s materialized primitive vector, not the record tape. This is what rides the render graph next to the primitives.
CommandReplayState
Per-command replay state: the retained snapshot (previous stable form of the recording) and the segments carved out of it. This is the double buffer sol’s plan sanctions — previous and current forms coexist only for comparison.
CommandSegment
One retained stretch of a command’s recording, addressed by the retained snapshot’s tape range. The id is stable for the segment’s lifetime — renderer-side retained slots key on it, and it survives other segments dying.
CornerRadii
DpOffset
Density-independent offset for shadows.
DrawScopeDefault
DrawTextStyle
Everything crate::DrawScope needs to measure and draw a run of text.
EdgeInsets
Padding values for each edge of a rectangle.
FinishedRecording
What DrawScopeDefault::finish hands back: the materialized primitives, the marker count that travels with them, and the recording buffers so a retaining caller can lend them to the same command’s next recording.
FontWeight
Font weight (100-900)
FxHasher
Non-cryptographic hasher for in-memory frame-to-frame change detection.
GraphicsLayer
ImageBitmap
Immutable RGBA image data used by UI primitives and render backends.
LineHeightStyle
How a line of text sits inside the height it was given.
Point
RecordTransform
One segment’s frame-over-frame motion: uniform scale and rotation about a shared external center.
Rect
RoundedCornerShape
Shadow
Static shadow configuration.
ShadowScope
Pixel-space shadow scope used by block-based APIs.
Size
SolidArcRecord
A solid SrcOver arc, recorded as the RAW draw parameters — before band resolution, tight-bounds trigonometry, or the degeneracy check, all of which happen at materialization. Retention verification must be able to compare what the app said, ahead of everything deriving from it.
SolidRectRecord
A solid SrcOver rect, recorded as raw values.
SolidRoundRectRecord
A solid SrcOver rounded rect (also the lowering of draw_circle), recorded as raw values.
Stroke
Describes how an outline is stroked.
TextMeasurement
What a string occupies once laid out — the answer DrawScope::measure_text gives, and exactly the box draw_text fills.
TextPrimitive
A run of text, positioned and ready to rasterize.
TransformOrigin
VectorPath
A parsed SVG path: subpaths flattened to polylines, ready to fill.

Enums§

BlendMode
Blend mode used for draw primitives.
Brush
ColorFilter
Simple image color filter model.
CompositingStrategy
Controls how a graphics layer is composited into its parent target.
DrawPrimitive
FontStyle
Font style (normal, italic, oblique)
FrameSpan
One primitive-space span of a CommandReplayFrame.
GradientBlurDirection
Axis and direction used to interpolate the blur radius.
ImageBitmapError
Errors returned while constructing an ImageBitmap.
ImageSampling
Texture sampling mode for image primitives.
LayerShape
LineHeightAlignment
Where the leading — the difference between a line’s box and the font’s own ascent-plus-descent extent — is spent.
LineHeightMode
What a requested line height means when the font does not fit inside it.
LineHeightTrim
Which edges of a text block give their leading back.
PathFillRule
Fill rule for VectorPath rasterization.
RecordMatch
The result of verifying one incoming record against its retained counterpart under a segment transform.
ReplayOutcome
What one frame of verification decided for a command.
ReplaySpan
One span of this frame’s recording, in tape order.
ShadowPrimitive
Describes a shadow to be rendered. Each renderer chooses how to blur.
StrokeCap
Shape of the two ends of an open stroked path (an arc, today).
StrokeJoin
Shape produced where two stroked segments meet at a corner.
SvgPathError
Errors produced while parsing SVG path data.
TextAlign
Horizontal placement of the text block inside the box it is drawn in.
TextVerticalAlign
Vertical placement of the text block inside the box it is drawn in.

Constants§

GRADIENT_BLUR_WGSL
WGSL implementation of a per-fragment Gaussian-style blur kernel.
MAX_SEGMENT_RECORDS
Chains longer than this split into multiple groups, bounding the blast radius of any one entry going dynamic later.
MIN_REPLAY_COMMAND_RECORDS
Below this many records a command is not worth watching at all.
MIN_SEGMENT_RECORDS
Below this many entries a stable stretch is not worth a retained group. Mirrors the flat-list detector.
TAU
Full turn in radians.

Traits§

DrawScope
DrawTextMeasurer
Font-backed measurement, injected into a crate::DrawScopeDefault by the UI layer.
RenderHash
VerifyExecutor
Fans independent verification bodies across worker threads. run(i) is called exactly once for every i in 0..jobs, from any thread; the call returns only after every job finished (jobs borrow the caller’s stack). The renderer wires its frame worker pool in through this seam so the recorder crate stays free of threading machinery.

Functions§

align_text_block
Resolves the top-left corner a text block of measurement gets when it is aligned inside rect.
arc_anchor_transform
Derives the segment transform from an arc anchor pair. Arcs pin both scale and rotation exactly.
arc_band
Resolves the (inner, outer, cap) band described by a crate::DrawPrimitive::Arc.
arcs_anchor_compatible
Similarity-invariant compatibility of a fresh arc with a retained one, for re-locating a segment when dynamic spans change length. Colors are deliberately excluded — a twinkling anchor must still re-anchor its segment. A false positive costs a failed probe, never a wrong pixel.
circle_anchor_transform_pinned
Derives the segment transform from a circle anchor pair, with its pinnedness (an on-pivot circle pins no rotation).
circle_view
A circular round-rect (corner radius == half extent on every corner): the one rect family that stays itself under rotation about an external pivot. Returns (center, diameter).
estimate_text_measurement
Font-free estimate used when no DrawTextMeasurer is installed.
gradient_blur_effect
Build a spatially varying blur effect.
inflate_rect
Grows rect by amount on every side, clamping to a non-negative size.
is_circle
Whether corner radii + extents describe a circle.
match_arc
Verifies a fresh arc record against the retained one under t. Arc centers must sit on the shared pivot — that is what makes rotation a value change instead of a position change.
match_round_rect
Verifies a fresh circular round-rect against the retained one under t. Non-circular round rects never match — they do not survive rotation about an external pivot.
transforms_group
Whether an entry’s own implied transform is tightly consistent with a chain’s anchor transform. pinned marks transforms whose angle is meaningful — an on-pivot circle pins no rotation and joins any chain.

Type Aliases§

FxBuildHasher
std::hash::BuildHasher for FxHasher, for HashMap/HashSet on the per-frame path.