pub struct ImageResource {
pub key: ImageKey,
pub width: u32,
pub height: u32,
pub data: Vec<u8>,
}Expand description
A decoded image referenced by one or more DrawImage /
DrawRepeatingImage items. Like FontResource, the pixels
travel in the paint output’s image side-table (PaintList::images)
rather than inline on each item, so an image used by several items
ships its bytes once. The renderer interns each ImageResource
into its atlas and maps key → its internal image id;
ImageItem::image_key then resolves through that map.
Pixels are RGBA8, row-major, tightly packed —
data.len() == width * height * 4. The producer is responsible
for decoding (PNG / JPEG / data-URI / etc.) into this shape; the
renderer just uploads the bytes.
Fields§
§key: ImageKeyThe key ImageItem::image_key references.
width: u32Image width in pixels.
height: u32Image height in pixels.
data: Vec<u8>Decoded RGBA8 bytes (width * height * 4).
Trait Implementations§
Source§impl Clone for ImageResource
impl Clone for ImageResource
Source§fn clone(&self) -> ImageResource
fn clone(&self) -> ImageResource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ImageResource
impl Debug for ImageResource
Source§impl<'de> Deserialize<'de> for ImageResource
impl<'de> Deserialize<'de> for ImageResource
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ImageResource
impl RefUnwindSafe for ImageResource
impl Send for ImageResource
impl Sync for ImageResource
impl Unpin for ImageResource
impl UnsafeUnpin for ImageResource
impl UnwindSafe for ImageResource
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
Mutably borrows from an owned value. Read more