diff options
author | Kari Salminen | 2009-03-14 22:36:05 +0000 |
---|---|---|
committer | Kari Salminen | 2009-03-14 22:36:05 +0000 |
commit | 814f27a72ee93804686871eae35890bb6d6fc18f (patch) | |
tree | d4724a9d5781b644a636c9c87dfeba65ff7a5267 /engines/cine/pal.h | |
parent | 8b725eef83b031de5b201ff3ea0382f10e05e68c (diff) | |
download | scummvm-rg350-814f27a72ee93804686871eae35890bb6d6fc18f.tar.gz scummvm-rg350-814f27a72ee93804686871eae35890bb6d6fc18f.tar.bz2 scummvm-rg350-814f27a72ee93804686871eae35890bb6d6fc18f.zip |
Cine::Palette revamp part 2: Fix save-function, add Cine-palette formats etc.
- Removed excess convenience functions, made the used palette formats
publicly available instead (Cine::kLowPalFormat, Cine::kHighPalFormat etc)
- Fixed output conversion i.e. save-functions.. Hopefully they work ;-)
- Renamed some parameters for unification (colors -> buf, numBytes -> size)
- Added some documentation, e.g. for the load- & save-functions.
svn-id: r39405
Diffstat (limited to 'engines/cine/pal.h')
-rw-r--r-- | engines/cine/pal.h | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/engines/cine/pal.h b/engines/cine/pal.h index 4d59a6e998..23c9007986 100644 --- a/engines/cine/pal.h +++ b/engines/cine/pal.h @@ -30,6 +30,15 @@ namespace Cine { +/*! \brief Low resolution (9-bit) color format used in Cine's 16-color modes. */ +static const Graphics::PixelFormat kLowPalFormat = {2, 5, 5, 5, 8, 8, 4, 0, 0}; + +/*! \brief High resolution (24-bit) color format used in Cine's 256-color modes. */ +static const Graphics::PixelFormat kHighPalFormat = {3, 0, 0, 0, 8, 0, 8, 16, 0}; + +/*! \brief The color format used by OSystem's setPalette-function. */ +static const Graphics::PixelFormat kSystemPalFormat = {4, 0, 0, 0, 8, 0, 8, 16, 0}; + struct PalEntry { char name[10]; byte pal1[16]; @@ -54,19 +63,41 @@ void transformPaletteRange(byte *srcPal, byte *dstPal, int startColor, int stopC // TODO: Test class Palette { public: - Palette &loadCineLowPal(const byte *colors, const uint numColors = 16); - Palette &loadCineHighPal(const byte *colors, const uint numColors = 256); - Palette &load(const byte *colors, const Graphics::PixelFormat format, const uint numColors); - - byte *saveCineLowPal(byte *colors, const uint numBytes) const; - byte *saveCineHighPal(byte *colors, const uint numBytes) const; - byte *saveOrigFormat(byte *colors, const uint numBytes) const; - byte *saveSystemFormat(byte *colors, const uint numBytes) const; - byte *save(byte *colors, const uint numBytes, const Graphics::PixelFormat format) const; + /*! \brief Load palette from buffer with given color format and number of colors. + * \param buf Input buffer + * \param size Input buffer size in bytes + * \param format Input color format + * \param numColors Number of colors to load + */ + Palette &load(const byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors); + + /*! \brief Save the whole palette to buffer in original color format. + * \param buf Output buffer + * \param size Output buffer size in bytes + */ + byte *save(byte *buf, const uint size) const; + + /*! \brief Save the whole palette to buffer with given color format. + * \param buf Output buffer + * \param size Output buffer size in bytes + * \param format Output color format + */ + byte *save(byte *buf, const uint size, const Graphics::PixelFormat format) const; + + /*! \brief Save (partial) palette to buffer with given color format. + * \param buf Output buffer + * \param size Output buffer size in bytes + * \param format Output color format + * \param numColors Number of colors to save + * \param firstIndex Starting color index (from which onwards to save the colors) + */ + byte *save(byte *buf, const uint size, const Graphics::PixelFormat format, const uint numColors, const byte firstIndex = 0) const; Palette &rotateRight(byte firstIndex, byte lastIndex); Palette &saturatedAddColor(byte firstIndex, byte lastIndex, signed r, signed g, signed b); uint colorCount() const; + + /*! \brief The original color format in which this palette was loaded. */ Graphics::PixelFormat colorFormat() const; private: |