Expand description
Shared, cheaply-cloneable cache of decoded images for standalone-image rendering.
Mirrors validation::GitHubValidationCache: an Arc<Mutex<HashMap>> keyed by the raw
URL string. Loads (local file reads or remote fetches) run on worker tasks that
write their result here and wake the winit loop; the layout/draw path reads it.
Structs§
- Image
Cache - Thread-safe cache of image load states, shared across clones (like the GitHub
caches). Cheap to clone: just bumps the inner
Arc. - Loaded
Image - A decoded image ready to paint, plus its raster pixel size and logical display
size. For raster sources the two match; for SVG the raster size is supersampled
while the display size is the SVG’s intrinsic logical size (see
decode_svg).Arc-wrapped in the cache so a cache clone stays O(1) (theBlobis Arc-backed too, but theArc<LoadedImage>keeps the whole entry a single refcount bump).
Enums§
- Image
State - Load state for one image URL.
Functions§
- decode
- Decode encoded image bytes into a paintable
LoadedImage. Tries the raster path (PNG/JPEG/GIF/WebP) first, then falls back to SVG. ReturnsNoneon any failure. The RGBA8 buffer from theimagecrate is straight (un-premultiplied) alpha, matchingImageAlphaType::Alpha.