Skip to main content

Crate jag_draw

Crate jag_draw 

Source
Expand description

jag-draw: GPU-accelerated 2D rendering engine.

Re-exports§

pub use wgpu;

Structs§

BackgroundRenderer
BasicSolidRenderer
Blitter
BlurRenderer
BoxShadowSpec
ClipRect
ColorLinPremul
ColorMask
Color emoji mask in full RGBA format (premultiplied alpha). Used for color emoji glyphs that have embedded color information.
Compositor
CosmicTextProvider
Legacy cosmic-text provider for compatibility.
DisplayList
ExternalTextureId
Opaque handle for an externally-managed texture (e.g., 3D viewport).
ExtractedExternalTextureDraw
Extracted external texture draw from DisplayList.
ExtractedImageDraw
Extracted image draw from DisplayList (placeholder for future)
ExtractedSvgDraw
Extracted SVG draw from DisplayList (placeholder for future)
ExtractedTextDraw
Extracted text draw from DisplayList
GlyphBatch
GPU-ready batch of glyph masks with positions and color. This is the canonical representation used when sending text to the GPU.
GpuScene
GraphicsEngine
Top-level engine handle.
GrayscaleFontdueProvider
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.
ImageCache
Simple raster image cache for PNG/JPEG/GIF/WebP with LRU eviction.
ImageRenderer
JagTextProvider
Text provider backed by jag-text (HarfBuzz) for shaping and swash for rasterization.
LineMetrics
Simplified line metrics
OverlaySolidRenderer
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.
OwnedBuffer
OwnedTexture
Painter
PassManager
PassTargets
Path
RasterizedGlyph
A glyph with its top-left offset relative to the run origin and a mask (subpixel or color).
Rect
RenderAllocator
Simple render allocator with basic pooling for textures and buffers.
RoundedRadii
RoundedRect
ScrimSolidRenderer
Scrim renderer that blends over all existing content without depth testing. Uses depth_write_enabled=false and depth_compare=Always so the scrim:
ScrimStencilMaskRenderer
Stencil-only mask writer for scrim cutouts (color writes disabled).
ScrimStencilRenderer
Scrim renderer that clips against stencil (hole stays transparent).
ShadowCompositeRenderer
ShapedGlyph
Minimal shaped glyph information for paragraph-level wrapping.
ShapedParagraph
Shaped paragraph representation for efficient wrapping.
SimpleFontdueProvider
LEGACY: Simple fontdue-based provider.
SmaaRenderer
Stroke
SubpixelMask
Subpixel mask in RGB coverage format stored in RGBA (A is unused). Supports 8-bit or 16-bit per-channel storage.
SvgImportStats
Import result counters for basic visibility/debugging.
SvgRasterCache
Simple SVG rasterization cache backed by usvg+resvg, with LRU eviction.
SvgStyle
Optional style overrides for SVG rendering
TextLayoutCache
A cache for wrapped text layouts to avoid per-frame allocations.
TextRenderer
TextRun
Transform2D
TransparentBatch
A contiguous range inside the transparent index buffer for a given z-index.
UnifiedSceneData
Complete unified scene data extracted from DisplayList
Vertex
Viewport
WrappedText
Cached wrapped text lines.

Enums§

Background
Brush
Command
FillRule
FontStyle
Font style for text rendering.
GlyphMask
Glyph mask that can be either subpixel (for text) or color (for emoji).
HitKind
HitShape
Public geometry snapshot of a hit element.
MaskFormat
Storage format for a subpixel coverage mask.
PathCmd
RootBackground
ScaleBucket
Bucketed scale factor used for raster cache keys. Provides more granular buckets to support icons at various sizes while maintaining cache efficiency.
Shape
SubpixelOrientation
LCD subpixel orientation along X axis.

Traits§

TextProvider
Text provider interface. Implementations convert a TextRun into 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.