aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cine/pal.cpp9
-rw-r--r--engines/cine/pal.h14
2 files changed, 23 insertions, 0 deletions
diff --git a/engines/cine/pal.cpp b/engines/cine/pal.cpp
index 3341da39c5..ce26ae89b2 100644
--- a/engines/cine/pal.cpp
+++ b/engines/cine/pal.cpp
@@ -259,6 +259,15 @@ Palette &Palette::saturatedAddColor(Palette& output, byte firstIndex, byte lastI
return output;
}
+Palette &Palette::saturatedAddNormalizedColor(Palette& output, byte firstIndex, byte lastIndex, signed rNormalized, signed gNormalized, signed bNormalized, signed dividend, signed denominator) {
+ assert(denominator != 0);
+ const signed r = _format.rMax() * rNormalized * dividend / denominator;
+ const signed g = _format.gMax() * gNormalized * dividend / denominator;
+ const signed b = _format.bMax() * bNormalized * dividend / denominator;
+
+ return saturatedAddColor(output, firstIndex, lastIndex, r, g, b);
+}
+
Palette &Palette::saturatedAddNormalizedGray(Palette& output, byte firstIndex, byte lastIndex, int grayDividend, int grayDenominator) {
assert(grayDenominator != 0);
const signed r = _format.rMax() * grayDividend / grayDenominator;
diff --git a/engines/cine/pal.h b/engines/cine/pal.h
index 47d45f7e76..030621a2f4 100644
--- a/engines/cine/pal.h
+++ b/engines/cine/pal.h
@@ -139,6 +139,20 @@ public:
Palette &rotateRight(byte firstIndex, byte lastIndex);
Palette &saturatedAddColor(Palette& output, byte firstIndex, byte lastIndex, signed r, signed g, signed b);
+ /*! \brief Saturated add a normalized RGB color to current palette's subset and save the modified colors in the given output palette.
+ * \param output The output palette (Only this palette is modified)
+ * \param firstIndex First color index of the palette's subset (Inclusive range)
+ * \param lastIndex Last color index of the palette's subset (Inclusive range)
+ * \param rNormalized The normalized red color component
+ * \param gNormalized The normalized green color component
+ * \param bNormalized The normalized blue color component
+ * \param dividend Dividend of the normalized color component values
+ * \param denominator Denominator of the normalized color component values
+ * \note The normalized color component multiplier value (i.e. in range [-1, +1]) is given as a fractional number
+ * so each input color component is multiplied by it and the color component's maximum (Specified by this palette's color format)
+ */
+ Palette &saturatedAddNormalizedColor(Palette& output, byte firstIndex, byte lastIndex, signed rNormalized, signed gNormalized, signed bNormalized, signed dividend, signed denominator);
+
/*! \brief Saturated add a normalized gray value to current palette's subset and save the modified colors in the given output palette.
* \param output The output palette (Only this palette is modified)
* \param firstIndex First color index of the palette's subset (Inclusive range)