aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorKari Salminen2009-05-24 01:36:25 +0000
committerKari Salminen2009-05-24 01:36:25 +0000
commit70f8f1fbf3fc39e7ce280883d43a54cc71bc7760 (patch)
tree05a977fe7b5bae6c18c8e87547f54880e310838f /engines
parent344caa88fcf8ce352e7bee6b2c6d4a8df2df548e (diff)
downloadscummvm-rg350-70f8f1fbf3fc39e7ce280883d43a54cc71bc7760.tar.gz
scummvm-rg350-70f8f1fbf3fc39e7ce280883d43a54cc71bc7760.tar.bz2
scummvm-rg350-70f8f1fbf3fc39e7ce280883d43a54cc71bc7760.zip
Add color and color component getters to Cine::Palette.
svn-id: r40849
Diffstat (limited to 'engines')
-rw-r--r--engines/cine/pal.cpp16
-rw-r--r--engines/cine/pal.h15
2 files changed, 29 insertions, 2 deletions
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 2a4f931494..0a8db1855b 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -243,6 +243,22 @@ void Palette::setGlobalOSystemPalette() const {
g_system->setPalette(buf, 0, colorCount());
}
+Cine::Palette::Color Palette::getColor(byte index) const {
+ return _colors[index];
+}
+
+uint8 Palette::getR(byte index) const {
+ return _colors[index].r;
+}
+
+uint8 Palette::getG(byte index) const {
+ return _colors[index].g;
+}
+
+uint8 Palette::getB(byte index) const {
+ return _colors[index].b;
+}
+
void Palette::setColorFormat(const Graphics::PixelFormat format) {
_format = format;
}
diff --git a/engines/cine/pal.h b/engines/cine/pal.h
index ccb87b8c61..f59dee53df 100644
--- a/engines/cine/pal.h
+++ b/engines/cine/pal.h
@@ -84,12 +84,11 @@ void transformPaletteRange(byte *srcPal, byte *dstPal, int startColor, int stopC
// TODO: Make use of
// TODO: Test
class Palette {
-private:
+public:
struct Color {
uint8 r, g, b;
};
-public:
/*! \brief Create an initially black palette with the given color format and number of colors.
* \param format Color format
* \param numColors Number of colors
@@ -177,6 +176,18 @@ public:
/*! \brief Sets current palette to global OSystem's palette using g_system->setPalette. */
void setGlobalOSystemPalette() const;
+ /*! \brief Get the color at the given palette index. */
+ Color getColor(byte index) const;
+
+ /*! \brief Get the red color component of the color at the given palette index. */
+ uint8 getR(byte index) const;
+
+ /*! \brief Get the green color component of the color at the given palette index. */
+ uint8 getG(byte index) const;
+
+ /*! \brief Get the blue color component of the color at the given palette index. */
+ uint8 getB(byte index) const;
+
private:
void setColorFormat(const Graphics::PixelFormat format);
Cine::Palette::Color saturatedAddColor(Cine::Palette::Color baseColor, signed r, signed g, signed b) const;