Enum ColorType

#[repr(u8)]
pub enum ColorType

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

impl ColorType

fn samples(self) -> usize

Returns the number of samples used per pixel encoded in this way.

fn from_u8(n: u8) -> Option<ColorType>

u8 -> Self. Temporary solution until Rust provides a canonical one.

Trait Implementations

impl Clone for ColorType

fn clone(&self) -> Self

impl Copy for ColorType

impl Debug for ColorType

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Eq for ColorType

impl PartialEq for ColorType

fn eq(&self, other: &Self) -> bool

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 UnsafeUnpin for ColorType

impl UnwindSafe for ColorType

Blanket Implementations

impl<T> Any for ColorType where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for ColorType where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for ColorType where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for ColorType where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for ColorType

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for ColorType where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for ColorType where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for ColorType where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for ColorType where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>