Struct gfx_texture::Texture
[−]
[src]
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.
Methods
impl<R: Resources> Texture<R>
[src]
pub fn empty<F>(factory: &mut F) -> Result<Self, CombinedError> where
F: Factory<R>,
[src]
F: Factory<R>,
Returns empty texture.
pub fn from_path<F, P>(
factory: &mut F,
path: P,
flip: Flip,
settings: &TextureSettings
) -> Result<Self, String> where
F: Factory<R>,
P: AsRef<Path>,
[src]
factory: &mut F,
path: P,
flip: Flip,
settings: &TextureSettings
) -> Result<Self, String> where
F: Factory<R>,
P: AsRef<Path>,
Creates a texture from path.
pub fn from_image<F>(
factory: &mut F,
img: &RgbaImage,
settings: &TextureSettings
) -> Result<Self, CombinedError> where
F: Factory<R>,
[src]
factory: &mut F,
img: &RgbaImage,
settings: &TextureSettings
) -> Result<Self, CombinedError> where
F: Factory<R>,
Creates a texture from image.
pub fn from_memory_alpha<F>(
factory: &mut F,
buffer: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, CombinedError> where
F: Factory<R>,
[src]
factory: &mut F,
buffer: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Self, CombinedError> where
F: Factory<R>,
Creates texture from memory alpha.
pub fn update<C>(
&mut self,
encoder: &mut Encoder<R, C>,
img: &RgbaImage
) -> Result<(), UpdateError<[u16; 3]>> where
C: CommandBuffer<R>,
[src]
&mut self,
encoder: &mut Encoder<R, C>,
img: &RgbaImage
) -> Result<(), UpdateError<[u16; 3]>> where
C: CommandBuffer<R>,
Updates the texture with an image.
Trait Implementations
impl<F, R> CreateTexture<F> for Texture<R> where
F: Factory<R>,
R: Resources,
[src]
F: Factory<R>,
R: Resources,
type Error = CombinedError
The error when creating texture.
fn create<S: Into<[u32; 2]>>(
factory: &mut F,
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Self, Self::Error>
[src]
factory: &mut F,
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Self, Self::Error>
Create texture from memory.
impl<R, C> UpdateTexture<Encoder<R, C>> for Texture<R> where
R: Resources,
C: CommandBuffer<R>,
[src]
R: Resources,
C: CommandBuffer<R>,
type Error = UpdateError<[u16; 3]>
The error when updating texture.
fn update<O, S>(
&mut self,
encoder: &mut Encoder<R, C>,
format: Format,
memory: &[u8],
offset: O,
size: S
) -> Result<(), Self::Error> where
O: Into<[u32; 2]>,
S: Into<[u32; 2]>,
[src]
&mut self,
encoder: &mut Encoder<R, C>,
format: Format,
memory: &[u8],
offset: O,
size: S
) -> Result<(), Self::Error> where
O: Into<[u32; 2]>,
S: Into<[u32; 2]>,
Update the texture. Read more
impl<R> ImageSize for Texture<R> where
R: Resources,
[src]
R: Resources,