Struct gfx_texture::Texture [] [src]

pub struct Texture<R> where R: Resources {
    pub surface: Texture<R, R8_G8_B8_A8>,
    pub view: ShaderResourceView<R, [f32; 4]>,
}

Represents a texture.

Fields

surface: Texture<R, R8_G8_B8_A8>

Pixel storage for texture.

view: ShaderResourceView<R, [f32; 4]>

View used by shader.

Methods

impl<R: Resources> Texture<R>
[src]

fn empty<F>(factory: &mut F) -> Result<Self, CombinedError> where F: Factory<R>

Returns empty texture.

fn from_path<F, P>(factory: &mut F, path: P, flip: Flip, settings: &TextureSettings) -> Result<Self, String> where F: Factory<R>, P: AsRef<Path>

Creates a texture from path.

fn from_image<F>(factory: &mut F, img: &RgbaImage, settings: &TextureSettings) -> Result<Self, CombinedError> where F: Factory<R>

Creates a texture from image.

fn from_memory_alpha<F>(factory: &mut F, buffer: &[u8], width: u32, height: u32, settings: &TextureSettings) -> Result<Self, CombinedError> where F: Factory<R>

Creates texture from memory alpha.

fn update<F>(&mut self, factory: &mut F, img: &RgbaImage) -> Result<(), CombinedError> where F: Factory<R>

Updates the texture with an image.

Trait Implementations

impl<F, R> Rgba8Texture<F> for Texture<R> where F: Factory<R>, R: Resources
[src]

type Error = CombinedError

The error when creating or updating texture.

fn create<S: Into<[u32; 2]>>(factory: &mut F, memory: &[u8], size: S, settings: &TextureSettings) -> Result<Self, Self::Error>

Create rgba8 texture from memory.

fn update<S: Into<[u32; 2]>>(&mut self, factory: &mut F, memory: &[u8], _size: S) -> Result<(), Self::Error>

Update rgba8 texture.

impl<R> ImageSize for Texture<R> where R: Resources
[src]

fn get_size(&self) -> (u32, u32)

Get the image size.

fn get_width(&self) -> u32

Gets the image width.

fn get_height(&self) -> u32

Gets the image height.