Expand description
jag-draw: GPU-accelerated 2D rendering engine.
Re-exports§
pub use wgpu;
Structs§
- Background
Renderer - Basic
Solid Renderer - Blitter
- Blur
Renderer - BoxShadow
Spec - Clip
Rect - Color
LinPremul - Color
Mask - Color emoji mask in full RGBA format (premultiplied alpha). Used for color emoji glyphs that have embedded color information.
- Compositor
- Cosmic
Text Provider - Legacy cosmic-text provider for compatibility.
- Display
List - External
Texture Id - Opaque handle for an externally-managed texture (e.g., 3D viewport).
- Extracted
External Texture Draw - Extracted external texture draw from DisplayList.
- Extracted
Image Draw - Extracted image draw from DisplayList (placeholder for future)
- Extracted
SvgDraw - Extracted SVG draw from DisplayList (placeholder for future)
- Extracted
Text Draw - Extracted text draw from DisplayList
- Glyph
Batch - GPU-ready batch of glyph masks with positions and color. This is the canonical representation used when sending text to the GPU.
- GpuScene
- Graphics
Engine - Top-level engine handle.
- Grayscale
Fontdue Provider - LEGACY: Grayscale fontdue provider.
- HitIndex
- Spatial index for hit testing. Currently implemented as a flat list while preserving z-order and clip stacks. Can be upgraded to a tree later.
- HitResult
- Result of a hit test for a single topmost element.
- Hyperlink
- Hyperlink element combining text, optional underline, and a URL target.
- Image
Cache - Simple raster image cache for PNG/JPEG/GIF/WebP with LRU eviction.
- Image
Renderer - JagText
Provider - Text provider backed by jag-text (HarfBuzz) for shaping and swash for rasterization.
- Line
Metrics - Simplified line metrics
- Overlay
Solid Renderer - Solid renderer variant for overlays that do not participate in depth testing.
Uses the same SOLID_WGSL shader and vertex layout as
BasicSolidRenderer, but disables depth-stencil so overlay quads simply blend over existing content. - Owned
Buffer - Owned
Texture - Painter
- Pass
Manager - Pass
Targets - Path
- Rasterized
Glyph - A glyph with its top-left offset relative to the run origin and a mask (subpixel or color).
- Rect
- Render
Allocator - Simple render allocator with basic pooling for textures and buffers.
- Rounded
Radii - Rounded
Rect - Scrim
Solid Renderer - Scrim renderer that blends over all existing content without depth testing. Uses depth_write_enabled=false and depth_compare=Always so the scrim:
- Scrim
Stencil Mask Renderer - Stencil-only mask writer for scrim cutouts (color writes disabled).
- Scrim
Stencil Renderer - Scrim renderer that clips against stencil (hole stays transparent).
- Shadow
Composite Renderer - Shaped
Glyph - Minimal shaped glyph information for paragraph-level wrapping.
- Shaped
Paragraph - Shaped paragraph representation for efficient wrapping.
- Simple
Fontdue Provider - LEGACY: Simple fontdue-based provider.
- Smaa
Renderer - Stroke
- Subpixel
Mask - Subpixel mask in RGB coverage format stored in RGBA (A is unused). Supports 8-bit or 16-bit per-channel storage.
- SvgImport
Stats - Import result counters for basic visibility/debugging.
- SvgRaster
Cache - Simple SVG rasterization cache backed by usvg+resvg, with LRU eviction.
- SvgStyle
- Optional style overrides for SVG rendering
- Text
Layout Cache - A cache for wrapped text layouts to avoid per-frame allocations.
- Text
Renderer - TextRun
- Transform2D
- Transparent
Batch - A contiguous range inside the transparent index buffer for a given z-index.
- Unified
Scene Data - Complete unified scene data extracted from DisplayList
- Vertex
- Viewport
- Wrapped
Text - Cached wrapped text lines.
Enums§
- Background
- Brush
- Command
- Fill
Rule - Font
Style - Font style for text rendering.
- Glyph
Mask - Glyph mask that can be either subpixel (for text) or color (for emoji).
- HitKind
- HitShape
- Public geometry snapshot of a hit element.
- Mask
Format - Storage format for a subpixel coverage mask.
- PathCmd
- Root
Background - Scale
Bucket - Bucketed scale factor used for raster cache keys. Provides more granular buckets to support icons at various sizes while maintaining cache efficiency.
- Shape
- Subpixel
Orientation - LCD subpixel orientation along X axis.
Traits§
- Text
Provider - Text provider interface. Implementations convert a
TextRuninto positioned glyph masks.
Functions§
- choose_
srgb_ surface_ format - Choose an sRGB surface format when available; otherwise, pick the first format.
- grayscale_
to_ rgb_ equal - Convert an 8-bit grayscale coverage mask to an RGB mask with equal channels (grayscale AA).
- grayscale_
to_ rgb_ equal16 - grayscale_
to_ subpixel_ rgb - Convert an 8-bit grayscale coverage mask to an RGB subpixel mask. Uses a gentle subpixel shift for improved clarity on small text.
- grayscale_
to_ subpixel_ rgb16 - 16-bit variants for higher precision masks. Channels are u16 in [0..65535], packed little-endian into the data buffer. Alpha is unused.
- hit_
test - Convenience: perform a one-shot hit test on the display list without keeping an index.
- import_
svg_ geometry_ to_ painter - Import an SVG file into the display list as vector geometry.
- invalidate_
glyph_ run_ cache - Invalidate all cached glyph rasterizations.
- lerp_
color - logical_
multiplier - Minimal DPI helpers used across the engine to keep scaling consistent.
- make_
surface_ config - Create a surface configuration for the given size, favoring FIFO present mode when present.
- rasterize_
run_ cached - Rasterize a text run using a global glyph-run cache.
- render_
wrapped_ text - Render wrapped text to a display list or canvas.
- sample_
gradient_ stops - snap_
to_ device - Snap a coordinate to the nearest device pixel for crisp edges at a given scale factor.
- svg_
intrinsic_ size - Get the intrinsic pixel size of an SVG file according to usvg’s parsing of width/height/viewBox. Returns (width,height) rounded to integers.
- svg_
requires_ rasterization - Determine if an SVG requires rasterization or can be rendered as vector geometry. Returns true if the SVG uses features that cannot be expressed analytically (filters, patterns, masks, gradients, images, text, etc.)
- upload_
display_ list - upload_
display_ list_ unified - Upload a DisplayList extracting all element types for unified rendering. This is the main entry point for the unified rendering system.
- wrap_
text_ fast - Fast word-wrapping using character-count approximation.
- z_
index_ to_ depth - Convert z-index to depth value for GPU depth testing. Maps z-index range to [0.0, 1.0] where lower z-index = closer to camera = lower depth.
Type Aliases§
- Color
- Alias for the premultiplied linear color type, for a friendlier name in APIs.