Skip to main content

ImageData

Struct ImageData 

Source
pub struct ImageData { /* private fields */ }
Expand description

An image’s pixels: 8-bit RGBA, sRGB, row by row from the top-left corner (width * height * 4 bytes). Immutable once built.

Implementations§

Source§

impl ImageData

Source

pub fn from_rgba(width: u32, height: u32, rgba: Vec<u8>) -> ImageData

Builds an image from raw RGBA pixels. Panics if the length is not width * height * 4.

Source

pub fn into_handle(self) -> Arc<ImageData> ⓘ

Wraps the image in a shared handle (cheap to clone, stable for caching).

Source

pub fn id(&self) -> u64

Unique, stable identity (the GPU cache key).

Source

pub fn width(&self) -> u32

Width in pixels.

Source

pub fn height(&self) -> u32

Height in pixels.

Source

pub fn size(&self) -> Size

Size in pixels, as a Size.

Source

pub fn rgba(&self) -> &[u8] ⓘ

The RGBA bytes (sRGB), row by row.

Trait Implementations§

Source§

impl Debug for ImageData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for ImageData

Source§

impl PartialEq for ImageData

Two images are “equal” when they share the same identity — the same resource — without comparing pixels. That keeps cache lookups and scene equality cheap.

Source§

fn eq(&self, other: &ImageData) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.