summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-01-04 16:14:51 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-01-29 08:09:35 +0100
commite28ad31e637cedcbce9b179036551596692f25b2 (patch)
tree636458787f9d8b2406f7cf06fe0924cea1441602 /chart2
parentb34ef4aec1be4b541f757b09fbf7ea430ea4b714 (diff)
improve the color interpolation in time based charts
Change-Id: I732cee263258939742b7c43e02e89053a5dce9a8
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/main/VDataSeries.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx
index efc5333ca00b..2ebe5f5d6711 100644
--- a/chart2/source/view/main/VDataSeries.cxx
+++ b/chart2/source/view/main/VDataSeries.cxx
@@ -1106,6 +1106,18 @@ double VDataSeries::getValueByProperty( sal_Int32 nIndex, const OUString& rPropN
if(mpOldSeries && mpOldSeries->hasPropertyMapping(rPropName))
{
double fOldValue = mpOldSeries->getValueByProperty( nIndex, rPropName );
+ if(rPropName.endsWith("Color"))
+ {
+ //optimized interpolation for color values
+ Color aColor(static_cast<sal_uInt32>(fValue));
+ Color aOldColor(static_cast<sal_uInt32>(fOldValue));
+ sal_uInt8 r = aOldColor.GetRed() + (aColor.GetRed() - aOldColor.GetRed()) * mnPercent;
+ sal_uInt8 g = aOldColor.GetGreen() + (aColor.GetGreen() - aOldColor.GetGreen()) * mnPercent;
+ sal_uInt8 b = aOldColor.GetBlue() + (aColor.GetBlue() - aOldColor.GetBlue()) * mnPercent;
+ sal_uInt8 t = aOldColor.GetTransparency() + (aColor.GetTransparency() - aOldColor.GetTransparency()) * mnPercent;
+ Color aRet(t, r, g, b);
+ return aRet.GetColor();
+ }
return fOldValue + (fValue - fOldValue) * mnPercent;
}
return fValue;