Trait RaylibTexture2D

Source
pub trait RaylibTexture2D: AsRef<Texture2D> + AsMut<Texture2D> {
    // Provided methods
    fn width(&self) -> i32 { ... }
    fn height(&self) -> i32 { ... }
    fn mipmaps(&self) -> i32 { ... }
    fn format(&self) -> i32 { ... }
    fn update_texture(&mut self, pixels: &[u8]) -> Result<(), Error> { ... }
    fn update_texture_rec(
        &mut self,
        rec: impl Into<Rectangle>,
        pixels: &[u8],
    ) -> Result<(), Error> { ... }
    fn load_image(&self) -> Result<Image, Error> { ... }
    fn gen_texture_mipmaps(&mut self) { ... }
    fn set_texture_filter(&self, _: &RaylibThread, filter_mode: TextureFilter) { ... }
    fn set_texture_wrap(&self, _: &RaylibThread, wrap_mode: TextureWrap) { ... }
    fn is_texture_valid(&self) -> bool { ... }
}

Provided Methods§

Source

fn width(&self) -> i32

Source

fn height(&self) -> i32

Source

fn mipmaps(&self) -> i32

Source

fn format(&self) -> i32

Source

fn update_texture(&mut self, pixels: &[u8]) -> Result<(), Error>

Updates GPU texture with new data.

Source

fn update_texture_rec( &mut self, rec: impl Into<Rectangle>, pixels: &[u8], ) -> Result<(), Error>

Update GPU texture rectangle with new data

Source

fn load_image(&self) -> Result<Image, Error>

Gets pixel data from GPU texture and returns an Image. Fairly sure this would never fail. If it does wrap in result.

Source

fn gen_texture_mipmaps(&mut self)

Generates GPU mipmaps for a texture.

Source

fn set_texture_filter(&self, _: &RaylibThread, filter_mode: TextureFilter)

Sets global texture scaling filter mode.

Source

fn set_texture_wrap(&self, _: &RaylibThread, wrap_mode: TextureWrap)

Sets global texture wrapping mode.

Source

fn is_texture_valid(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§