Skip to main content

Module brush

Module brush 

Source
Expand description

Node-graph composable brush engine.

Re-exports§

pub use node::BrushNodeRegistration;

Modules§

builtin_brushes
Built-in brushes shipped with the application.
bundle
.darkly-brush bundle format — ZIP archive containing a JSON envelope and an optional pre-baked thumbnail.
checkpoint_ring
Ring buffer of GPU texture checkpoints for partial stroke re-render.
composite_pipeline
Brush commit composite pipeline — the scratch → layer blit with shader-side Porter-Duff source-over against a canvas-copy background.
curve_math
Natural cubic spline with precomputed LUT.
eval
Brush graph evaluation runtime.
gpu_context
GPU context bundle passed to brush node evaluators during execute_gpu and render_cursor_preview_pipeline.
import
Import parsers for third-party brush formats.
interpolation
Interpolation of PaintInformation between pen samples.
library
In-memory brush library with optional filesystem backing.
node
Brush-flavoured wrapper around the generic NodeRegistration.
nodes
paint_info
Pen input data and stroke vector storage.
paint_target_ext
Brush extensions on GpuPaintTarget.
pipeline
Central brush pipeline registry, plumbing pipelines, and shared infra.
portable
Portable, human-friendly text representation of a brush graph.
preview_renderer
Full-stroke brush preview renderer.
save_points
Per-dab save points for O(1) stroke rewind.
scratch
Scratch — the writable stroke scratch and its read-mirror sibling.
spacing
Distance-based dab spacing.
stabilizer
Stroke stabilizer — retroactive stroke reshaping with zero lag.
stabilizers
state
Brush state shared across every engine in a DarklySession.
stroke_buffer
Stroke buffer — the per-stroke GPU resources that survive between pen events.
stroke_engine
Stroke engine — bridges pen input events to the brush node graph.
wgsl
Framework for compiling brush graphs to a single WGSL fragment shader.
wire
Brush-domain wire types and scalar values.

Structs§

BrushNodeRegistry
HashMap-backed registry of all brush node types.

Constants§

DAB_REFERENCE_SIZE
Reference dab dimension (width = height), in canvas pixels — the UI/UX convention that defines what brush size = 1.0 means in canvas-pixel terms. Used by:

Functions§

compile_from_json
Deserialize a brush graph from JSON and compile it.
compile_graph
Compile any brush graph into a ready-to-run runner.
default_graph
Build the default brush graph: pressure-sensitive disc through the compiled paint terminal. Same shape as Round in builtin_brushespen → paint_color → shape (sine, amplitude 0) → stamp → paint — minus the per-brush configuration closure (no exposed softness, no flow wire).
default_runner
Compile the default brush graph into a ready-to-run runner.
find_terminal
Convenience over crate::nodegraph::Graph::find_terminal for brush graphs: builds a fresh BrushNodeRegistry and delegates. Use this from any graph-only call site (benches, tests, the WASM bridge) where threading the registry through would be noise.
registry
Process-global brush-node registry. Built once on first access; every subsequent caller borrows the same &'static BrushNodeRegistry. The 20-plus former BrushNodeRegistry::new() sites all funnel through here now, so node metadata is materialized once per process instead of per graph compile / per-brush-builder.
reset_exposed_scrubs
Reset every exposed input port on every node back to its registration default. This produces a “canonical” view of the graph that’s independent of any user-facing scrubs (size, opacity, hardness, etc.).
validate_graph_json
Validate a brush graph from JSON without compiling.