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
sourceimpl<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, String> where
F: Factory<R>,
C: CommandBuffer<R>,
P: AsRef<Path>,
pub fn from_path<F, C, P>(
context: &mut TextureContext<F, R, C>,
path: P,
flip: Flip,
settings: &TextureSettings
) -> Result<Self, String> where
F: Factory<R>,
C: CommandBuffer<R>,
P: AsRef<Path>,
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
sourceimpl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R> where
F: Factory<R>,
R: Resources,
C: CommandBuffer<R>,
impl<F, R, C> CreateTexture<TextureContext<F, R, C>> for Texture<R> where
F: Factory<R>,
R: Resources,
C: CommandBuffer<R>,
sourceimpl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R> where
F: Factory<R>,
R: Resources,
C: CommandBuffer<R>,
impl<F, R, C> UpdateTexture<TextureContext<F, R, C>> for Texture<R> where
F: Factory<R>,
R: Resources,
C: CommandBuffer<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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more