pub struct ResidentImage {
pub id: ImageId,
pub region: AtlasRegion,
pub natural: [u32; 2],
pub padding: u32,
pub may_have_transparency: bool,
}Expand description
A resident image: the handle a paint names it by, and where its texels are.
Fields§
§id: ImageIdThe handle an ImageSource::OpaqueId carries.
region: AtlasRegionThe atlas rectangle holding the image’s own pixels, padding excluded.
Equal to natural unless the source was minified to
fit the atlas, in which case it is the smaller rectangle actually
uploaded.
natural: [u32; 2]The source’s own declared extent, before any minification.
Carried because it is the extent a paint transform was composed against
— compile::paint::encode_image_command derives its natural-to-dest
mapping from the ImageData’s declared size, which it reads before this
residency is consulted. A consumer that ends up sampling a minified
rectangle has to fold minify_scale into that
transform, and this is the half of the ratio the atlas rectangle does
not carry.
padding: u32Transparent padding pixels around region in the atlas.
may_have_transparency: boolWhether the image’s premultiplied pixels include any non-opaque texel.
Implementations§
Source§impl ResidentImage
impl ResidentImage
Sourcepub fn source(&self) -> ImageSource
pub fn source(&self) -> ImageSource
This image as the paint-side source a vello_common encoding carries.
Sourcepub fn minify_scale(&self) -> Option<(f32, f32)>
pub fn minify_scale(&self) -> Option<(f32, f32)>
The per-axis factor mapping a natural-space texel coordinate onto the
resident rectangle, or None when the source was stored at full size.
None rather than Some((1.0, 1.0)) so a caller can skip the rescale
entirely on the overwhelmingly common path, and so “was this image
minified?” is one question rather than a float comparison.
Trait Implementations§
Source§impl Clone for ResidentImage
impl Clone for ResidentImage
impl Copy for ResidentImage
Source§impl Debug for ResidentImage
impl Debug for ResidentImage
impl Eq for ResidentImage
Source§impl PartialEq for ResidentImage
impl PartialEq for ResidentImage
impl StructuralPartialEq for ResidentImage
Auto Trait Implementations§
impl Freeze for ResidentImage
impl RefUnwindSafe for ResidentImage
impl Send for ResidentImage
impl Sync for ResidentImage
impl Unpin for ResidentImage
impl UnsafeUnpin for ResidentImage
impl UnwindSafe for ResidentImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.