ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Kyra::Palette Class Reference

#include <screen.h>

Public Types

enum  { kVGABytesPerColor = 3, kPC98BytesPerColor = 3, kAmigaBytesPerColor = 2 }
 
enum  CGAIntensity { kIntensityLow = 0, kIntensityHigh = 1 }
 

Public Member Functions

 Palette (const int numColors)
 
void loadVGAPalette (Common::ReadStream &stream, int startIndex, int colors)
 
void loadHiColorPalette (Common::ReadStream &stream, int startIndex, int colors)
 
void loadEGAPalette (Common::ReadStream &stream, int startIndex, int colors)
 
void setCGAPalette (int palIndex, CGAIntensity intensity)
 
void loadAmigaPalette (Common::ReadStream &stream, int startIndex, int colors)
 
void loadPC98Palette (Common::ReadStream &stream, int startIndex, int colors)
 
int getNumColors () const
 
void clear ()
 
void fill (int firstCol, int numCols, uint8 value)
 
void copy (const Palette &source, int firstCol=0, int numCols=-1, int dstStart=-1)
 
void copy (const uint8 *source, int firstCol, int numCols, int dstStart=-1)
 
uint8 * fetchRealPalette () const
 
uint8 & operator[] (const int index)
 
const uint8 & operator[] (const int index) const
 
uint8 * getData ()
 
const uint8 * getData () const
 

Detailed Description

A class that manages KYRA palettes.

This class stores the palette data as VGA RGB internally.

Member Enumeration Documentation

◆ CGAIntensity

Set default CGA palette. We only need the cyan/magenta/grey mode.

Member Function Documentation

◆ loadVGAPalette()

void Kyra::Palette::loadVGAPalette ( Common::ReadStream stream,
int  startIndex,
int  colors 
)

Load a VGA palette from the given stream.

◆ loadHiColorPalette()

void Kyra::Palette::loadHiColorPalette ( Common::ReadStream stream,
int  startIndex,
int  colors 
)

Load a HiColor palette from the given stream.

◆ loadEGAPalette()

void Kyra::Palette::loadEGAPalette ( Common::ReadStream stream,
int  startIndex,
int  colors 
)

Load a EGA palette from the given stream.

◆ loadAmigaPalette()

void Kyra::Palette::loadAmigaPalette ( Common::ReadStream stream,
int  startIndex,
int  colors 
)

Load a AMIGA palette from the given stream.

◆ loadPC98Palette()

void Kyra::Palette::loadPC98Palette ( Common::ReadStream stream,
int  startIndex,
int  colors 
)

Load a PC98 16 color palette from the given stream.

◆ getNumColors()

int Kyra::Palette::getNumColors ( ) const
inline

Return the number of colors this palette manages.

◆ clear()

void Kyra::Palette::clear ( )

Set all palette colors to black.

◆ fill()

void Kyra::Palette::fill ( int  firstCol,
int  numCols,
uint8  value 
)

Fill the given indexes with the given component value.

Parameters
firstColthe first color, which should be overwritten.
numColsnumber of colors, which schould be overwritten.
valuecolor component value, which should be stored.

◆ copy() [1/2]

void Kyra::Palette::copy ( const Palette source,
int  firstCol = 0,
int  numCols = -1,
int  dstStart = -1 
)

Copy data from another palette.

Parameters
sourcepalette to copy data from.
firstColthe first color of the source which should be copied.
numColsnumber of colors, which should be copied. -1 all remaining colors.
dstStartthe first color, which should be ovewritten. If -1 firstCol will be used as start.

◆ copy() [2/2]

void Kyra::Palette::copy ( const uint8 *  source,
int  firstCol,
int  numCols,
int  dstStart = -1 
)

Copy data from a raw VGA palette.

Parameters
sourcesource buffer
firstColthe first color of the source which should be copied.
numColsnumber of colors, which should be copied.
dstStartthe first color, which should be ovewritten. If -1 firstCol will be used as start.

◆ fetchRealPalette()

uint8* Kyra::Palette::fetchRealPalette ( ) const

Fetch a RGB palette.

Returns
a pointer to the RGB palette data, the client must delete[] it.

◆ getData()

uint8* Kyra::Palette::getData ( )
inline

Gets raw access to the palette.

TODO: Get rid of this.


The documentation for this class was generated from the following file: