Struct qwac::texture::ImageTexture

source ·
pub struct ImageTexture { /* private fields */ }

Implementations§

source§

impl ImageTexture

source

pub async fn from_canvas<C>(canvas: &C) -> Result<Self, CreateTextureError>
where C: Canvas,

source

pub fn from_canvas_callback<C, F>(canvas: &C, callback: F)
where C: Canvas, F: FnOnce(Result<Self, CreateTextureError>) + 'static,

source

pub async fn from_rgba<P>( pixels: P, width: u32, height: u32 ) -> Result<Self, CreateTextureError>
where P: AsRef<[u8]>,

source

pub fn from_rgba_callback<P, F>(pixels: P, width: u32, height: u32, callback: F)
where P: AsRef<[u8]>, F: FnOnce(Result<Self, CreateTextureError>) + 'static,

source

pub async fn from_file<D, M>( data: D, mime_type: M ) -> Result<Self, CreateTextureError>
where D: AsRef<[u8]>, M: AsRef<str>,

source

pub fn from_file_callback<D, M, F>(data: D, mime_type: M, callback: F)
where D: AsRef<[u8]>, M: AsRef<str>, F: FnOnce(Result<Self, CreateTextureError>) + 'static,

source

pub async fn from_pixels<P>( pixels: P, width: u32, height: u32 ) -> Result<Self, CreateTextureError>
where P: IntoIterator, P::Item: Into<Rgba>,

Build the texture from individual pixels.

source

pub fn from_pixels_callback<P, F>( pixels: P, width: u32, height: u32, callback: F )
where P: IntoIterator, P::Item: Into<Rgba>, F: FnOnce(Result<Self, CreateTextureError>) + 'static,

Build the texture from individual pixels.

Trait Implementations§

source§

impl Debug for ImageTexture

source§

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

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

impl Drop for ImageTexture

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl From<&ImageTexture> for OffscreenCanvas

source§

fn from(value: &ImageTexture) -> Self

Converts to this type from the input type.
source§

impl From<ImageTexture> for OffscreenCanvas

source§

fn from(value: ImageTexture) -> Self

Converts to this type from the input type.
source§

impl Texture for ImageTexture

source§

fn id(&self) -> i32

source§

fn size(&self) -> Size2D<u16, Pixels>

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