Enum ColorType

#[non_exhaustive]
pub enum ColorType

An enumeration over supported color types and bit depths

Variants

L8

Pixel is 8-bit luminance

La8

Pixel is 8-bit luminance with an alpha channel

Rgb8

Pixel contains 8-bit R, G and B channels

Rgba8

Pixel is 8-bit RGB with an alpha channel

L16

Pixel is 16-bit luminance

La16

Pixel is 16-bit luminance with an alpha channel

Rgb16

Pixel is 16-bit RGB

Rgba16

Pixel is 16-bit RGBA

Rgb32F

Pixel is 32-bit float RGB

Rgba32F

Pixel is 32-bit float RGBA

Implementations

impl ColorType

fn bytes_per_pixel(self) -> u8

Returns the number of bytes contained in a pixel of ColorType c

fn has_alpha(self) -> bool

Returns if there is an alpha channel.

fn has_color(self) -> bool

Returns false if the color scheme is grayscale, true otherwise.

fn bits_per_pixel(self) -> u16

Returns the number of bits contained in a pixel of ColorType c (which will always be a multiple of 8).

fn channel_count(self) -> u8

Returns the number of color channels that make up this pixel

Trait Implementations

impl Clone for ColorType

fn clone(&self) -> ColorType

impl Copy for ColorType

impl Debug for ColorType

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

impl Eq for ColorType

impl Hash for ColorType

fn hash<__H: Hasher>(&self, state: &mut __H)

impl PartialEq for ColorType

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

impl StructuralPartialEq for ColorType

impl TryFrom<ExtendedColorType> for ColorType

type Error = TryFromExtendedColorError;
fn try_from(value: ExtendedColorType) -> Result<ColorType, Self::Error>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for ColorType where ST: ?Sized, DT: ?Sized,

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for ColorType where ST: ?Sized, DT: ?Sized,

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

impl<T> Pointable for ColorType

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T> Read<Exclusive, BecauseExclusive> for ColorType where T: ?Sized,

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>