Skip to main content

Crate valo

Crate valo 

Source
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§

AtlasReport
AtlasReport summarizes one glyph-atlas family.
Backdrop
Backdrop describes what a backdrop save layer samples from the scene beneath it.
BackdropGroup
BackdropGroup summarizes regions sharing one backdrop-blur key.
Color
Color is a straight-alpha sRGB color.
Context
Context renders display lists on a host-owned wgpu device.
ContourMeasure
ContourMeasure finds positions, tangents, and segments by distance along a contour.
Dash
Dash defines alternating painted and skipped lengths along each contour.
Decoration
Decoration describes a line drawn relative to styled text.
DisplayList
DisplayList is an immutable recording of drawing commands.
DisplayListBuilder
DisplayListBuilder records drawing commands into an immutable display list.
FaceSet
FaceSet stores registered fonts and their global fallback order.
FocalCircle
FocalCircle defines the start circle of a radial gradient.
Font
Font is one parsed font face or named variable-font instance.
FontAttrs
FontAttrs describes a face’s position within a font family.
FontCollection
FontCollection owns registered faces and sources for resolving missing fonts.
FontDemand
FontDemand describes font requests that no registered face could satisfy.
FontId
FontId identifies a registered font within a FaceSet or FontCollection.
FontUid
FontUid is the process-unique identity of one font instance.
GradientStop
GradientStop assigns a color to one position along a gradient.
Hud
Hud records renderer statistics as an in-frame overlay.
Image
Image is a cheap-to-clone handle to an immutable GPU image.
ImageDesc
ImageDesc describes an RGBA8 image upload.
Line
Line contains the visually ordered runs and metrics of one laid-out line.
LineMetrics
LineMetrics describes one laid-out line for caret and selection geometry.
MaskBlur
MaskBlur applies a Gaussian blur to a draw’s coverage mask.
Matrix
Matrix is a full 4×4 column-major transform.
MemoryReport
MemoryReport summarizes resources retained between frames.
Offscreen
Offscreen is a copyable render target that does not require a display.
Paint
Paint describes how a drawing operation produces and composites pixels.
Paragraph
Paragraph is the primary API for laying out and drawing text.
ParagraphBuilder
ParagraphBuilder assembles styled text into a Paragraph for layout and drawing.
ParagraphStyle
ParagraphStyle controls layout behavior for a complete paragraph.
Path
Path is an immutable collection of line and Bézier contours.
PathBuilder
PathBuilder records commands used to create an immutable Path.
PathSample
PathSample contains a position and direction along a measured contour.
PersistentCanvas
PersistentCanvas retains pixels across incremental frames.
PlacedRun
PlacedRun groups positioned glyphs sharing one font and paint style.
Point
Point is a position or vector in two-dimensional coordinates.
PoolReport
PoolReport summarizes one resource pool or cache.
PositionWithAffinity
PositionWithAffinity identifies where to place a caret in editable text.
Rasterizer
Rasterizer converts font glyphs into CPU bitmap or distance-field images.
Rect
Rect is an axis-aligned rectangle in Valo’s y-down coordinate system.
RenderStats
RenderStats reports the work performed by one render operation.
RenderTarget
RenderTarget is the destination for one render operation.
Sampling
Sampling controls filtering, mip selection, and behavior outside an image.
Shadow
Shadow describes a colored, offset copy painted beneath text.
Size
Size is a width and height in two-dimensional coordinates.
Stroke
Stroke describes the width, ends, joins, and optional dash pattern of a line.
Surface
Surface manages a presentable native window or browser canvas.
SurfaceFrame
SurfaceFrame is one acquired surface frame ready for rendering.
TextStyle
TextStyle controls font selection and painting for a span of text.
TextTiers
TextTiers selects the text rendering method by device-space font size.
WgpuCounters
WgpuCounters reports wgpu’s internal live-object accounting.

Enums§

BlendMode
BlendMode controls how source pixels combine with destination pixels.
BlurStyle
BlurStyle controls where blurred coverage appears relative to a shape.
Cap
Cap determines how a stroke ends at an open contour.
ClipOp
ClipOp controls how a clip shape changes the current clip.
ColorFilter
ColorFilter transforms the pixels produced by a draw or layer.
DecorationKind
DecorationKind selects where a text decoration is drawn.
FillRule
FillRule determines which regions of overlapping contours are filled.
Filter
Filter controls interpolation between neighboring texels.
ImageFilter
ImageFilter transforms a rasterized draw or layer.
Join
Join determines how consecutive stroke segments meet.
MaskKind
MaskKind controls how a mask layer converts pixels into coverage.
MipmapMode
MipmapMode controls how minified images select mip levels.
Op
Op is one recorded display-list command.
PaintStyle
PaintStyle selects filled geometry or a stroked outline.
Shader
Shader determines the color painted at each point of a drawing operation.
SpreadMode
SpreadMode controls a gradient outside its zero-to-one span.
TextAlign
TextAlign controls horizontal line placement within the layout width.
TextDirection
TextDirection selects a paragraph’s base writing direction.
TileMode
TileMode controls samples outside an image’s bounds.
VariantCaps
VariantCaps selects an OpenType capitalization variant.
Winding
Winding selects the traversal direction of a closed contour.

Traits§

DrawGlyphRunExt
DrawGlyphRunExt adds paragraph recording with an explicit fill paint.
DrawParagraphExt
DrawParagraphExt adds paragraph recording to DisplayListBuilder.
FontSource
FontSource locates fonts that are not already registered.

Functions§

constrain_radii
constrain_radii proportionally reduces circular radii to fit a rectangle.
constrain_radii_elliptical
constrain_radii_elliptical proportionally reduces elliptical radii to fit.
dash_contours
dash_contours splits contours into the painted stretches of a dash pattern.
local_tolerance
local_tolerance returns local curve tolerance for quarter-pixel device error.
stroke_contains
stroke_contains reports whether a point lies inside expanded stroke geometry.
unpremultiply
unpremultiply converts premultiplied RGBA8 pixels to straight alpha in place.

Type Aliases§

FontData
FontData is shared, immutable font-file storage supplied by the host.