ScummVM
Graphics::PixelFormat Struct Reference

A pixel format description. More...

#include <pixelformat.h>

Public Member Functions

 PixelFormat ()
 
 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
 
uint32 ARGBToColor (uint8 a, uint8 r, uint8 g, uint8 b) const
 
void colorToRGB (uint32 color, uint8 &r, uint8 &g, uint8 &b) const
 
void colorToARGB (uint32 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) const
 
byte rBits () const
 
byte gBits () const
 
byte bBits () const
 
byte aBits () const
 
byte bpp () const
 
uint rMax () const
 
uint gMax () const
 
uint bMax () const
 
uint aMax () const
 
Common::String toString () const
 

Static Public Member Functions

static PixelFormat createFormatCLUT8 ()
 
static uint expand (uint bits, uint color)
 Expand a given bit-depth component to a full 8-bit component. More...
 

Public Attributes

byte bytesPerPixel
 Number of bytes used in the pixel format. More...
 
byte rLoss
 
byte gLoss
 
byte bLoss
 
byte aLoss
 Precision loss of each color component. More...
 
byte rShift
 
byte gShift
 
byte bShift
 
byte aShift
 Binary left shift of each color component in the pixel value. More...
 

Detailed Description

A 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 dependend 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 doesn't contain mask values.

Definition at line 136 of file pixelformat.h.

Constructor & Destructor Documentation

◆ PixelFormat() [1/2]

Graphics::PixelFormat::PixelFormat ( )
inline

Definition at line 142 of file pixelformat.h.

◆ PixelFormat() [2/2]

Graphics::PixelFormat::PixelFormat ( byte  BytesPerPixel,
byte  RBits,
byte  GBits,
byte  BBits,
byte  ABits,
byte  RShift,
byte  GShift,
byte  BShift,
byte  AShift 
)
inline

Definition at line 148 of file pixelformat.h.

Member Function Documentation

◆ aBits()

byte Graphics::PixelFormat::aBits ( ) const
inline

Definition at line 228 of file pixelformat.h.

◆ aMax()

uint Graphics::PixelFormat::aMax ( ) const
inline

Definition at line 252 of file pixelformat.h.

◆ ARGBToColor()

uint32 Graphics::PixelFormat::ARGBToColor ( uint8  a,
uint8  r,
uint8  g,
uint8  b 
) const
inline

Definition at line 191 of file pixelformat.h.

◆ bBits()

byte Graphics::PixelFormat::bBits ( ) const
inline

Definition at line 224 of file pixelformat.h.

◆ bMax()

uint Graphics::PixelFormat::bMax ( ) const
inline

Definition at line 248 of file pixelformat.h.

◆ bpp()

byte Graphics::PixelFormat::bpp ( ) const
inline

Definition at line 232 of file pixelformat.h.

◆ colorToARGB()

void Graphics::PixelFormat::colorToARGB ( uint32  color,
uint8 a,
uint8 r,
uint8 g,
uint8 b 
) const
inline

Definition at line 205 of file pixelformat.h.

◆ colorToRGB()

void Graphics::PixelFormat::colorToRGB ( uint32  color,
uint8 r,
uint8 g,
uint8 b 
) const
inline

Definition at line 199 of file pixelformat.h.

◆ createFormatCLUT8()

static PixelFormat Graphics::PixelFormat::createFormatCLUT8 ( )
inlinestatic

Definition at line 162 of file pixelformat.h.

◆ expand()

static uint Graphics::PixelFormat::expand ( uint  bits,
uint  color 
)
inlinestatic

Expand a given bit-depth component to a full 8-bit component.

Definition at line 257 of file pixelformat.h.

◆ gBits()

byte Graphics::PixelFormat::gBits ( ) const
inline

Definition at line 220 of file pixelformat.h.

◆ gMax()

uint Graphics::PixelFormat::gMax ( ) const
inline

Definition at line 244 of file pixelformat.h.

◆ operator!=()

bool Graphics::PixelFormat::operator!= ( const PixelFormat fmt) const
inline

Definition at line 179 of file pixelformat.h.

◆ operator==()

bool Graphics::PixelFormat::operator== ( const PixelFormat fmt) const
inline

Definition at line 166 of file pixelformat.h.

◆ rBits()

byte Graphics::PixelFormat::rBits ( ) const
inline

Definition at line 216 of file pixelformat.h.

◆ RGBToColor()

uint32 Graphics::PixelFormat::RGBToColor ( uint8  r,
uint8  g,
uint8  b 
) const
inline

Definition at line 183 of file pixelformat.h.

◆ rMax()

uint Graphics::PixelFormat::rMax ( ) const
inline

Definition at line 240 of file pixelformat.h.

◆ toString()

Common::String Graphics::PixelFormat::toString ( ) const

Definition at line 28 of file pixelformat.cpp.

Member Data Documentation

◆ aLoss

byte Graphics::PixelFormat::aLoss

Precision loss of each color component.

Definition at line 139 of file pixelformat.h.

◆ aShift

byte Graphics::PixelFormat::aShift

Binary left shift of each color component in the pixel value.

Definition at line 140 of file pixelformat.h.

◆ bLoss

byte Graphics::PixelFormat::bLoss

Definition at line 139 of file pixelformat.h.

◆ bShift

byte Graphics::PixelFormat::bShift

Definition at line 140 of file pixelformat.h.

◆ bytesPerPixel

byte Graphics::PixelFormat::bytesPerPixel

Number of bytes used in the pixel format.

Definition at line 137 of file pixelformat.h.

◆ gLoss

byte Graphics::PixelFormat::gLoss

Definition at line 139 of file pixelformat.h.

◆ gShift

byte Graphics::PixelFormat::gShift

Definition at line 140 of file pixelformat.h.

◆ rLoss

byte Graphics::PixelFormat::rLoss

Definition at line 139 of file pixelformat.h.

◆ rShift

byte Graphics::PixelFormat::rShift

Definition at line 140 of file pixelformat.h.


The documentation for this struct was generated from the following files: