Struct gfx_voxel::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> Texture<R> where
R: Resources,
[src]
R: Resources,
fn empty<F>(factory: &mut F) -> Result<Texture<R>, CombinedError> where
F: Factory<R>,
F: Factory<R>,
Returns empty texture.
fn from_path<F, P>(
factory: &mut F,
path: P,
flip: Flip,
settings: &TextureSettings
) -> Result<Texture<R>, String> where
F: Factory<R>,
P: AsRef<Path>,
factory: &mut F,
path: P,
flip: Flip,
settings: &TextureSettings
) -> Result<Texture<R>, String> where
F: Factory<R>,
P: AsRef<Path>,
Creates a texture from path.
fn from_image<F>(
factory: &mut F,
img: &ImageBuffer<Rgba<u8>, Vec<u8>>,
settings: &TextureSettings
) -> Result<Texture<R>, CombinedError> where
F: Factory<R>,
factory: &mut F,
img: &ImageBuffer<Rgba<u8>, Vec<u8>>,
settings: &TextureSettings
) -> Result<Texture<R>, CombinedError> where
F: Factory<R>,
Creates a texture from image.
fn from_memory_alpha<F>(
factory: &mut F,
buffer: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Texture<R>, CombinedError> where
F: Factory<R>,
factory: &mut F,
buffer: &[u8],
width: u32,
height: u32,
settings: &TextureSettings
) -> Result<Texture<R>, CombinedError> where
F: Factory<R>,
Creates texture from memory alpha.
fn update<C>(
&mut self,
encoder: &mut Encoder<R, C>,
img: &ImageBuffer<Rgba<u8>, Vec<u8>>
) -> Result<(), UpdateError<[u16; 3]>> where
C: Buffer<R>,
&mut self,
encoder: &mut Encoder<R, C>,
img: &ImageBuffer<Rgba<u8>, Vec<u8>>
) -> Result<(), UpdateError<[u16; 3]>> where
C: Buffer<R>,
Updates the texture with an image.
Trait Implementations
impl<R> ImageSize for Texture<R> where
R: Resources,
[src]
R: Resources,
fn get_size(&self) -> (u32, u32)
Get the image size.
fn get_width(&self) -> u32
Gets the image width.
fn get_height(&self) -> u32
Gets the image height.
impl<R, C> UpdateTexture<Encoder<R, C>> for Texture<R> where
C: Buffer<R>,
R: Resources,
[src]
C: Buffer<R>,
R: Resources,
type Error = UpdateError<[u16; 3]>
fn update<O, S>(
&mut self,
encoder: &mut Encoder<R, C>,
format: Format,
memory: &[u8],
offset: O,
size: S
) -> Result<(), <Texture<R> as UpdateTexture<Encoder<R, C>>>::Error> where
O: Into<[u32; 2]>,
S: Into<[u32; 2]>,
&mut self,
encoder: &mut Encoder<R, C>,
format: Format,
memory: &[u8],
offset: O,
size: S
) -> Result<(), <Texture<R> as UpdateTexture<Encoder<R, C>>>::Error> where
O: Into<[u32; 2]>,
S: Into<[u32; 2]>,
impl<R> PartialEq<Texture<R>> for Texture<R> where
R: PartialEq<R> + Resources,
[src]
R: PartialEq<R> + Resources,
fn eq(&self, __arg_0: &Texture<R>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Texture<R>) -> bool
This method tests for !=
.
impl<F, R> CreateTexture<F> for Texture<R> where
F: Factory<R>,
R: Resources,
[src]
F: Factory<R>,
R: Resources,
type Error = CombinedError
fn create<S>(
factory: &mut F,
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Texture<R>, <Texture<R> as CreateTexture<F>>::Error> where
S: Into<[u32; 2]>,
factory: &mut F,
_format: Format,
memory: &[u8],
size: S,
settings: &TextureSettings
) -> Result<Texture<R>, <Texture<R> as CreateTexture<F>>::Error> where
S: Into<[u32; 2]>,
impl<R> Debug for Texture<R> where
R: Debug + Resources,
[src]
R: Debug + Resources,
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<R> Clone for Texture<R> where
R: Clone + Resources,
[src]
R: Clone + Resources,
fn clone(&self) -> Texture<R>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more