[−][src]Struct web_glitz::image::texture_2d_array::LevelLayerSubImage
Methods
impl<'a, F> LevelLayerSubImage<'a, F> where
F: TextureFormat,
[src]
F: TextureFormat,
pub fn level(&self) -> usize
[src]
Returns the index of the mipmap level this LevelLayerSubImage references.
pub fn layer(&self) -> usize
[src]
Returns the index of the layer this LevelLayerSubImage references.
pub fn region(&self) -> Region2D
[src]
Returns the Region2D of the level-layer this LevelLayerSubImage references.
pub fn width(&self) -> u32
[src]
Returns the width of this LevelLayerSubImage.
pub fn height(&self) -> u32
[src]
Returns the height of this LevelLayerSubImage.
pub fn sub_image(&self, region: Region2D) -> LevelLayerSubImage<F>
[src]
Returns a reference to the sub-region of this LevelLayerSubImage's image described by
region
.
See also LevelLayer::sub_image.
pub fn upload_command<D, T>(
&self,
data: Image2DSource<D, T>
) -> LevelLayerUploadCommand<D, T, F> where
T: ClientFormat<F>,
[src]
&self,
data: Image2DSource<D, T>
) -> LevelLayerUploadCommand<D, T, F> where
T: ClientFormat<F>,
Returns a command which, when executed, replaces the image data in this
LevelLayerSubImage's image region with the image data provided in data
.
The image data must be stored in a ClientFormat that is suitable for the texture's TextureFormat.
If the dimensions of the image provided in data
are not sufficient to cover the
LevelLayerSubImage region entirely, starting from the region's origin, then only the
region of overlap is updated (note that the origin of a region is at its lower left corner).
For example, given a LevelLayerSubImage with a width of 256 pixels and a height of 256
pixels, and data
with a width of 128 pixels and a height of 128 pixels, then only the
lower left quadrant of the LevelLayerSubImage's region is updated. If the dimensions of
the image provided in data
would, when starting from the LevelLayerSubImage's origin,
cover more than the LevelLayerSubImage's region (the width and/or height of data
is/are
greater than the width and/or height of the LevelLayerSubImage's region), then any pixels
that would fall outside of the LevelLayerSubImage's region are ignored. For example, given
a LevelLayerSubImage with a width of 256 pixels and a height of 256 pixels, and data
with a width of 256 pixels and a height of 512 pixels, then only the lower half of the image
in data
is used to update the LevelLayerSubImage and the upper half is ignored.
Example
use web_glitz::image::{Image2DSource, MipmapLevels, Region2D}; use web_glitz::image::format::RGB8; use web_glitz::image::texture_2d_array::Texture2DArrayDescriptor; let texture = context.create_texture_2d_array(&Texture2DArrayDescriptor { format: RGB8, width: 256, height: 256, depth: 16, levels: MipmapLevels::Complete }).unwrap(); let level = texture.base_level(); let layers = level.layers(); let layer = layers.get(0).unwrap(); let sub_image = layer.sub_image(Region2D::Area((0, 0), 128, 128)); let pixels: Vec<[u8; 3]> = vec![[255, 0, 0]; 128 * 128]; let data = Image2DSource::from_pixels(pixels, 128, 128).unwrap(); context.submit(sub_image.upload_command(data));
Auto Trait Implementations
impl<'a, F> !Send for LevelLayerSubImage<'a, F>
impl<'a, F> Unpin for LevelLayerSubImage<'a, F>
impl<'a, F> !Sync for LevelLayerSubImage<'a, F>
impl<'a, F> !UnwindSafe for LevelLayerSubImage<'a, F>
impl<'a, F> !RefUnwindSafe for LevelLayerSubImage<'a, F>
Blanket Implementations
impl<D, T> IntoBuffer<T> for D where
D: Borrow<T> + 'static,
T: Copy + 'static,
[src]
D: Borrow<T> + 'static,
T: Copy + 'static,
fn into_buffer<Rc>(Self, &Rc, UsageHint) -> Buffer<T> where
Rc: RenderingContext + Clone + 'static,
[src]
Rc: RenderingContext + Clone + 'static,
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,