Enum ExtendedColorType

enum ExtendedColorType

An enumeration of color types encountered in image formats.

This is not exhaustive over all existing image formats but should be granular enough to allow round tripping of decoding and encoding as much as possible. The variants will be extended as necessary to enable this.

Another purpose is to advise users of a rough estimate of the accuracy and effort of the decoding from and encoding to such an image format.

Variants

A8

Pixel is 8-bit alpha

L1

Pixel is 1-bit luminance

La1

Pixel is 1-bit luminance with an alpha channel

Rgb1

Pixel contains 1-bit R, G and B channels

Rgba1

Pixel is 1-bit RGB with an alpha channel

L2

Pixel is 2-bit luminance

La2

Pixel is 2-bit luminance with an alpha channel

Rgb2

Pixel contains 2-bit R, G and B channels

Rgba2

Pixel is 2-bit RGB with an alpha channel

L4

Pixel is 4-bit luminance

La4

Pixel is 4-bit luminance with an alpha channel

Rgb4

Pixel contains 4-bit R, G and B channels

Rgba4

Pixel is 4-bit RGB with an alpha channel

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 contains 16-bit R, G and B channels

Rgba16

Pixel is 16-bit RGB with an alpha channel

Bgr8

Pixel contains 8-bit B, G and R channels

Bgra8

Pixel is 8-bit BGR with an alpha channel

Rgb32F

Pixel is 32-bit float RGB

Rgba32F

Pixel is 32-bit float RGBA

Cmyk8

Pixel is 8-bit CMYK

Unknown(u8)

Pixel is of unknown color type with the specified bits per pixel. This can apply to pixels which are associated with an external palette. In that case, the pixel value is an index into the palette.

Implementations

impl ExtendedColorType

fn channel_count(self: Self) -> u8

Get the number of channels for colors of this type.

Note that the Unknown variant returns a value of 1 since pixels can only be treated as an opaque datum by the library.

fn bits_per_pixel(self: &Self) -> u16

Returns the number of bits per pixel for this color type.

impl Clone for ExtendedColorType

fn clone(self: &Self) -> ExtendedColorType

impl Copy for ExtendedColorType

impl Debug for ExtendedColorType

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

impl Eq for ExtendedColorType

impl Freeze for ExtendedColorType

impl From for ExtendedColorType

fn from(c: ColorType) -> Self

impl Hash for ExtendedColorType

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

impl PartialEq for ExtendedColorType

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

impl RefUnwindSafe for ExtendedColorType

impl Send for ExtendedColorType

impl StructuralPartialEq for ExtendedColorType

impl Sync for ExtendedColorType

impl Unpin for ExtendedColorType

impl UnsafeUnpin for ExtendedColorType

impl UnwindSafe for ExtendedColorType

impl<T> Any for ExtendedColorType

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for ExtendedColorType

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for ExtendedColorType

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

impl<T> CloneToUninit for ExtendedColorType

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

impl<T> From for ExtendedColorType

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for ExtendedColorType

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> ToOwned for ExtendedColorType

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for ExtendedColorType

fn into(self: 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 for ExtendedColorType

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for ExtendedColorType

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