pub enum ColorModel {
BGRA8888,
RGBA8888,
PACKED32,
}
Expand description
List of supported color models.
Note: the color models are endian independent, because the color components are defined by their positon in memory, not by their significance in an uint32_t value.
For effects that work on the color components, RGBA8888 is the recommended color model for frei0r-1.2 effects. For effects that only work on pixels, PACKED32 is the recommended color model since it helps the application to avoid unnecessary color conversions.
Effects can choose an appropriate color model, applications must support all color models and do conversions if necessary. Source effects must not use the PACKED32 color model because the application must know in which color model the created framebuffers are represented.
For each color model, a frame consists of widthheight pixels which are stored row-wise and consecutively in memory. The size of a pixel is 4 bytes. There is no extra pitch parameter (i.e. the pitch is simply width4).
The following additional constraints must be honored: - The top-most line of a frame is stored first in memory. - A frame must be aligned to a 16 byte border in memory. - The width and height of a frame must be positive - The width and height of a frame must be integer multiples of 8
These constraints make sure that each line is stored at an address aligned to 16 byte.
Variants§
BGRA8888
In BGRA8888, each pixel is represented by 4 consecutive unsigned bytes, where the first byte value represents the blue, the second the green, and the third the red color component of the pixel. The last value represents the alpha value.
RGBA8888
In RGBA8888, each pixel is represented by 4 consecutive unsigned bytes, where the first byte value represents the red, the second the green, and the third the blue color component of the pixel. The last value represents the alpha value.
PACKED32
In PACKED32, each pixel is represented by 4 consecutive bytes, but it is not defined how the color componets are stored. The true color format could be RGBA8888, BGRA8888, a packed 32 bit YUV format, or any other color format that stores pixels in 32 bit.
This is useful for effects that don’t work on color but only on pixels (for example a mirror effect).
Note that source effects must not use this color model.
Trait Implementations§
Source§impl Clone for ColorModel
impl Clone for ColorModel
Source§fn clone(&self) -> ColorModel
fn clone(&self) -> ColorModel
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more