Struct show_image::ImageInfo

source ·
pub struct ImageInfo {
    pub pixel_format: PixelFormat,
    pub size: UVec2,
    pub stride: UVec2,
}
Expand description

Information describing the binary data of an image.

Fields§

§pixel_format: PixelFormat

The pixel format of the image data.

§size: UVec2

The size of the image in pixels

§stride: UVec2

The stride of the image data in bytes for both X and Y.

Implementations§

source§

impl ImageInfo

source

pub fn new(pixel_format: PixelFormat, width: u32, height: u32) -> Self

Create a new info struct with the given format, width and height.

The row stride is automatically calculated based on the image width and pixel format. If you wish to use a different row stride, construct the struct directly.

source

pub fn mono8(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit monochrome image with the given width and height.

source

pub fn mono_alpha8(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit monochrome image with with alpha channel and the given width and height.

source

pub fn mono_alpha8_premultiplied(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit monochrome image with premultiplied alpha channel and the given width and height.

source

pub fn bgr8(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit BGR image with the given width and height.

source

pub fn bgra8(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit BGRA image with the given width and height.

source

pub fn bgra8_premultiplied(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit BGRA image with premultiplied alpha channel and the given width and height.

source

pub fn rgb8(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit RGB image with the given width and height.

source

pub fn rgba8(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit RGBA image with the given width and height.

source

pub fn rgba8_premultiplied(width: u32, height: u32) -> Self

Create a new info struct for an 8-bit RGBA image with premultiplied alpha channel and the given width and height.

source

pub fn byte_size(self) -> u64

Get the image size in bytes.

Trait Implementations§

source§

impl Clone for ImageInfo

source§

fn clone(&self) -> ImageInfo

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ImageInfo

source§

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

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

impl PartialEq for ImageInfo

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ImageInfo

source§

impl Eq for ImageInfo

source§

impl StructuralPartialEq for ImageInfo

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> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

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

source§

impl<T> WasmNotSync for T
where T: Sync,