Skip to main content

Module image_viewer

Module image_viewer 

Source
Expand description

One image at a time, framed, zoomed and panned — and never fetched.

§What this component will not do

It does not fetch anything. This crate has no network and no asset resolution, which is the same reason crate::content::Markdown draws an image reference as a placeholder naming its source. A host that holds the bytes hands an element back through ImageViewer::image; a host that does not has said so, and the frame names what is missing rather than showing a grey box.

It does not measure the source. Natural dimensions are a caller input. An image whose pixel size nobody stated reads Size unknown, and the zoom and fit controls are refused with that as their reason, because a scale is a ratio against a size and there is no size. Reporting the rendered size as though it were the source’s would be inventing the fact the host declined to give.

It does not decide what a refusal means. Loading, an image the host could not supply, an image that failed to decode, and a ready one are four renderings, and the middle two carry the host’s own sentence.

It does not wrap. Stepping past the last image would put the reader back at the first without saying so, so the control at each end is refused and the position is published instead.

Structs§

ImageFrame
One image the viewer can show.
ImageRequest
An image the viewer had to draw and the host has not supplied.
ImageSize
The pixel size of a source, as the host stated it.
ImageViewer
A framed viewer for one image at a time.

Enums§

FitMode
How the image is sized inside the frame.
ImageState
What the host knows about one image right now.
ImageViewerEvent
What a viewer reports. It applies none of it.