[][src]Struct duku::Texture

pub struct Texture {
    pub data: Vec<u8>,
    // some fields omitted
}

Image that can be sampled in a shader.

These can be created from bytes of color data, PNGs JPEGs, etc.

Fields

data: Vec<u8>

pixel data as bytes

Implementations

impl Texture[src]

pub const fn width(&self) -> u32[src]

Get the width of the texture

pub const fn height(&self) -> u32[src]

Get the height of the texture

pub fn set_pixel(&mut self, x: u32, y: u32, color: impl Into<Rgb>)[src]

Set a pixel in the image to a specific color.

Works only if the texture has no mips.

pub fn pixel(&self, x: u32, y: u32) -> Rgb[src]

Get a pixel's color in the image

pub const fn shader_index(&self) -> u32[src]

Get index to be used in shader for sampling

Auto Trait Implementations

impl RefUnwindSafe for Texture

impl Send for Texture

impl Sync for Texture

impl Unpin for Texture

impl UnwindSafe for Texture

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.