Enum turbojpeg::PixelFormat[][src]

#[repr(i32)]
pub enum PixelFormat {
    RGB,
    BGR,
    RGBX,
    BGRX,
    XBGR,
    XRGB,
    GRAY,
    RGBA,
    BGRA,
    ABGR,
    ARGB,
    CMYK,
}

Pixel format determines the layout of pixels in memory.

Variants

RGB

RGB pixel format.

The red, green, and blue components in the image are stored in 3-byte pixels in the order R, G, B from lowest to highest byte address within each pixel.

BGR

BGR pixel format.

The red, green, and blue components in the image are stored in 3-byte pixels in the order B, G, R from lowest to highest byte address within each pixel.

RGBX

RGBX pixel format.

The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.

BGRX

BGRX pixel format.

The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.

XBGR

XBGR pixel format.

The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.

XRGB

XRGB pixel format.

The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. The X component is ignored when compressing and undefined when decompressing.

GRAY

Grayscale pixel format.

Each 1-byte pixel represents a luminance (brightness) level from 0 to 255.

RGBA

RGBA pixel format.

This is the same as PixelFormat::RGBX, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.

BGRA

BGRA pixel format.

This is the same as PixelFormat::BGRX, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.

ABGR

ABGR pixel format.

This is the same as PixelFormat::XBGR, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.

ARGB

ARGB pixel format.

This is the same as PixelFormat::ARGB, except that when decompressing, the X component is guaranteed to be 0xFF, which can be interpreted as an opaque alpha channel.

CMYK

CMYK pixel format.

Unlike RGB, which is an additive color model used primarily for display, CMYK (Cyan/Magenta/Yellow/Key) is a subtractive color model used primarily for printing. In the CMYK color model, the value of each color component typically corresponds to an amount of cyan, magenta, yellow, or black ink that is applied to a white background. In order to convert between CMYK and RGB, it is necessary to use a color management system (CMS). A CMS will attempt to map colors within the printer’s gamut to perceptually similar colors in the display’s gamut and vice versa, but the mapping is typically not 1:1 or reversible, nor can it be defined with a simple formula. Thus, such a conversion is out of scope for a codec library. However, the TurboJPEG API allows for compressing CMYK pixels into a YCCK JPEG image (see TJCS_YCCK) and decompressing YCCK JPEG images into CMYK pixels.

Implementations

impl PixelFormat[src]

pub fn size(&self) -> usize[src]

The size of a pixel in bytes.

pub fn from_i32(format: i32) -> Result<PixelFormat>[src]

Trait Implementations

impl Clone for PixelFormat[src]

impl Copy for PixelFormat[src]

impl Debug for PixelFormat[src]

impl Eq for PixelFormat[src]

impl Hash for PixelFormat[src]

impl Ord for PixelFormat[src]

impl PartialEq<PixelFormat> for PixelFormat[src]

impl PartialOrd<PixelFormat> for PixelFormat[src]

impl StructuralEq for PixelFormat[src]

impl StructuralPartialEq for PixelFormat[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.