#[non_exhaustive]#[repr(u32)]pub enum ColorModel {
Gray = 0,
GrayAlpha = 1,
Rgb = 2,
Rgba = 3,
Cmyk = 4,
Bilevel = 5,
Indexed = 6,
}Expand description
The colour interpretation of a pixel’s channels.
Distinguishes layouts that share a channel count: ColorModel::Rgba and ColorModel::Cmyk
are both four channels but must never be interchanged, and ColorModel::Gray,
ColorModel::Bilevel, and ColorModel::Indexed are all one channel with different meanings.
Discriminants are explicit and permanent — they are C ABI values (issue #242); new variants append.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Gray = 0
Single luminance channel.
GrayAlpha = 1
Luminance plus an alpha channel.
Rgb = 2
Red, green, blue.
Rgba = 3
Red, green, blue, alpha (unassociated).
Cmyk = 4
Cyan, magenta, yellow, black ink separations.
Bilevel = 5
One channel, 0 = black and any non-zero value = white (a 1-bit image carried as one byte
per pixel).
Indexed = 6
One channel of indices into a separate colour palette.
Trait Implementations§
Source§impl Clone for ColorModel
impl Clone for ColorModel
impl Copy for ColorModel
Source§impl Debug for ColorModel
impl Debug for ColorModel
impl Eq for ColorModel
Source§impl Hash for ColorModel
impl Hash for ColorModel
Source§impl PartialEq for ColorModel
impl PartialEq for ColorModel
impl StructuralPartialEq for ColorModel
Auto Trait Implementations§
impl Freeze for ColorModel
impl RefUnwindSafe for ColorModel
impl Send for ColorModel
impl Sync for ColorModel
impl Unpin for ColorModel
impl UnsafeUnpin for ColorModel
impl UnwindSafe for ColorModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more