Skip to main content

Module image_store

Module image_store 

Expand description

Async image loading, decode and cache — keyed by URL. Displaying remote thumbnails on the UI thread would jank every frame, so loads run off the UI thread — fetched through a caller-supplied Fetcher and decoded as crate::background::Background jobs, or fetched by the host through a HostImageLoader — and the decoded peniko::ImageData is cached and handed back on a later frame; until then the caller paints a placeholder.

No networking here — the toolkit stays HTTP-free, and a no-op fetcher keeps tests and hermetic offline builds deterministic. Decoding uses the image crate; cloning a returned ImageData only bumps an Arc.

Structs§

HostImageLoader
The loading half of a host-driven ImageStore.
ImageCompletionTicket
Opaque custody for one admitted asynchronous image decode.
ImageStore
A cheap-to-clone handle to a shared image cache whose loads run off the UI thread — on the toolkit’s Background for ImageStore::new, or in the host for ImageStore::host_driven.

Functions§

loads_in_flight
Loads in flight (queued or decoding) across every ImageStore in the process. A screenshot capture waits, within a bound, until this is zero.
paint_image_cover
Paint img into rect with a cover fit (fill the rect, preserve aspect, crop the overflow) clipped to a rounded rectangle, matching the shape a procedural placeholder occupied.

Type Aliases§

Fetcher
Fetches the raw encoded bytes for a URL, or None on failure. Invoked as background work, so it may block on I/O.