#include <pixelformat.h>
Public Member Functions | |
constexpr | PixelFormat () |
constexpr | PixelFormat (byte BytesPerPixel, byte RBits, byte GBits, byte BBits, byte ABits, byte RShift, byte GShift, byte BShift, byte AShift) |
bool | operator== (const PixelFormat &fmt) const |
bool | operator!= (const PixelFormat &fmt) const |
uint32 | RGBToColor (uint8 r, uint8 g, uint8 b) const |
template<class T > | |
uint32 | RGBToColorT (uint8 r, uint8 g, uint8 b) const |
uint32 | ARGBToColor (uint8 a, uint8 r, uint8 g, uint8 b) const |
template<class T > | |
uint32 | ARGBToColorT (uint8 a, uint8 r, uint8 g, uint8 b) const |
void | colorToRGB (uint32 color, uint8 &r, uint8 &g, uint8 &b) const |
template<class T > | |
void | colorToRGBT (uint32 color, uint8 &r, uint8 &g, uint8 &b) const |
void | colorToARGB (uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const |
template<class T > | |
void | colorToARGBT (uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const |
Common::String | toString () const |
bool | isCLUT8 () const |
template<> | |
uint32 | RGBToColorT (uint8 r, uint8 g, uint8 b) const |
template<> | |
uint32 | ARGBToColorT (uint8 a, uint8 r, uint8 g, uint8 b) const |
template<> | |
void | colorToRGBT (uint32 color, uint8 &r, uint8 &g, uint8 &b) const |
template<> | |
void | colorToARGBT (uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const |
Convenience functions for getting the number of color component bits | |
byte | rBits () const |
byte | gBits () const |
byte | bBits () const |
byte | aBits () const |
byte | bpp () const |
Convenience functions for getting color components' maximum values | |
uint | rMax () const |
uint | gMax () const |
uint | bMax () const |
uint | aMax () const |
Static Public Member Functions | |
static PixelFormat | createFormatCLUT8 () |
static uint | expand (uint bits, uint color) |
Public Attributes | |
byte | bytesPerPixel |
byte | rLoss |
byte | gLoss |
byte | bLoss |
byte | aLoss |
byte | rShift |
byte | gShift |
byte | bShift |
byte | aShift |
Pixel format description.
Like ColorMasks, it includes the given values to create colors from RGB values and to retrieve RGB values from colors.
Unlike ColorMasks, it is not dependent on knowing the exact pixel format on compile time.
A minor difference between ColorMasks and PixelFormat is that ColorMasks stores the bit count per channel in kFooBits
, while PixelFormat stores the loss compared to 8 bits per channel in #Loss
. It also does not contain mask values.
|
inline |
Default constructor that creates a null pixel format.
|
inline |
Construct a pixel format based on the provided arguments.
Examples:
|
inlinestatic |
Define a CLUT8 pixel format.
|
inline |
Check if two pixel formats are the same
|
inline |
Check if two pixel formats are different.
|
inline |
Return an RGB color value from red, green, and blue values.
|
inline |
Return an ARGB color value from alpha, red, green, and blue values.
|
inline |
Retrieve red, green, and blue values from an RGB color value.
|
inline |
Retrieve alpha, red, green, and blue values from an ARGB color value.
|
inline |
Return the number of red component bits.
|
inline |
Return the number of green component bits.
|
inline |
Return the number of blue component bits.
|
inline |
Return the number of alpha component bits.
|
inline |
Return the total number of bits for the pixel format.
|
inline |
Return the maximum value of red.
|
inline |
Return the maximum value of green.
|
inline |
Return the maximum value of blue.
|
inline |
Return the maximum value of alpha.
|
inlinestatic |
Expand a given bit-depth component to a full 8-bit component.
Common::String Graphics::PixelFormat::toString | ( | ) | const |
Return string representation.
|
inline |
Shortcut method for checking if the current format is CLUT8 or not
byte Graphics::PixelFormat::bytesPerPixel |
Number of bytes used in the pixel format.
byte Graphics::PixelFormat::aLoss |
Precision loss of each color component.
byte Graphics::PixelFormat::aShift |
Binary left shift of each color component in the pixel value.