#[repr(u8)]pub enum ColorType {
Grayscale = 0,
Rgb = 2,
Indexed = 3,
GrayscaleAlpha = 4,
Rgba = 6,
}
Expand description
Describes how a pixel is encoded.
Variants§
Grayscale = 0
1 grayscale sample.
Rgb = 2
1 red sample, 1 green sample, 1 blue sample.
Indexed = 3
1 sample for the palette index.
GrayscaleAlpha = 4
1 grayscale sample, then 1 alpha sample.
Rgba = 6
1 red sample, 1 green sample, 1 blue sample, and finally, 1 alpha sample.
Implementations§
source§impl ColorType
impl ColorType
sourcepub fn samples(self) -> usize
pub fn samples(self) -> usize
Returns the number of samples used per pixel encoded in this way.
pub(crate) fn samples_u8(self) -> u8
sourcepub fn from_u8(n: u8) -> Option<ColorType>
pub fn from_u8(n: u8) -> Option<ColorType>
u8 -> Self. Temporary solution until Rust provides a canonical one.
pub(crate) fn checked_raw_row_length( self, depth: BitDepth, width: u32, ) -> Option<usize>
pub(crate) fn raw_row_length_from_width( self, depth: BitDepth, width: u32, ) -> usize
pub(crate) fn is_combination_invalid(self, bit_depth: BitDepth) -> bool
Trait Implementations§
impl Copy for ColorType
impl Eq for ColorType
impl StructuralPartialEq for ColorType
Auto Trait Implementations§
impl Freeze for ColorType
impl RefUnwindSafe for ColorType
impl Send for ColorType
impl Sync for ColorType
impl Unpin for ColorType
impl UnwindSafe for ColorType
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)