Skip to main content

PixelFormat

Struct PixelFormat 

Source
#[repr(transparent)]
pub struct PixelFormat(pub u32);
Expand description

Format of pixel is defined by one u32, using bit fields as follows

                          2                1          0
                   4 3 2 10987 6 5 4 3 2 1 098 7654 321
                   M A O TTTTT U Y F P X S EEE CCCC BBB

       M: Premultiplied alpha (only works when extra samples is 1)
       A: Floating point -- With this flag we can differentiate 16 bits as float and as int
       O: Optimized -- previous optimization already returns the final 8-bit value
       T: Pixeltype
       F: Flavor  0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)
       P: Planar? 0=Chunky, 1=Planar
       X: swap 16 bps endianness?
       S: Do swap? ie, BGR, KYMC
       E: Extra samples
       C: Channels (Samples per pixel)
       B: bytes per sample
       Y: Swap first - changes ABGR to BGRA and KCMY to CMYK

Tuple Fields§

§0: u32

Implementations§

Source§

impl PixelFormat

Source

pub const GRAY_8: PixelFormat

Source

pub const GRAY_8_REV: PixelFormat

Source

pub const GRAY_16: PixelFormat

Source

pub const GRAY_16_REV: PixelFormat

Source

pub const GRAY_16_SE: PixelFormat

Source

pub const GRAYA_8: PixelFormat

Source

pub const GRAYA_16: PixelFormat

Source

pub const GRAYA_16_SE: PixelFormat

Source

pub const GRAYA_8_PLANAR: PixelFormat

Source

pub const GRAYA_16_PLANAR: PixelFormat

Source

pub const RGB_8: PixelFormat

Source

pub const RGB_8_PLANAR: PixelFormat

Source

pub const BGR_8: PixelFormat

Source

pub const BGR_8_PLANAR: PixelFormat

Source

pub const RGB_16: PixelFormat

Source

pub const RGB_16_PLANAR: PixelFormat

Source

pub const RGB_16_SE: PixelFormat

Source

pub const BGR_16: PixelFormat

Source

pub const BGR_16_PLANAR: PixelFormat

Source

pub const BGR_16_SE: PixelFormat

Source

pub const RGBA_8: PixelFormat

Source

pub const RGBA_8_PLANAR: PixelFormat

Source

pub const RGBA_16: PixelFormat

Source

pub const RGBA_16_PLANAR: PixelFormat

Source

pub const RGBA_16_SE: PixelFormat

Source

pub const ARGB_8: PixelFormat

Source

pub const ARGB_8_PLANAR: PixelFormat

Source

pub const ARGB_16: PixelFormat

Source

pub const ABGR_8: PixelFormat

Source

pub const ABGR_8_PLANAR: PixelFormat

Source

pub const ABGR_16: PixelFormat

Source

pub const ABGR_16_PLANAR: PixelFormat

Source

pub const ABGR_16_SE: PixelFormat

Source

pub const BGRA_8: PixelFormat

Source

pub const BGRA_8_PLANAR: PixelFormat

Source

pub const BGRA_16: PixelFormat

Source

pub const BGRA_16_SE: PixelFormat

Source

pub const CMY_8: PixelFormat

Source

pub const CMY_8_PLANAR: PixelFormat

Source

pub const CMY_16: PixelFormat

Source

pub const CMY_16_PLANAR: PixelFormat

Source

pub const CMY_16_SE: PixelFormat

Source

pub const CMYK_8: PixelFormat

Source

pub const CMYKA_8: PixelFormat

Source

pub const CMYK_8_REV: PixelFormat

Source

pub const CMYK_8_PLANAR: PixelFormat

Source

pub const CMYK_16: PixelFormat

Source

pub const CMYK_16_REV: PixelFormat

Source

pub const CMYK_16_PLANAR: PixelFormat

Source

pub const CMYK_16_SE: PixelFormat

Source

pub const KYMC_8: PixelFormat

Source

pub const KYMC_16: PixelFormat

Source

pub const KYMC_16_SE: PixelFormat

Source

pub const KCMY_8: PixelFormat

Source

pub const KCMY_8_REV: PixelFormat

Source

pub const KCMY_16: PixelFormat

Source

pub const KCMY_16_REV: PixelFormat

Source

pub const KCMY_16_SE: PixelFormat

Source

pub const CMYK5_8: PixelFormat

Source

pub const CMYK5_16: PixelFormat

Source

pub const CMYK5_16_SE: PixelFormat

Source

pub const KYMC5_8: PixelFormat

Source

pub const KYMC5_16: PixelFormat

Source

pub const KYMC5_16_SE: PixelFormat

Source

pub const CMYK6_8: PixelFormat

Source

pub const CMYK6_8_PLANAR: PixelFormat

Source

pub const CMYK6_16: PixelFormat

Source

pub const CMYK6_16_PLANAR: PixelFormat

Source

pub const CMYK6_16_SE: PixelFormat

Source

pub const CMYK7_8: PixelFormat

Source

pub const CMYK7_16: PixelFormat

Source

pub const CMYK7_16_SE: PixelFormat

Source

pub const KYMC7_8: PixelFormat

Source

pub const KYMC7_16: PixelFormat

Source

pub const KYMC7_16_SE: PixelFormat

Source

pub const CMYK8_8: PixelFormat

Source

pub const CMYK8_16: PixelFormat

Source

pub const CMYK8_16_SE: PixelFormat

Source

pub const KYMC8_8: PixelFormat

Source

pub const KYMC8_16: PixelFormat

Source

pub const KYMC8_16_SE: PixelFormat

Source

pub const CMYK9_8: PixelFormat

Source

pub const CMYK9_16: PixelFormat

Source

pub const CMYK9_16_SE: PixelFormat

Source

pub const KYMC9_8: PixelFormat

Source

pub const KYMC9_16: PixelFormat

Source

pub const KYMC9_16_SE: PixelFormat

Source

pub const CMYK10_8: PixelFormat

Source

pub const CMYK10_16: PixelFormat

Source

pub const CMYK10_16_SE: PixelFormat

Source

pub const KYMC10_8: PixelFormat

Source

pub const KYMC10_16: PixelFormat

Source

pub const KYMC10_16_SE: PixelFormat

Source

pub const CMYK11_8: PixelFormat

Source

pub const CMYK11_16: PixelFormat

Source

pub const CMYK11_16_SE: PixelFormat

Source

pub const KYMC11_8: PixelFormat

Source

pub const KYMC11_16: PixelFormat

Source

pub const KYMC11_16_SE: PixelFormat

Source

pub const CMYK12_8: PixelFormat

Source

pub const CMYK12_16: PixelFormat

Source

pub const CMYK12_16_SE: PixelFormat

Source

pub const KYMC12_8: PixelFormat

Source

pub const KYMC12_16: PixelFormat

Source

pub const KYMC12_16_SE: PixelFormat

Source

pub const XYZ_16: PixelFormat

Source

pub const Lab_8: PixelFormat

Source

pub const LabV2_8: PixelFormat

Source

pub const ALab_8: PixelFormat

Source

pub const ALabV2_8: PixelFormat

Source

pub const Lab_16: PixelFormat

Source

pub const LabV2_16: PixelFormat

Source

pub const Yxy_16: PixelFormat

Source

pub const YCbCr_8: PixelFormat

Source

pub const YCbCr_8_PLANAR: PixelFormat

Source

pub const YCbCr_16: PixelFormat

Source

pub const YCbCr_16_PLANAR: PixelFormat

Source

pub const YCbCr_16_SE: PixelFormat

Source

pub const YUV_8: PixelFormat

Source

pub const YUV_8_PLANAR: PixelFormat

Source

pub const YUV_16: PixelFormat

Source

pub const YUV_16_PLANAR: PixelFormat

Source

pub const YUV_16_SE: PixelFormat

Source

pub const HLS_8: PixelFormat

Source

pub const HLS_8_PLANAR: PixelFormat

Source

pub const HLS_16: PixelFormat

Source

pub const HLS_16_PLANAR: PixelFormat

Source

pub const HLS_16_SE: PixelFormat

Source

pub const HSV_8: PixelFormat

Source

pub const HSV_8_PLANAR: PixelFormat

Source

pub const HSV_16: PixelFormat

Source

pub const HSV_16_PLANAR: PixelFormat

Source

pub const HSV_16_SE: PixelFormat

Source

pub const NAMED_COLOR_INDEX: PixelFormat

Source

pub const XYZ_FLT: PixelFormat

Source

pub const Lab_FLT: PixelFormat

Source

pub const LabA_FLT: PixelFormat

Source

pub const GRAY_FLT: PixelFormat

Source

pub const RGB_FLT: PixelFormat

Source

pub const RGBA_FLT: PixelFormat

Source

pub const ARGB_FLT: PixelFormat

Source

pub const BGR_FLT: PixelFormat

Source

pub const BGRA_FLT: PixelFormat

Source

pub const CMYK_FLT: PixelFormat

Source

pub const XYZ_DBL: PixelFormat

Source

pub const Lab_DBL: PixelFormat

Source

pub const GRAY_DBL: PixelFormat

Source

pub const RGB_DBL: PixelFormat

Source

pub const BGR_DBL: PixelFormat

Source

pub const CMYK_DBL: PixelFormat

Source

pub const GRAY_HALF_FLT: PixelFormat

Source

pub const RGB_HALF_FLT: PixelFormat

Source

pub const RGBA_HALF_FLT: PixelFormat

Source

pub const CMYK_HALF_FLT: PixelFormat

Source

pub const ARGB_HALF_FLT: PixelFormat

Source

pub const BGR_HALF_FLT: PixelFormat

Source

pub const BGRA_HALF_FLT: PixelFormat

Source

pub fn premultiplied(&self) -> bool

M: Premultiplied alpha (only works when extra samples is 1)

Source

pub fn float(&self) -> bool

A: Floating point – With this flag we can differentiate 16 bits as float and as int

Source

pub fn optimized(&self) -> bool

O: Optimized – previous optimization already returns the final 8-bit value

Source

pub fn pixel_type(&self) -> PixelType

T: Color space (PT_*)

Source

pub fn swapfirst(&self) -> bool

Y: Swap first - changes ABGR to BGRA and KCMY to CMYK

Source

pub fn min_is_white(&self) -> bool

F: Flavor 0=MinIsBlack(Chocolate) 1=MinIsWhite(Vanilla)

Source

pub fn planar(&self) -> bool

P: Planar? 0=Chunky, 1=Planar

Source

pub fn endian16(&self) -> bool

X: swap 16 bps endianness?

Source

pub fn doswap(&self) -> bool

S: Do swap? ie, BGR, KYMC

Source

pub fn extra(&self) -> usize

E: Extra samples

Source

pub fn channels(&self) -> usize

C: Channels (Samples per pixel)

Source

pub fn bytes_per_channel(&self) -> usize

B: bytes per sample

Source

pub fn bytes_per_pixel(&self) -> usize

size of pixel

Trait Implementations§

Source§

impl Clone for PixelFormat

Source§

fn clone(&self) -> PixelFormat

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PixelFormat

Source§

impl Debug for PixelFormat

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for PixelFormat

Source§

impl PartialEq for PixelFormat

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PixelFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.