Expand description
The public API: what an application draws with.
Everything below this — tessellation, batching, backends, presentation — is
reachable but not usually reached for. A caller describes a frame on a
Canvas and hands the resulting Recording to a target.
Recording is deliberately separate from submitting. Describing a whole frame before any of it reaches the GPU is what lets draws share a single pass, and it keeps the API free of the question of when work is flushed.
Color is linear throughout, converted at this boundary. Blending,
filtering, and antialiasing all average colors, and averaging sRGB-encoded
values is visibly wrong — see Color.
Re-exports§
pub use canvas::Canvas;pub use canvas::Layer;pub use canvas::Morphology;pub use canvas::Pass;pub use canvas::PointMode;pub use canvas::Recording;pub use canvas::Rect;pub use canvas::RoundingRadii;pub use canvas::TextureSource;pub use color::Color;pub use color::ColorSpace;pub use execute::execute;pub use execute::execute_deferred;pub use execute::execute_layers;pub use execute::render_offscreen;pub use execute::render_offscreen_into;pub use execute::resolve_sources;pub use paint::GradientStop;pub use paint::ImageFilter;pub use paint::MaskBlurStyle;pub use paint::Paint;pub use paint::Shader;pub use paint::Style;pub use vertices::SourceRect;pub use vertices::Sprite;pub use vertices::VertexMode;pub use vertices::Vertices;
Modules§
- canvas
- The recording surface.
- color
- Color.
- execute
- Rendering a recording, pass by pass.
- paint
- How a shape is drawn.
- ramp
- Baking a gradient’s stops into a texture the shader can sample.
- vertices
- A triangle mesh a caller supplies directly.
Structs§
- Affine2
- Two-dimensional vector and affine types, from
glam. A 2D affine transform, which can represent translation, rotation, scaling and shear. - Atlas
- A square atlas of glyph coverage, and where each glyph landed.
- Atlas
Rect - Where a glyph sits in the atlas, in texels.
- Coverage
- A rasterized glyph, as a caller supplies it.
- Dash
- A dash pattern: alternating drawn and skipped lengths, and where to start.
- Extent2D
- A 2D extent in pixels.
- Glyph
Key - What identifies a glyph in the atlas.
- Path
- A path: a verb stream plus the points those verbs consume.
- Path
Builder - Accumulates verbs and points into a
Path. - Positioned
Glyph - One glyph, placed.
- Stroke
Style - A stroke’s geometric parameters.
- Transform2D
- A transform of the plane that may carry perspective.
- Vec2
- Two-dimensional vector and affine types, from
glam. A 2-dimensional vector.
Enums§
- Atlas
Error - Why a glyph could not be added.
- Blend
Mode - How a draw combines with what a target already holds.
- Color
Filter - A function applied to a material’s color, after the material and before the blend.
- Color
Form - What space a color filter’s matrix expects its input in.
- Fill
Rule - How overlapping subpaths combine when filling.
- Gamma
- Which way through the sRGB transfer function a
ColorFilter::Gammagoes. - LineCap
- How a stroke terminates at an open end.
- Line
Join - How a stroke turns a corner.
- Pixel
Format - Pixel formats the renderer can target.
- Sampling
- How a texture is read between its texels.
- Tile
Mode - What happens outside an image’s own bounds.
Constants§
- MAX_
STOPS - The most stops a gradient carries in the material itself.