#[repr(i32)]pub enum PixelFormat {
RGB = 0,
BGR = 1,
RGBX = 2,
BGRX = 3,
XBGR = 4,
XRGB = 5,
GRAY = 6,
RGBA = 7,
BGRA = 8,
ABGR = 9,
ARGB = 10,
CMYK = 11,
}
Expand description
Pixel format determines the layout of pixels in memory.
Variants§
RGB = 0
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 = 1
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 = 2
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 = 3
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 = 4
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 = 5
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 = 6
Grayscale pixel format.
Each 1-byte pixel represents a luminance (brightness) level from 0 to 255.
RGBA = 7
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 = 8
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 = 9
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 = 10
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 = 11
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§
Trait Implementations§
Source§impl Clone for PixelFormat
impl Clone for PixelFormat
Source§fn clone(&self) -> PixelFormat
fn clone(&self) -> PixelFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more