#[non_exhaustive]pub enum PixelLayout {
Show 13 variants
Rgb8Srgb,
Bgr8Srgb,
Rgbx8Srgb,
Bgrx8Srgb,
Gray8Srgb,
Rgb16Linear,
Rgbx16Linear,
Gray16Linear,
RgbF32Linear,
RgbxF32Linear,
GrayF32Linear,
YCbCr8,
YCbCrF32,
}Expand description
Pixel data layout for raw byte input.
Describes channel order, bit depth, and color space interpretation.
Use with encode_from_bytes() when working with raw buffers.
For rgb crate types, use encode_from_rgb() which infers layout.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rgb8Srgb
RGB, 3 bytes/pixel, sRGB gamma
Bgr8Srgb
BGR, 3 bytes/pixel, sRGB gamma (Windows/GDI order)
Rgbx8Srgb
RGBX, 4 bytes/pixel, sRGB gamma (4th byte ignored)
Bgrx8Srgb
BGRX, 4 bytes/pixel, sRGB gamma (4th byte ignored)
Gray8Srgb
Grayscale, 1 byte/pixel, sRGB gamma
Rgb16Linear
RGB, 6 bytes/pixel, linear light (0-65535)
Rgbx16Linear
RGBX, 8 bytes/pixel, linear light (4th channel ignored)
Gray16Linear
Grayscale, 2 bytes/pixel, linear light
RgbF32Linear
RGB, 12 bytes/pixel, linear light (0.0-1.0)
RgbxF32Linear
RGBX, 16 bytes/pixel, linear light (4th channel ignored)
GrayF32Linear
Grayscale, 4 bytes/pixel, linear light
YCbCr8
YCbCr interleaved, 3 bytes/pixel, u8
YCbCrF32
YCbCr interleaved, 12 bytes/pixel, f32
Implementations§
Source§impl PixelLayout
impl PixelLayout
Sourcepub const fn bytes_per_pixel(&self) -> usize
pub const fn bytes_per_pixel(&self) -> usize
Bytes per pixel for this layout.
Sourcepub const fn is_grayscale(&self) -> bool
pub const fn is_grayscale(&self) -> bool
Whether this is a grayscale format.
Trait Implementations§
Source§impl Clone for PixelLayout
impl Clone for PixelLayout
Source§fn clone(&self) -> PixelLayout
fn clone(&self) -> PixelLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more