pub enum RequestedSize {
Full,
Reduced {
width: u32,
height: u32,
},
NoSamples,
}Expand description
The resolution an image was decoded at.
Full and a Reduced size are distinct keys: an image cached reduced
cannot serve a full-resolution request, while a full-resolution one can
serve anything.
Variants§
Full
Every sample the image has.
Reduced
At most this many pixels in each direction.
NoSamples
No samples at all. A build for text extraction, which never reads an image, asks for this, and the image object is not emitted — the same outcome as a codec refusing it. Never a key the cache holds: on the corpus’s image documents the decode was 87% of a text run.
Implementations§
Source§impl RequestedSize
impl RequestedSize
Sourcepub fn for_device(width: f64, height: f64) -> Self
pub fn for_device(width: f64, height: f64) -> Self
The request a device box of width by height float pixels makes.
The box is the render device’s whole extent, not an image’s destination
rectangle, so a 5000x5000 image on a 612x792 page is reduced by four
however small the cm that draws it is. Dimensions truncate, and a box
under one pixel on either axis names Self::Full rather than a zero
reduction.
Sourcepub fn levels(self, width: u32, height: u32) -> u8
pub fn levels(self, width: u32, height: u32) -> u8
How many resolution levels to skip to satisfy this request for an
image of width by height.
Integer division, then the smaller of the two, then a floored base-two logarithm — so an image four times too large skips two levels and one three times too large skips one.
Trait Implementations§
Source§impl Clone for RequestedSize
impl Clone for RequestedSize
Source§fn clone(&self) -> RequestedSize
fn clone(&self) -> RequestedSize
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more