pub struct CanvasLayout { /* private fields */ }
Expand description
The layout of a full frame, with all planes and color.
Implementations§
Source§impl CanvasLayout
impl CanvasLayout
Sourcepub fn with_plane(bytes: PlaneBytes) -> Self
pub fn with_plane(bytes: PlaneBytes) -> Self
Construct a full frame from a single plane.
Sourcepub fn with_planes(
layers: &[PlaneBytes],
texel: Texel,
) -> Result<Self, LayoutError>
pub fn with_planes( layers: &[PlaneBytes], texel: Texel, ) -> Result<Self, LayoutError>
Create from a list of planes, and the texel they describe when merged.
Sourcepub fn with_row_layout(rows: &RowLayoutDescription) -> Result<Self, LayoutError>
pub fn with_row_layout(rows: &RowLayoutDescription) -> Result<Self, LayoutError>
Create a buffer layout given the layout of a simple, strided matrix.
Sourcepub fn with_texel(
texel: &Texel,
width: u32,
height: u32,
) -> Result<Self, LayoutError>
pub fn with_texel( texel: &Texel, width: u32, height: u32, ) -> Result<Self, LayoutError>
Create a buffer layout from a texel and dimensions.
This is a simplification of with_row_layout
which itself is a simplified new
.
Sourcepub fn texel(&self) -> &Texel
pub fn texel(&self) -> &Texel
Get the texel represented by the canvas as a whole.
For non-planar images this is exactly the same as the texel of the first place. Otherwise, it is a merged representation.
Sourcepub fn texel_index(&self, x: u32, y: u32) -> u64
pub fn texel_index(&self, x: u32, y: u32) -> u64
Returns the index of a texel in a slice of planar image data.
Sourcepub fn as_row_layout(&self) -> RowLayoutDescription
pub fn as_row_layout(&self) -> RowLayoutDescription
Returns a matrix descriptor that can store all bytes.
Note: for the moment, all layouts are row-wise matrices. This will be relaxed in the future to also permit the construction from planar image layouts. In this case, the method will return a descriptor that does not equal this layout. Instead, an image buffer shaped like the returned descriptor can be used to re-arrange all bytes into a simple matrix form.
Sourcepub fn set_color(&mut self, color: Color) -> Result<(), LayoutError>
pub fn set_color(&mut self, color: Color) -> Result<(), LayoutError>
Set the color of the layout, if compatible with the texel.
pub fn as_plane(&self) -> Option<PlaneBytes>
Trait Implementations§
Source§impl Clone for CanvasLayout
impl Clone for CanvasLayout
Source§fn clone(&self) -> CanvasLayout
fn clone(&self) -> CanvasLayout
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more