#include <pal.h>
Classes | |
| struct | Color |
Public Member Functions | |
| Palette (const Graphics::PixelFormat &format=Graphics::PixelFormat(), const uint numColors=0) | |
| Palette (const Palette &other) | |
| Palette & | operator= (const Palette &other) |
| Palette & | clear () |
| Palette & | load (const byte *buf, const uint size, const Graphics::PixelFormat &format, const uint numColors, const EndianType endian) |
| byte * | save (byte *buf, const uint size, const EndianType endian) const |
| byte * | save (byte *buf, const uint size, const Graphics::PixelFormat &format, const EndianType endian) const |
| byte * | save (byte *buf, const uint size, const Graphics::PixelFormat &format, const uint numColors, const EndianType endian, const byte firstIndex=0) const |
| Palette & | rotateRight (byte firstIndex, byte lastIndex) |
| Palette & | rotateLeft (byte firstIndex, byte lastIndex) |
| Palette & | saturatedAddColor (Palette &output, byte firstIndex, byte lastIndex, signed r, signed g, signed b) const |
| Palette & | saturatedAddColor (Palette &output, byte firstIndex, byte lastIndex, signed rSource, signed gSource, signed bSource, const Graphics::PixelFormat &sourceFormat) const |
| Palette & | saturatedAddNormalizedGray (Palette &output, byte firstIndex, byte lastIndex, signed grayDividend, signed grayDenominator) const |
| bool | empty () const |
| uint | colorCount () const |
| Palette & | fillWithBlack () |
| bool | isValid () const |
| const Graphics::PixelFormat & | colorFormat () const |
| void | setGlobalOSystemPalette () const |
| Color | getColor (byte index) const |
| uint8 | getR (byte index) const |
| uint8 | getG (byte index) const |
| uint8 | getB (byte index) const |
| bool | ensureContrast (byte &minBrightnessColorIndex) |
| bool | isEqual (byte index1, byte index2) |
A class for handling Cine-engine's palettes. TODO: Test a bit more
| Cine::Palette::Palette | ( | const Graphics::PixelFormat & | format = Graphics::PixelFormat(), |
| const uint | numColors = 0 |
||
| ) |
Create an initially black palette with the given color format and number of colors.
| format | Color format |
| numColors | Number of colors |
| Palette& Cine::Palette::clear | ( | ) |
Clear the palette (Set color count to zero, release memory, overwrite color format with default value).
| Palette& Cine::Palette::load | ( | const byte * | buf, |
| const uint | size, | ||
| const Graphics::PixelFormat & | format, | ||
| const uint | numColors, | ||
| const EndianType | endian | ||
| ) |
Load palette from buffer with given color format, endianness and number of colors.
| buf | Input buffer |
| size | Input buffer size in bytes |
| format | Input color format |
| numColors | Number of colors to load |
| endian | The endianness of the colors in the input buffer |
| byte* Cine::Palette::save | ( | byte * | buf, |
| const uint | size, | ||
| const EndianType | endian | ||
| ) | const |
Save the whole palette to buffer in original color format using defined endianness.
| buf | Output buffer |
| size | Output buffer size in bytes |
| endian | The endian type to use |
| byte* Cine::Palette::save | ( | byte * | buf, |
| const uint | size, | ||
| const Graphics::PixelFormat & | format, | ||
| const EndianType | endian | ||
| ) | const |
Save the whole palette to buffer in given color format using defined endianness.
| buf | Output buffer |
| size | Output buffer size in bytes |
| format | Output color format |
| endian | The endian type to use |
| byte* Cine::Palette::save | ( | byte * | buf, |
| const uint | size, | ||
| const Graphics::PixelFormat & | format, | ||
| const uint | numColors, | ||
| const EndianType | endian, | ||
| const byte | firstIndex = 0 |
||
| ) | const |
Save (partial) palette to buffer in given color format using defined endianness.
| buf | Output buffer |
| size | Output buffer size in bytes |
| format | Output color format |
| numColors | Number of colors to save |
| endian | The endian type to use |
| firstIndex | Starting color index (from which onwards to save the colors) |
| Palette& Cine::Palette::rotateRight | ( | byte | firstIndex, |
| byte | lastIndex | ||
| ) |
Rotate the palette in color range [firstIndex, lastIndex] to the right by one.
| Palette& Cine::Palette::saturatedAddColor | ( | Palette & | output, |
| byte | firstIndex, | ||
| byte | lastIndex, | ||
| signed | rSource, | ||
| signed | gSource, | ||
| signed | bSource, | ||
| const Graphics::PixelFormat & | sourceFormat | ||
| ) | const |
Saturated add an RGB color in given color format to current palette's subset and save the modified colors in the given output palette.
| output | The output palette (Only this palette is modified) |
| firstIndex | First color index of the palette's subset (Inclusive range) |
| lastIndex | Last color index of the palette's subset (Inclusive range) |
| rSource | The red color component in the source color format |
| gSource | The green color component in the source color format |
| bSource | The blue color component in the source color format |
| sourceFormat | The source color format (i.e. the color format of the given RGB color) |
| Palette& Cine::Palette::saturatedAddNormalizedGray | ( | Palette & | output, |
| byte | firstIndex, | ||
| byte | lastIndex, | ||
| signed | grayDividend, | ||
| signed | grayDenominator | ||
| ) | const |
Saturated add a normalized gray value to current palette's subset and save the modified colors in the given output palette.
| output | The output palette (Only this palette is modified) |
| firstIndex | First color index of the palette's subset (Inclusive range) |
| lastIndex | Last color index of the palette's subset (Inclusive range) |
| grayDividend | Dividend of the normalized gray value |
| grayDenominator | Denominator of the normalized gray value |
| bool Cine::Palette::isValid | ( | ) | const |
Is the palette valid? (Mostly just checks the color format for correctness)
| const Graphics::PixelFormat& Cine::Palette::colorFormat | ( | ) | const |
The original color format in which this palette was loaded.
| void Cine::Palette::setGlobalOSystemPalette | ( | ) | const |
Sets current palette to global OSystem's palette using g_system->getPaletteManager()->setPalette.
| Color Cine::Palette::getColor | ( | byte | index | ) | const |
Get the color at the given palette index.
| uint8 Cine::Palette::getR | ( | byte | index | ) | const |
Get the red color component of the color at the given palette index.
| uint8 Cine::Palette::getG | ( | byte | index | ) | const |
Get the green color component of the color at the given palette index.
| uint8 Cine::Palette::getB | ( | byte | index | ) | const |
Get the blue color component of the color at the given palette index.