Expand description
valo — a standalone 2D render engine on wgpu. The facade crate: everything a host needs, one import.
use valo::{Color, Context, DisplayListBuilder, Paint, Rect, RenderTarget};
let mut ctx = Context::new(device, queue);
let mut b = DisplayListBuilder::new();
b.draw_rect(Rect::new(10.0, 10.0, 100.0, 80.0), &Paint::from_color(Color::rgb(0.9, 0.3, 0.2)));
let dl = b.build();
ctx.render(&dl, &RenderTarget {
view,
texture,
format: wgpu::TextureFormat::Rgba8Unorm,
size: [800, 600],
clear: Some(Color::WHITE),
});Structs§
- Atlas
Report AtlasReportsummarizes one glyph-atlas family.- Backdrop
Backdropdescribes what a backdrop save layer samples from the scene beneath it.- Backdrop
Group BackdropGroupsummarizes regions sharing one backdrop-blur key.- Color
Coloris a straight-alpha sRGB color.- Context
- Context renders display lists on a host-owned wgpu device.
- Contour
Measure ContourMeasurefinds positions, tangents, and segments by distance along a contour.- Dash
Dashdefines alternating painted and skipped lengths along each contour.- Decoration
Decorationdescribes a line drawn relative to styled text.- Display
List DisplayListis an immutable recording of drawing commands.- Display
List Builder DisplayListBuilderrecords drawing commands into an immutable display list.- FaceSet
FaceSetstores registered fonts and their global fallback order.- Focal
Circle FocalCircledefines the start circle of a radial gradient.- Font
Fontis one parsed font face or named variable-font instance.- Font
Attrs FontAttrsdescribes a face’s position within a font family.- Font
Collection FontCollectionowns registered faces and sources for resolving missing fonts.- Font
Demand FontDemanddescribes font requests that no registered face could satisfy.- FontId
FontIdidentifies a registered font within aFaceSetorFontCollection.- FontUid
FontUidis the process-unique identity of one font instance.- Gradient
Stop GradientStopassigns a color to one position along a gradient.- Hud
Hudrecords renderer statistics as an in-frame overlay.- Image
Imageis a cheap-to-clone handle to an immutable GPU image.- Image
Desc ImageDescdescribes an RGBA8 image upload.- Line
Linecontains the visually ordered runs and metrics of one laid-out line.- Line
Metrics LineMetricsdescribes one laid-out line for caret and selection geometry.- Mask
Blur MaskBlurapplies a Gaussian blur to a draw’s coverage mask.- Matrix
Matrixis a full 4×4 column-major transform.- Memory
Report MemoryReportsummarizes resources retained between frames.- Offscreen
Offscreenis a copyable render target that does not require a display.- Paint
Paintdescribes how a drawing operation produces and composites pixels.- Paragraph
Paragraphis the primary API for laying out and drawing text.- Paragraph
Builder ParagraphBuilderassembles styled text into aParagraphfor layout and drawing.- Paragraph
Style ParagraphStylecontrols layout behavior for a complete paragraph.- Path
Pathis an immutable collection of line and Bézier contours.- Path
Builder PathBuilderrecords commands used to create an immutablePath.- Path
Sample PathSamplecontains a position and direction along a measured contour.- Persistent
Canvas PersistentCanvasretains pixels across incremental frames.- Placed
Run PlacedRungroups positioned glyphs sharing one font and paint style.- Point
Pointis a position or vector in two-dimensional coordinates.- Pool
Report PoolReportsummarizes one resource pool or cache.- Position
With Affinity PositionWithAffinityidentifies where to place a caret in editable text.- Rasterizer
Rasterizerconverts font glyphs into CPU bitmap or distance-field images.- Rect
Rectis an axis-aligned rectangle in Valo’s y-down coordinate system.- Render
Stats RenderStatsreports the work performed by one render operation.- Render
Target RenderTargetis the destination for one render operation.- Sampling
Samplingcontrols filtering, mip selection, and behavior outside an image.- Shadow
Shadowdescribes a colored, offset copy painted beneath text.- Size
Sizeis a width and height in two-dimensional coordinates.- Stroke
Strokedescribes the width, ends, joins, and optional dash pattern of a line.- Surface
Surfacemanages a presentable native window or browser canvas.- Surface
Frame SurfaceFrameis one acquired surface frame ready for rendering.- Text
Style TextStylecontrols font selection and painting for a span of text.- Text
Tiers TextTiersselects the text rendering method by device-space font size.- Wgpu
Counters WgpuCountersreports wgpu’s internal live-object accounting.
Enums§
- Blend
Mode BlendModecontrols how source pixels combine with destination pixels.- Blur
Style BlurStylecontrols where blurred coverage appears relative to a shape.- Cap
Capdetermines how a stroke ends at an open contour.- ClipOp
ClipOpcontrols how a clip shape changes the current clip.- Color
Filter ColorFiltertransforms the pixels produced by a draw or layer.- Decoration
Kind DecorationKindselects where a text decoration is drawn.- Fill
Rule FillRuledetermines which regions of overlapping contours are filled.- Filter
Filtercontrols interpolation between neighboring texels.- Image
Filter ImageFiltertransforms a rasterized draw or layer.- Join
Joindetermines how consecutive stroke segments meet.- Mask
Kind MaskKindcontrols how a mask layer converts pixels into coverage.- Mipmap
Mode MipmapModecontrols how minified images select mip levels.- Op
Opis one recorded display-list command.- Paint
Style PaintStyleselects filled geometry or a stroked outline.- Shader
Shaderdetermines the color painted at each point of a drawing operation.- Spread
Mode SpreadModecontrols a gradient outside its zero-to-one span.- Text
Align TextAligncontrols horizontal line placement within the layout width.- Text
Direction TextDirectionselects a paragraph’s base writing direction.- Tile
Mode TileModecontrols samples outside an image’s bounds.- Variant
Caps VariantCapsselects an OpenType capitalization variant.- Winding
Windingselects the traversal direction of a closed contour.
Traits§
- Draw
Glyph RunExt DrawGlyphRunExtadds paragraph recording with an explicit fill paint.- Draw
Paragraph Ext DrawParagraphExtadds paragraph recording toDisplayListBuilder.- Font
Source FontSourcelocates fonts that are not already registered.
Functions§
- constrain_
radii constrain_radiiproportionally reduces circular radii to fit a rectangle.- constrain_
radii_ elliptical constrain_radii_ellipticalproportionally reduces elliptical radii to fit.- dash_
contours dash_contourssplits contours into the painted stretches of a dash pattern.- local_
tolerance local_tolerancereturns local curve tolerance for quarter-pixel device error.- stroke_
contains stroke_containsreports whether a point lies inside expanded stroke geometry.- unpremultiply
unpremultiplyconverts premultiplied RGBA8 pixels to straight alpha in place.
Type Aliases§
- Font
Data FontDatais shared, immutable font-file storage supplied by the host.