pub struct ImageData {
pub id: u64,
pub pixels: Vec<u8>,
pub width: u32,
pub height: u32,
}Fields§
§id: u64Content address: equal pixels at equal dimensions give equal ids, whoever built them and whenever.
The renderers key their texture caches on this and nothing else, so the id has to identify the image. A per-construction counter identified the allocation instead: a caller that rebuilt the same image each frame — which is what building an ImageData inside a widget body does — minted a fresh key every time, and every entry behind it became unreachable weight the cache could only shed by hitting its byte budget.
pixels: Vec<u8>RGBA8 pixels with premultiplied alpha. Premultiplication is applied automatically in new().
width: u32§height: u32Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageData
impl RefUnwindSafe for ImageData
impl Send for ImageData
impl Sync for ImageData
impl Unpin for ImageData
impl UnsafeUnpin for ImageData
impl UnwindSafe for ImageData
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