#[non_exhaustive]pub struct SampleLayout { /* private fields */ }Expand description
Complete interleaved storage description for a single plane of pixels.
Implementations§
Source§impl SampleLayout
impl SampleLayout
Sourcepub const RGB8: SampleLayout
pub const RGB8: SampleLayout
Packed 8-bit RGB (3 B/px).
Sourcepub const RGBA8: SampleLayout
pub const RGBA8: SampleLayout
Packed 8-bit RGBA (4 B/px).
Sourcepub const BGR8: SampleLayout
pub const BGR8: SampleLayout
Packed 8-bit BGR (3 B/px).
Sourcepub const BGRA8: SampleLayout
pub const BGRA8: SampleLayout
Packed 8-bit BGRA (4 B/px).
Sourcepub const RGBX8: SampleLayout
pub const RGBX8: SampleLayout
Packed 8-bit RGBx (4 B/px, 4th byte padding).
Sourcepub const BGRX8: SampleLayout
pub const BGRX8: SampleLayout
Packed 8-bit BGRx (4 B/px, 4th byte padding).
Sourcepub const GRAY8: SampleLayout
pub const GRAY8: SampleLayout
Packed 8-bit grayscale (1 B/px).
Sourcepub const GRAYA8: SampleLayout
pub const GRAYA8: SampleLayout
Packed 8-bit grayscale + alpha (2 B/px).
Sourcepub const RGB16: SampleLayout
pub const RGB16: SampleLayout
Packed 16-bit RGB (6 B/px).
Sourcepub const RGBA16: SampleLayout
pub const RGBA16: SampleLayout
Packed 16-bit RGBA (8 B/px).
Sourcepub const GRAY16: SampleLayout
pub const GRAY16: SampleLayout
Packed 16-bit grayscale (2 B/px).
Sourcepub const GRAYA16: SampleLayout
pub const GRAYA16: SampleLayout
Packed 16-bit grayscale + alpha (4 B/px).
Sourcepub const RGBF16: SampleLayout
pub const RGBF16: SampleLayout
Packed f16 RGB (6 B/px).
Sourcepub const RGBAF16: SampleLayout
pub const RGBAF16: SampleLayout
Packed f16 RGBA (8 B/px).
Sourcepub const GRAYF16: SampleLayout
pub const GRAYF16: SampleLayout
Packed f16 grayscale (2 B/px).
Sourcepub const GRAYAF16: SampleLayout
pub const GRAYAF16: SampleLayout
Packed f16 grayscale + alpha (4 B/px).
Sourcepub const RGBF32: SampleLayout
pub const RGBF32: SampleLayout
Packed f32 RGB (12 B/px).
Sourcepub const RGBAF32: SampleLayout
pub const RGBAF32: SampleLayout
Packed f32 RGBA (16 B/px).
Sourcepub const GRAYF32: SampleLayout
pub const GRAYF32: SampleLayout
Packed f32 grayscale (4 B/px).
Sourcepub const GRAYAF32: SampleLayout
pub const GRAYAF32: SampleLayout
Packed f32 grayscale + alpha (8 B/px).
Sourcepub const XYZF32: SampleLayout
pub const XYZF32: SampleLayout
Packed f32 CIE XYZ (12 B/px).
Sourcepub const XYZAF32: SampleLayout
pub const XYZAF32: SampleLayout
Packed f32 CIE XYZ + alpha (16 B/px).
Sourcepub const OKLABF32: SampleLayout
pub const OKLABF32: SampleLayout
Packed f32 Oklab (12 B/px).
Sourcepub const OKLABAF32: SampleLayout
pub const OKLABAF32: SampleLayout
Packed f32 Oklab + alpha (16 B/px).
Sourcepub const CMYK8: SampleLayout
pub const CMYK8: SampleLayout
Packed 8-bit CMYK (4 B/px, 0 = no ink).
Sourcepub const CMYK8_INVERTED: SampleLayout
pub const CMYK8_INVERTED: SampleLayout
Packed 8-bit inverted CMYK (4 B/px, 255 = no ink).
Sourcepub const CMYKA8: SampleLayout
pub const CMYKA8: SampleLayout
Packed 8-bit CMYK + alpha (5 B/px, 0 = no ink).
Sourcepub const CMYKA8_INVERTED: SampleLayout
pub const CMYKA8_INVERTED: SampleLayout
Packed 8-bit inverted CMYK + alpha (5 B/px, 255 = no ink).
Sourcepub const CMYK16: SampleLayout
pub const CMYK16: SampleLayout
Packed 16-bit CMYK (8 B/px).
Sourcepub const CMYKF32: SampleLayout
pub const CMYKF32: SampleLayout
Packed f32 CMYK (16 B/px).
Sourcepub const RGB565: SampleLayout
pub const RGB565: SampleLayout
Packed 16-bit RGB565 bitfield word (2 B/px).
Sourcepub const RGB10A2: SampleLayout
pub const RGB10A2: SampleLayout
Packed 32-bit RGB10A2 bitfield word (4 B/px).
Sourcepub const fn sample(self) -> SampleType
pub const fn sample(self) -> SampleType
The sample of this layout.
Sourcepub const fn order(self) -> ChannelOrder
pub const fn order(self) -> ChannelOrder
The order of this layout.
Sourcepub const fn packing(self) -> BitPacking
pub const fn packing(self) -> BitPacking
The packing of this layout.
Sourcepub const fn new(sample: SampleType, order: ChannelOrder) -> SampleLayout
pub const fn new(sample: SampleType, order: ChannelOrder) -> SampleLayout
Sourcepub const fn try_new(
sample: SampleType,
order: ChannelOrder,
) -> Result<SampleLayout, LayoutError>
pub const fn try_new( sample: SampleType, order: ChannelOrder, ) -> Result<SampleLayout, LayoutError>
Construct a full-width layout, checking the declared channel count.
Sourcepub const fn try_with_packing(
self,
packing: BitPacking,
) -> Result<SampleLayout, LayoutError>
pub const fn try_with_packing( self, packing: BitPacking, ) -> Result<SampleLayout, LayoutError>
Attach bit packing compatible with the sample type and channel count.
Sourcepub const fn bytes_per_pixel(self) -> usize
pub const fn bytes_per_pixel(self) -> usize
Bytes occupied by one pixel in memory.
For BitPacking::Bitfields (such as RGB565), all channels fit inside
a single storage word, so this equals self.sample.byte_size().
Sourcepub const fn min_alignment(self) -> usize
pub const fn min_alignment(self) -> usize
Minimum byte alignment required for row starts and slice pointers.
Sourcepub const fn validate(self) -> Result<(), LayoutError>
pub const fn validate(self) -> Result<(), LayoutError>
Validate that channel count and bit packing are well-formed.
Sourcepub const fn aligned_stride(
self,
width: u32,
align: RowAlign,
) -> Result<usize, LayoutError>
pub const fn aligned_stride( self, width: u32, align: RowAlign, ) -> Result<usize, LayoutError>
Compute the row byte stride for width pixels under align.
Trait Implementations§
Source§impl Clone for SampleLayout
impl Clone for SampleLayout
Source§fn clone(&self) -> SampleLayout
fn clone(&self) -> SampleLayout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more