Struct piston_window::Texture[]

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

Represents a texture.

Fields

surface: Texture<R, R8_G8_B8_A8>

Pixel storage for texture.

sampler: Sampler<R>

Sampler for texture.

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

View used by shader.

Implementations

impl<R> Texture<R> where
    R: Resources, 

pub fn empty<F, C>(
    context: &mut TextureContext<F, R, C>
) -> Result<Texture<R>, Error> where
    C: Buffer<R>,
    F: Factory<R>, 

Returns empty texture.

pub fn from_path<F, C, P>(
    context: &mut TextureContext<F, R, C>,
    path: P,
    flip: Flip,
    settings: &TextureSettings
) -> Result<Texture<R>, String> where
    C: Buffer<R>,
    P: AsRef<Path>,
    F: Factory<R>, 

Creates a texture from path.

pub fn from_image<F, C>(
    context: &mut TextureContext<F, R, C>,
    img: &ImageBuffer<Rgba<u8>, Vec<u8, Global>>,
    settings: &TextureSettings
) -> Result<Texture<R>, Error> where
    C: Buffer<R>,
    F: Factory<R>, 

Creates a texture from image.

pub fn from_memory_alpha<F, C>(
    context: &mut TextureContext<F, R, C>,
    buffer: &[u8],
    width: u32,
    height: u32,
    settings: &TextureSettings
) -> Result<Texture<R>, Error> where
    C: Buffer<R>,
    F: Factory<R>, 

Creates texture from memory alpha.

pub fn update<F, C>(
    &mut self,
    context: &mut TextureContext<F, R, C>,
    img: &ImageBuffer<Rgba<u8>, Vec<u8, Global>>
) -> Result<(), Error> where
    C: Buffer<R>,
    F: Factory<R>, 

Updates the texture with an image.

Trait Implementations

impl<R> Clone for Texture<R> where
    R: Clone + Resources, 

impl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R> where
    C: Buffer<R>,
    F: Factory<R>,
    R: Resources, 

impl<R> Debug for Texture<R> where
    R: Debug + Resources, 

impl<R> ImageSize for Texture<R> where
    R: Resources, 

impl<R> PartialEq<Texture<R>> for Texture<R> where
    R: PartialEq<R> + Resources, 

impl<R> StructuralPartialEq for Texture<R> where
    R: Resources, 

impl<F, R> TextureOp<F> for Texture<R> where
    R: Resources, 

type Error = Error

The error when performing an operation.

impl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R> where
    C: Buffer<R>,
    F: Factory<R>,
    R: Resources, 

Auto Trait Implementations

impl<R> !RefUnwindSafe for Texture<R>

impl<R> Send for Texture<R>

impl<R> Sync for Texture<R>

impl<R> Unpin for Texture<R>

impl<R> !UnwindSafe for Texture<R>

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> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.