[][src]Struct luminance::texture::Texture

pub struct Texture<B: ?Sized, D, P> where
    B: TextureBackend<D, P>,
    D: Dimensionable,
    P: Pixel
{ /* fields omitted */ }

GPU textures.

Implementations

impl<B: ?Sized, D, P> Texture<B, D, P> where
    B: TextureBackend<D, P>,
    D: Dimensionable,
    P: Pixel
[src]

pub fn new<C>(
    ctx: &mut C,
    size: D::Size,
    mipmaps: usize,
    sampler: Sampler
) -> Result<Self, TextureError> where
    C: GraphicsContext<Backend = B>, 
[src]

Create a new Texture.

size is the wished size of the Texture.

mipmaps is the number of extra mipmaps to allocate with the texture. 0 means that the texture will only be made of a base level.

sampler is a Sampler object that will be used when sampling the texture from inside a shader, for instance.

Notes

Feel free to have a look at the documentation of GraphicsContext::new_texture for a simpler interface.

pub fn mipmaps(&self) -> usize[src]

Return the number of mipmaps.

pub fn size(&self) -> D::Size[src]

Return the size of the texture.

pub fn clear_part(
    &mut self,
    gen_mipmaps: GenMipmaps,
    offset: D::Offset,
    size: D::Size,
    pixel: P::Encoding
) -> Result<(), TextureError>
[src]

Clear the texture with a single pixel value.

This function will assign the input pixel value to all the pixels in the rectangle described by size and offset in the texture.

pub fn clear(
    &mut self,
    gen_mipmaps: GenMipmaps,
    pixel: P::Encoding
) -> Result<(), TextureError>
[src]

Clear the texture with a single pixel value.

This function will assign the input pixel value to all the pixels in the texture.

pub fn upload_part(
    &mut self,
    gen_mipmaps: GenMipmaps,
    offset: D::Offset,
    size: D::Size,
    texels: &[P::Encoding]
) -> Result<(), TextureError>
[src]

Upload pixels to a region of the texture described by the rectangle made with size and offset.

pub fn upload(
    &mut self,
    gen_mipmaps: GenMipmaps,
    texels: &[P::Encoding]
) -> Result<(), TextureError>
[src]

Upload pixels to the whole texture.

pub fn upload_part_raw(
    &mut self,
    gen_mipmaps: GenMipmaps,
    offset: D::Offset,
    size: D::Size,
    texels: &[P::RawEncoding]
) -> Result<(), TextureError>
[src]

Upload raw data to a region of the texture described by the rectangle made with size and offset.

pub fn upload_raw(
    &mut self,
    gen_mipmaps: GenMipmaps,
    texels: &[P::RawEncoding]
) -> Result<(), TextureError>
[src]

Upload raw data to the whole texture.

pub fn get_raw_texels(&self) -> Result<Vec<P::RawEncoding>, TextureError> where
    P::RawEncoding: Copy + Default
[src]

Get a copy of all the pixels from the texture.

Auto Trait Implementations

impl<B: ?Sized, D, P> RefUnwindSafe for Texture<B, D, P> where
    P: RefUnwindSafe,
    <D as Dimensionable>::Size: RefUnwindSafe,
    <B as TextureBase>::TextureRepr: RefUnwindSafe
[src]

impl<B, D, P> !Send for Texture<B, D, P>[src]

impl<B, D, P> !Sync for Texture<B, D, P>[src]

impl<B: ?Sized, D, P> Unpin for Texture<B, D, P> where
    <D as Dimensionable>::Size: Unpin,
    <B as TextureBase>::TextureRepr: Unpin
[src]

impl<B: ?Sized, D, P> UnwindSafe for Texture<B, D, P> where
    P: RefUnwindSafe,
    <D as Dimensionable>::Size: UnwindSafe,
    <B as TextureBase>::TextureRepr: UnwindSafe
[src]

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.