#[non_exhaustive]pub enum PixelFormat {
Gray8,
Gray16,
GrayA8,
Rgb8,
Rgba8,
Rgb16,
Rgba16,
RgbF32,
RgbaF32,
}Expand description
An interleaved pixel format: a ChannelLayout over a SampleKind.
The v1 set is exactly the formats listed in SPEC §Pixel formats. Samples
are interleaved (RGBRGB…, not planar) and, for U16, stored in native
endianness in memory — codecs convert at their own boundary.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Gray8
8-bit grayscale.
Gray16
16-bit grayscale.
GrayA8
8-bit grayscale with alpha.
Rgb8
8-bit RGB.
Rgba8
8-bit RGBA.
Rgb16
16-bit RGB.
Rgba16
16-bit RGBA.
RgbF32
32-bit float RGB.
RgbaF32
32-bit float RGBA.
Implementations§
Source§impl PixelFormat
impl PixelFormat
Sourcepub const ALL: &'static [PixelFormat]
pub const ALL: &'static [PixelFormat]
Every pixel format supported in v1.
Sourcepub const fn layout(self) -> ChannelLayout
pub const fn layout(self) -> ChannelLayout
The channel layout of this format.
Sourcepub const fn from_parts(
layout: ChannelLayout,
kind: SampleKind,
) -> Option<PixelFormat>
pub const fn from_parts( layout: ChannelLayout, kind: SampleKind, ) -> Option<PixelFormat>
The format with layout channels of kind samples, if v1 has one
(there is no grey float, nor 16-bit grey with alpha).
Sourcepub const fn sample_kind(self) -> SampleKind
pub const fn sample_kind(self) -> SampleKind
The sample type of this format.
Sourcepub const fn bytes_per_pixel(self) -> usize
pub const fn bytes_per_pixel(self) -> usize
Size of one pixel in bytes.
This is exact: v1 formats are byte-aligned and interleaved, so there is no sub-byte packing to account for.
Trait Implementations§
Source§impl Clone for PixelFormat
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more