#[non_exhaustive]#[repr(u32)]pub enum PixelFormat {
Gray8 = 0,
Bilevel = 1,
Indexed8 = 2,
Rgb8 = 3,
Rgba8 = 4,
Cmyk8 = 5,
GrayAlpha8 = 6,
Gray16 = 7,
Rgb16 = 8,
Rgba16 = 9,
GrayAlpha16 = 10,
}Expand description
Runtime tag for the closed set of Pixel marker types — one variant per marker.
The FFI/dispatch mirror of the compile-time Pixel matrix (issue #242): where the type
system selects a codec impl through the marker type, a boundary that only has runtime
information (a C caller, a plugin registry) selects the same layout by tag and dispatches to
the monomorphized impl. PixelFormat::ALL enumerates the matrix for tooling that generates
such dispatch.
Discriminants are explicit and permanent — they are C ABI values; new variants append.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Gray8 = 0
Tag for Gray8.
Bilevel = 1
Tag for Bilevel.
Indexed8 = 2
Tag for Indexed8.
Rgb8 = 3
Tag for Rgb8.
Rgba8 = 4
Tag for Rgba8.
Cmyk8 = 5
Tag for Cmyk8.
GrayAlpha8 = 6
Tag for GrayAlpha8.
Gray16 = 7
Tag for Gray16.
Rgb16 = 8
Tag for Rgb16.
Rgba16 = 9
Tag for Rgba16.
GrayAlpha16 = 10
Tag for GrayAlpha16.
Implementations§
Source§impl PixelFormat
impl PixelFormat
Sourcepub const ALL: [PixelFormat; 11]
pub const ALL: [PixelFormat; 11]
Every pixel format, in discriminant order — the full codec × layout monomorphization
matrix for tooling that enumerates it (each entry is some marker’s Pixel::FORMAT).
Sourcepub const fn channels(self) -> usize
pub const fn channels(self) -> usize
Samples per pixel; the runtime mirror of Pixel::CHANNELS.
Sourcepub const fn color_model(self) -> ColorModel
pub const fn color_model(self) -> ColorModel
The colour interpretation of the samples; the runtime mirror of Pixel::MODEL.
Sourcepub const fn bytes_per_sample(self) -> usize
pub const fn bytes_per_sample(self) -> usize
Bytes per sample of the storage primitive (1 for u8 layouts, 2 for u16); the
runtime mirror of size_of::<Pixel::Sample>().
Sourcepub const fn bytes_per_pixel(self) -> usize
pub const fn bytes_per_pixel(self) -> usize
Bytes one pixel occupies in an interleaved buffer; the runtime mirror of
Pixel::BYTES_PER_PIXEL.