Struct gfx_texture::Texture
source · 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§
source§impl<R: Resources> Texture<R>
impl<R: Resources> Texture<R>
sourcepub fn empty<F, C>(context: &mut TextureContext<F, R, C>) -> Result<Self, Error>where
F: Factory<R>,
C: CommandBuffer<R>,
pub fn empty<F, C>(context: &mut TextureContext<F, R, C>) -> Result<Self, Error>where
F: Factory<R>,
C: CommandBuffer<R>,
Returns empty texture.
sourcepub fn from_path<F, C, P>(
context: &mut TextureContext<F, R, C>,
path: P,
flip: Flip,
settings: &TextureSettings
) -> Result<Self, Error>
pub fn from_path<F, C, P>( context: &mut TextureContext<F, R, C>, path: P, flip: Flip, settings: &TextureSettings ) -> Result<Self, Error>
Creates a texture from path.
sourcepub fn from_image<F, C>(
context: &mut TextureContext<F, R, C>,
img: &RgbaImage,
settings: &TextureSettings
) -> Result<Self, Error>where
F: Factory<R>,
C: CommandBuffer<R>,
pub fn from_image<F, C>(
context: &mut TextureContext<F, R, C>,
img: &RgbaImage,
settings: &TextureSettings
) -> Result<Self, Error>where
F: Factory<R>,
C: CommandBuffer<R>,
Creates a texture from image.
sourcepub fn from_memory_alpha<F, C>(
context: &mut TextureContext<F, R, C>,
buffer: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, Error>where
F: Factory<R>,
C: CommandBuffer<R>,
pub fn from_memory_alpha<F, C>(
context: &mut TextureContext<F, R, C>,
buffer: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, Error>where
F: Factory<R>,
C: CommandBuffer<R>,
Creates texture from memory alpha.
sourcepub fn update<F, C>(
&mut self,
context: &mut TextureContext<F, R, C>,
img: &RgbaImage
) -> Result<(), Error>where
F: Factory<R>,
C: CommandBuffer<R>,
pub fn update<F, C>(
&mut self,
context: &mut TextureContext<F, R, C>,
img: &RgbaImage
) -> Result<(), Error>where
F: Factory<R>,
C: CommandBuffer<R>,
Updates the texture with an image.
Trait Implementations§
source§impl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R>
impl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R>
source§impl<R> PartialEq for Texture<R>
impl<R> PartialEq for Texture<R>
source§impl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R>
impl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R>
impl<R> StructuralPartialEq for Texture<R>where
R: Resources,
Auto Trait Implementations§
impl<R> Freeze for Texture<R>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more