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

pub struct Texture<L, D, P> where
    L: Layerable,
    D: Dimensionable,
    P: Pixel
{ /* fields omitted */ }

Texture.

L refers to the layering type; D refers to the dimension; P is the pixel format for the texels.

Methods

impl<L, D, P> Texture<L, D, P> where
    L: Layerable,
    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
[src]

Create a new texture.

  • The mipmaps parameter must be set to 0 if you want only one “layer of texels”. creating a texture without any layer wouldn’t make any sense, so if you want three layers, you will want the base layer plus two mipmaps layers: you will then pass 2 as value here.
  • The sampler parameter allows to customize the way the texture will be sampled in shader stages. Refer to the documentation of Sampler for further details.

pub fn into_raw(self) -> RawTexture[src]

Convert a texture to its raw representation.

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

Number of mipmaps in the texture.

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

Clear a part of a texture.

The part being cleared is defined by a rectangle in which the offset represents the left-upper corner and the size gives the dimension of the rectangle. All the covered texels by this rectangle will be cleared to the pixel value.

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

Clear a whole texture with a pixel value.

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

Upload texels to a part of a texture.

The part being updated is defined by a rectangle in which the offset represents the left-upper corner and the size gives the dimension of the rectangle. All the covered texels by this rectangle will be updated by the texels slice.

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

Upload texels to the whole texture.

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

Upload raw texels to a part of a texture.

This function is similar to upload_part but it works on P::RawEncoding instead of P::Encoding. This useful when the texels are represented as a contiguous array of raw components of the texels.

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

Upload raw texels to the whole texture.

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

Get the raw texels associated with this texture.

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

Get the inner size of the texture.

That value represents the dimension of the texture. Depending on the type of texture, its dimensionality varies. For instance:

  • 1D textures have a single value, giving the length of the texture.
  • 2D textures have two values for their width and height.
  • 3D textures have three values: width, height and depth.
  • Etc. etc.

Trait Implementations

impl<L, D, P> Drop for Texture<L, D, P> where
    L: Layerable,
    D: Dimensionable,
    P: Pixel
[src]

impl<L, D, P> Deref for Texture<L, D, P> where
    L: Layerable,
    D: Dimensionable,
    P: Pixel
[src]

type Target = RawTexture

The resulting type after dereferencing.

impl<L, D, P> DerefMut for Texture<L, D, P> where
    L: Layerable,
    D: Dimensionable,
    P: Pixel
[src]

Auto Trait Implementations

impl<L, D, P> !Send for Texture<L, D, P>

impl<L, D, P> Unpin for Texture<L, D, P> where
    L: Unpin,
    P: Unpin,
    <D as Dimensionable>::Size: Unpin

impl<L, D, P> !Sync for Texture<L, D, P>

impl<L, D, P> !UnwindSafe for Texture<L, D, P>

impl<L, D, P> !RefUnwindSafe for Texture<L, D, P>

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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