pub struct ImageData { /* private fields */ }Expand description
Decoded pixels: RGBA8, straight (not premultiplied) alpha, sRGB, row-major.
Cloning is cheap; the renderer caches the GPU texture by id.
Implementations§
Source§impl ImageData
impl ImageData
Sourcepub fn from_rgba8(
width: u32,
height: u32,
pixels: impl Into<Arc<[u8]>>,
) -> Option<ImageData>
pub fn from_rgba8( width: u32, height: u32, pixels: impl Into<Arc<[u8]>>, ) -> Option<ImageData>
Wraps RGBA8 pixels. Returns None when the buffer does not match the size.
Sourcepub fn from_fn(
width: u32,
height: u32,
f: impl Fn(u32, u32) -> Color,
) -> Option<ImageData>
pub fn from_fn( width: u32, height: u32, f: impl Fn(u32, u32) -> Color, ) -> Option<ImageData>
Builds an image by evaluating f(x, y) for every pixel (procedural art, tests).
Sourcepub fn aspect_ratio(&self) -> f32
pub fn aspect_ratio(&self) -> f32
Width divided by height.
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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