[−][src]Struct luminance::texture::Texture
GPU textures.
Implementations
impl<B: ?Sized, D, P> Texture<B, D, P> where
B: TextureBackend<D, P>,
D: Dimensionable,
P: Pixel,
[src]
B: TextureBackend<D, P>,
D: Dimensionable,
P: Pixel,
pub fn new<C>(
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: Sampler
) -> Result<Self, TextureError> where
C: GraphicsContext<Backend = B>,
[src]
ctx: &mut C,
size: D::Size,
mipmaps: usize,
sampler: Sampler
) -> Result<Self, TextureError> where
C: GraphicsContext<Backend = B>,
Create a new Texture
.
size
is the wished size of the Texture
.
mipmaps
is the number of extra mipmaps to allocate with the texture. 0
means that the
texture will only be made of a base level.
sampler
is a Sampler
object that will be used when sampling the texture from inside a
shader, for instance.
Notes
Feel free to have a look at the documentation of GraphicsContext::new_texture
for a
simpler interface.
pub fn mipmaps(&self) -> usize
[src]
Return the number of mipmaps.
pub fn size(&self) -> D::Size
[src]
Return the size of the texture.
pub fn clear_part(
&mut self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
pixel: P::Encoding
) -> Result<(), TextureError>
[src]
&mut self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
pixel: P::Encoding
) -> Result<(), TextureError>
Clear the texture with a single pixel value.
This function will assign the input pixel value to all the pixels in the rectangle described
by size
and offset
in the texture.
pub fn clear(
&mut self,
gen_mipmaps: GenMipmaps,
pixel: P::Encoding
) -> Result<(), TextureError>
[src]
&mut self,
gen_mipmaps: GenMipmaps,
pixel: P::Encoding
) -> Result<(), TextureError>
Clear the texture with a single pixel value.
This function will assign the input pixel value to all the pixels in the texture.
pub fn upload_part(
&mut self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::Encoding]
) -> Result<(), TextureError>
[src]
&mut self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::Encoding]
) -> Result<(), TextureError>
Upload pixels to a region of the texture described by the rectangle made with size
and
offset
.
pub fn upload(
&mut self,
gen_mipmaps: GenMipmaps,
texels: &[P::Encoding]
) -> Result<(), TextureError>
[src]
&mut self,
gen_mipmaps: GenMipmaps,
texels: &[P::Encoding]
) -> Result<(), TextureError>
Upload pixels to the whole texture.
pub fn upload_part_raw(
&mut self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
[src]
&mut self,
gen_mipmaps: GenMipmaps,
offset: D::Offset,
size: D::Size,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
Upload raw data to a region of the texture described by the rectangle made with size
and
offset
.
pub fn upload_raw(
&mut self,
gen_mipmaps: GenMipmaps,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
[src]
&mut self,
gen_mipmaps: GenMipmaps,
texels: &[P::RawEncoding]
) -> Result<(), TextureError>
Upload raw data to the whole texture.
pub fn get_raw_texels(&self) -> Result<Vec<P::RawEncoding>, TextureError> where
P::RawEncoding: Copy + Default,
[src]
P::RawEncoding: Copy + Default,
Get a copy of all the pixels from the texture.
Auto Trait Implementations
impl<B: ?Sized, D, P> RefUnwindSafe for Texture<B, D, P> where
P: RefUnwindSafe,
<D as Dimensionable>::Size: RefUnwindSafe,
<B as TextureBase>::TextureRepr: RefUnwindSafe,
P: RefUnwindSafe,
<D as Dimensionable>::Size: RefUnwindSafe,
<B as TextureBase>::TextureRepr: RefUnwindSafe,
impl<B, D, P> !Send for Texture<B, D, P>
impl<B, D, P> !Sync for Texture<B, D, P>
impl<B: ?Sized, D, P> Unpin for Texture<B, D, P> where
<D as Dimensionable>::Size: Unpin,
<B as TextureBase>::TextureRepr: Unpin,
<D as Dimensionable>::Size: Unpin,
<B as TextureBase>::TextureRepr: Unpin,
impl<B: ?Sized, D, P> UnwindSafe for Texture<B, D, P> where
P: RefUnwindSafe,
<D as Dimensionable>::Size: UnwindSafe,
<B as TextureBase>::TextureRepr: UnwindSafe,
P: RefUnwindSafe,
<D as Dimensionable>::Size: UnwindSafe,
<B as TextureBase>::TextureRepr: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,