Struct web_glitz::image::texture_2d_array::LevelLayerSubImage [−][src]
pub struct LevelLayerSubImage<'a, F> { /* fields omitted */ }
Implementations
Returns the index of the mipmap level this LevelLayerSubImage references.
Returns the index of the layer this LevelLayerSubImage references.
Returns the Region2D of the level-layer this LevelLayerSubImage references.
Returns the width of this LevelLayerSubImage.
Returns the height of this LevelLayerSubImage.
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: PixelUnpack<F>,
pub fn upload_command<D, T>(
&self,
data: Image2DSource<D, T>
) -> LevelLayerUploadCommand<D, T, F> where
T: PixelUnpack<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 as a PixelUnpack type 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.try_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));
Trait Implementations
impl<'a, F> BlitSource for Texture2DArrayLevelLayerSubImage<'a, F> where
F: TextureFormat + 'static,
impl<'a, F> BlitSource for Texture2DArrayLevelLayerSubImage<'a, F> where
F: TextureFormat + 'static,
type Format = F
type Format = F
The image storage format used by the source image.
Encapsulates the information about the blit source required by the BlitCommand.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl<'a, F> !RefUnwindSafe for LevelLayerSubImage<'a, F>
impl<'a, F> !Send for LevelLayerSubImage<'a, F>
impl<'a, F> !Sync for LevelLayerSubImage<'a, F>
impl<'a, F> Unpin for LevelLayerSubImage<'a, F>
impl<'a, F> !UnwindSafe for LevelLayerSubImage<'a, F>
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn into_buffer<Rc>(Self, &Rc, BufferId, UsageHint) -> Buffer<T> where
Rc: 'static + RenderingContext + Clone,
pub fn into_buffer<Rc>(Self, &Rc, BufferId, UsageHint) -> Buffer<T> where
Rc: 'static + RenderingContext + Clone,
Stores the data in a buffer belonging to the given context
, using the given usage_hint
. Read more