Struct piston_window::prelude::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]>,
}
Expand description
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,
impl<R> Texture<R>where R: Resources,
pub fn empty<F, C>(
context: &mut TextureContext<F, R, C>
) -> Result<Texture<R>, Error>where
F: Factory<R>,
C: Buffer<R>,
pub fn empty<F, C>( context: &mut TextureContext<F, R, C> ) -> Result<Texture<R>, Error>where F: Factory<R>, C: Buffer<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>, Error>where
F: Factory<R>,
C: Buffer<R>,
P: AsRef<Path>,
pub fn from_path<F, C, P>( context: &mut TextureContext<F, R, C>, path: P, flip: Flip, settings: &TextureSettings ) -> Result<Texture<R>, Error>where F: Factory<R>, C: Buffer<R>, P: AsRef<Path>,
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
F: Factory<R>,
C: Buffer<R>,
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 F: Factory<R>, C: Buffer<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
F: Factory<R>,
C: Buffer<R>,
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 F: Factory<R>, C: Buffer<R>,
Creates texture from memory alpha.
Trait Implementations§
§impl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R>where
F: Factory<R>,
R: Resources,
C: Buffer<R>,
impl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R>where F: Factory<R>, R: Resources, C: Buffer<R>,
§fn create<S>(
context: &mut TextureContext<F, R, C>,
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Texture<R>, <Texture<R> as TextureOp<TextureContext<F, R, C>>>::Error>where
S: Into<[u32; 2]>,
fn create<S>( context: &mut TextureContext<F, R, C>, _format: Format, memory: &[u8], size: S, settings: &TextureSettings ) -> Result<Texture<R>, <Texture<R> as TextureOp<TextureContext<F, R, C>>>::Error>where S: Into<[u32; 2]>,
Create texture from memory.
§impl<R> PartialEq<Texture<R>> for Texture<R>where
R: PartialEq<R> + Resources,
impl<R> PartialEq<Texture<R>> for Texture<R>where R: PartialEq<R> + Resources,
§impl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R>where
F: Factory<R>,
R: Resources,
C: Buffer<R>,
impl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R>where F: Factory<R>, R: Resources, C: Buffer<R>,
impl<R> StructuralPartialEq for Texture<R>where 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more