109dbbe93SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
309dbbe93SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
409dbbe93SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
509dbbe93SAndrew Rist  * distributed with this work for additional information
609dbbe93SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
709dbbe93SAndrew Rist  * to you under the Apache License, Version 2.0 (the
809dbbe93SAndrew Rist  * "License"); you may not use this file except in compliance
909dbbe93SAndrew Rist  * with the License.  You may obtain a copy of the License at
1009dbbe93SAndrew Rist  *
1109dbbe93SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1209dbbe93SAndrew Rist  *
1309dbbe93SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1409dbbe93SAndrew Rist  * software distributed under the License is distributed on an
1509dbbe93SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1609dbbe93SAndrew Rist  * KIND, either express or implied.  See the License for the
1709dbbe93SAndrew Rist  * specific language governing permissions and limitations
1809dbbe93SAndrew Rist  * under the License.
1909dbbe93SAndrew Rist  *
2009dbbe93SAndrew Rist  *************************************************************/
2109dbbe93SAndrew Rist 
22cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
23cdf0e10cSrcweir #include "precompiled_basegfx.hxx"
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <basegfx/color/bcolormodifier.hxx>
26cdf0e10cSrcweir 
27cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
28cdf0e10cSrcweir 
29cdf0e10cSrcweir namespace basegfx
30cdf0e10cSrcweir {
~BColorModifier()31*49c58f9bSArmin Le Grand     BColorModifier::~BColorModifier()
32*49c58f9bSArmin Le Grand     {
33*49c58f9bSArmin Le Grand     }
34*49c58f9bSArmin Le Grand } // end of namespace basegfx
35*49c58f9bSArmin Le Grand 
36*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
37*49c58f9bSArmin Le Grand 
38*49c58f9bSArmin Le Grand namespace basegfx
39*49c58f9bSArmin Le Grand {
~BColorModifier_gray()40*49c58f9bSArmin Le Grand     BColorModifier_gray::~BColorModifier_gray()
41*49c58f9bSArmin Le Grand     {
42*49c58f9bSArmin Le Grand     }
43*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const44*49c58f9bSArmin Le Grand     bool BColorModifier_gray::operator==(const BColorModifier& rCompare) const
45*49c58f9bSArmin Le Grand     {
46*49c58f9bSArmin Le Grand         return 0 != dynamic_cast< const BColorModifier_gray* >(&rCompare);
47*49c58f9bSArmin Le Grand     }
48*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const49*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_gray::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
50*49c58f9bSArmin Le Grand     {
51*49c58f9bSArmin Le Grand         const double fLuminance(aSourceColor.luminance());
52*49c58f9bSArmin Le Grand 
53*49c58f9bSArmin Le Grand         return ::basegfx::BColor(fLuminance, fLuminance, fLuminance);
54*49c58f9bSArmin Le Grand     }
55*49c58f9bSArmin Le Grand } // end of namespace basegfx
56*49c58f9bSArmin Le Grand 
57*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
58*49c58f9bSArmin Le Grand 
59*49c58f9bSArmin Le Grand namespace basegfx
60*49c58f9bSArmin Le Grand {
~BColorModifier_invert()61*49c58f9bSArmin Le Grand     BColorModifier_invert::~BColorModifier_invert()
62*49c58f9bSArmin Le Grand     {
63*49c58f9bSArmin Le Grand     }
64*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const65*49c58f9bSArmin Le Grand     bool BColorModifier_invert::operator==(const BColorModifier& rCompare) const
66*49c58f9bSArmin Le Grand     {
67*49c58f9bSArmin Le Grand         return 0 != dynamic_cast< const BColorModifier_invert* >(&rCompare);
68*49c58f9bSArmin Le Grand     }
69*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const70*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_invert::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
71*49c58f9bSArmin Le Grand     {
72*49c58f9bSArmin Le Grand         return ::basegfx::BColor(1.0 - aSourceColor.getRed(), 1.0 - aSourceColor.getGreen(), 1.0 - aSourceColor.getBlue());
73*49c58f9bSArmin Le Grand     }
74*49c58f9bSArmin Le Grand } // end of namespace basegfx
75*49c58f9bSArmin Le Grand 
76*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
77*49c58f9bSArmin Le Grand 
78*49c58f9bSArmin Le Grand namespace basegfx
79*49c58f9bSArmin Le Grand {
~BColorModifier_luminance_to_alpha()80*49c58f9bSArmin Le Grand     BColorModifier_luminance_to_alpha::~BColorModifier_luminance_to_alpha()
81*49c58f9bSArmin Le Grand     {
82*49c58f9bSArmin Le Grand     }
83*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const84*49c58f9bSArmin Le Grand     bool BColorModifier_luminance_to_alpha::operator==(const BColorModifier& rCompare) const
85*49c58f9bSArmin Le Grand     {
86*49c58f9bSArmin Le Grand         return 0 != dynamic_cast< const BColorModifier_luminance_to_alpha* >(&rCompare);
87*49c58f9bSArmin Le Grand     }
88*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const89*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_luminance_to_alpha::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
90*49c58f9bSArmin Le Grand     {
91*49c58f9bSArmin Le Grand         const double fAlpha(1.0 - ((aSourceColor.getRed() * 0.2125) + (aSourceColor.getGreen() * 0.7154) + (aSourceColor.getBlue() * 0.0721)));
92*49c58f9bSArmin Le Grand 
93*49c58f9bSArmin Le Grand         return ::basegfx::BColor(fAlpha, fAlpha, fAlpha);
94*49c58f9bSArmin Le Grand     }
95*49c58f9bSArmin Le Grand } // end of namespace basegfx
96*49c58f9bSArmin Le Grand 
97*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
98*49c58f9bSArmin Le Grand 
99*49c58f9bSArmin Le Grand namespace basegfx
100*49c58f9bSArmin Le Grand {
~BColorModifier_replace()101*49c58f9bSArmin Le Grand     BColorModifier_replace::~BColorModifier_replace()
102*49c58f9bSArmin Le Grand     {
103*49c58f9bSArmin Le Grand     }
104*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const105*49c58f9bSArmin Le Grand     bool BColorModifier_replace::operator==(const BColorModifier& rCompare) const
106*49c58f9bSArmin Le Grand     {
107*49c58f9bSArmin Le Grand         const BColorModifier_replace* pCompare = dynamic_cast< const BColorModifier_replace* >(&rCompare);
108*49c58f9bSArmin Le Grand 
109*49c58f9bSArmin Le Grand         if(!pCompare)
110*49c58f9bSArmin Le Grand         {
111*49c58f9bSArmin Le Grand             return false;
112*49c58f9bSArmin Le Grand         }
113*49c58f9bSArmin Le Grand 
114*49c58f9bSArmin Le Grand         return getBColor() == pCompare->getBColor();
115*49c58f9bSArmin Le Grand     }
116*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor &) const117*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_replace::getModifiedColor(const ::basegfx::BColor& /*aSourceColor*/) const
118*49c58f9bSArmin Le Grand     {
119*49c58f9bSArmin Le Grand         return maBColor;
120*49c58f9bSArmin Le Grand     }
121*49c58f9bSArmin Le Grand } // end of namespace basegfx
122*49c58f9bSArmin Le Grand 
123*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
124*49c58f9bSArmin Le Grand 
125*49c58f9bSArmin Le Grand namespace basegfx
126*49c58f9bSArmin Le Grand {
~BColorModifier_interpolate()127*49c58f9bSArmin Le Grand     BColorModifier_interpolate::~BColorModifier_interpolate()
128*49c58f9bSArmin Le Grand     {
129*49c58f9bSArmin Le Grand     }
130*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const131*49c58f9bSArmin Le Grand     bool BColorModifier_interpolate::operator==(const BColorModifier& rCompare) const
132*49c58f9bSArmin Le Grand     {
133*49c58f9bSArmin Le Grand         const BColorModifier_interpolate* pCompare = dynamic_cast< const BColorModifier_interpolate* >(&rCompare);
134*49c58f9bSArmin Le Grand 
135*49c58f9bSArmin Le Grand         if(!pCompare)
136*49c58f9bSArmin Le Grand         {
137*49c58f9bSArmin Le Grand             return false;
138*49c58f9bSArmin Le Grand         }
139*49c58f9bSArmin Le Grand 
140*49c58f9bSArmin Le Grand         return getBColor() == pCompare->getBColor() && getValue() == pCompare->getValue();
141*49c58f9bSArmin Le Grand     }
142*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const143*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_interpolate::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
144*49c58f9bSArmin Le Grand     {
145*49c58f9bSArmin Le Grand         return interpolate(maBColor, aSourceColor, mfValue);
146*49c58f9bSArmin Le Grand     }
147*49c58f9bSArmin Le Grand } // end of namespace basegfx
148*49c58f9bSArmin Le Grand 
149*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
150*49c58f9bSArmin Le Grand 
151*49c58f9bSArmin Le Grand namespace basegfx
152*49c58f9bSArmin Le Grand {
~BColorModifier_black_and_white()153*49c58f9bSArmin Le Grand     BColorModifier_black_and_white::~BColorModifier_black_and_white()
154*49c58f9bSArmin Le Grand     {
155*49c58f9bSArmin Le Grand     }
156*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const157*49c58f9bSArmin Le Grand     bool BColorModifier_black_and_white::operator==(const BColorModifier& rCompare) const
158*49c58f9bSArmin Le Grand     {
159*49c58f9bSArmin Le Grand         const BColorModifier_black_and_white* pCompare = dynamic_cast< const BColorModifier_black_and_white* >(&rCompare);
160*49c58f9bSArmin Le Grand 
161*49c58f9bSArmin Le Grand         if(!pCompare)
162*49c58f9bSArmin Le Grand         {
163*49c58f9bSArmin Le Grand             return false;
164*49c58f9bSArmin Le Grand         }
165*49c58f9bSArmin Le Grand 
166*49c58f9bSArmin Le Grand         return getValue() == pCompare->getValue();
167*49c58f9bSArmin Le Grand     }
168*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const169*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_black_and_white::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
170*49c58f9bSArmin Le Grand     {
171*49c58f9bSArmin Le Grand         const double fLuminance(aSourceColor.luminance());
172*49c58f9bSArmin Le Grand 
173*49c58f9bSArmin Le Grand         if(fLuminance < mfValue)
174*49c58f9bSArmin Le Grand         {
175*49c58f9bSArmin Le Grand             return ::basegfx::BColor::getEmptyBColor();
176*49c58f9bSArmin Le Grand         }
177*49c58f9bSArmin Le Grand         else
178*49c58f9bSArmin Le Grand         {
179*49c58f9bSArmin Le Grand             return ::basegfx::BColor(1.0, 1.0, 1.0);
180*49c58f9bSArmin Le Grand         }
181*49c58f9bSArmin Le Grand     }
182*49c58f9bSArmin Le Grand } // end of namespace basegfx
183*49c58f9bSArmin Le Grand 
184*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
185*49c58f9bSArmin Le Grand 
186*49c58f9bSArmin Le Grand namespace basegfx
187*49c58f9bSArmin Le Grand {
BColorModifier_gamma(double fValue)188*49c58f9bSArmin Le Grand     BColorModifier_gamma::BColorModifier_gamma(double fValue)
189*49c58f9bSArmin Le Grand     :   BColorModifier(),
190*49c58f9bSArmin Le Grand         mfValue(fValue),
191*49c58f9bSArmin Le Grand         mfInvValue(fValue),
192*49c58f9bSArmin Le Grand         mbUseIt(!basegfx::fTools::equal(fValue, 1.0) && basegfx::fTools::more(fValue, 0.0) && basegfx::fTools::lessOrEqual(fValue, 10.0))
193*49c58f9bSArmin Le Grand     {
194*49c58f9bSArmin Le Grand         if(mbUseIt)
195*49c58f9bSArmin Le Grand         {
196*49c58f9bSArmin Le Grand             mfInvValue = 1.0 / mfValue;
197*49c58f9bSArmin Le Grand         }
198*49c58f9bSArmin Le Grand     }
199*49c58f9bSArmin Le Grand 
~BColorModifier_gamma()200*49c58f9bSArmin Le Grand     BColorModifier_gamma::~BColorModifier_gamma()
201*49c58f9bSArmin Le Grand     {
202*49c58f9bSArmin Le Grand     }
203*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const204*49c58f9bSArmin Le Grand     bool BColorModifier_gamma::operator==(const BColorModifier& rCompare) const
205*49c58f9bSArmin Le Grand     {
206*49c58f9bSArmin Le Grand         const BColorModifier_gamma* pCompare = dynamic_cast< const BColorModifier_gamma* >(&rCompare);
207*49c58f9bSArmin Le Grand 
208*49c58f9bSArmin Le Grand         if(!pCompare)
209*49c58f9bSArmin Le Grand         {
210*49c58f9bSArmin Le Grand             return false;
211*49c58f9bSArmin Le Grand         }
212*49c58f9bSArmin Le Grand 
213*49c58f9bSArmin Le Grand         // getValue is sufficient, mfInvValue and mbUseIt are only helper values
214*49c58f9bSArmin Le Grand         return getValue() == pCompare->getValue();
215*49c58f9bSArmin Le Grand     }
216*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const217*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_gamma::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
218*49c58f9bSArmin Le Grand     {
219*49c58f9bSArmin Le Grand         if(mbUseIt)
220*49c58f9bSArmin Le Grand         {
221*49c58f9bSArmin Le Grand             ::basegfx::BColor aRetval(
222*49c58f9bSArmin Le Grand                 pow(aSourceColor.getRed(), mfInvValue),
223*49c58f9bSArmin Le Grand                 pow(aSourceColor.getGreen(), mfInvValue),
224*49c58f9bSArmin Le Grand                 pow(aSourceColor.getBlue(), mfInvValue));
225*49c58f9bSArmin Le Grand 
226*49c58f9bSArmin Le Grand             aRetval.clamp();
227*49c58f9bSArmin Le Grand             return aRetval;
228*49c58f9bSArmin Le Grand         }
229*49c58f9bSArmin Le Grand         else
230*49c58f9bSArmin Le Grand         {
231*49c58f9bSArmin Le Grand             return aSourceColor;
232*49c58f9bSArmin Le Grand         }
233*49c58f9bSArmin Le Grand     }
234*49c58f9bSArmin Le Grand } // end of namespace basegfx
235*49c58f9bSArmin Le Grand 
236*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
237*49c58f9bSArmin Le Grand 
238*49c58f9bSArmin Le Grand namespace basegfx
239*49c58f9bSArmin Le Grand {
BColorModifier_RGBLuminanceContrast(double fRed,double fGreen,double fBlue,double fLuminance,double fContrast)240*49c58f9bSArmin Le Grand     BColorModifier_RGBLuminanceContrast::BColorModifier_RGBLuminanceContrast(double fRed, double fGreen, double fBlue, double fLuminance, double fContrast)
241*49c58f9bSArmin Le Grand     :   BColorModifier(),
242*49c58f9bSArmin Le Grand         mfRed(basegfx::clamp(fRed, -1.0, 1.0)),
243*49c58f9bSArmin Le Grand         mfGreen(basegfx::clamp(fGreen, -1.0, 1.0)),
244*49c58f9bSArmin Le Grand         mfBlue(basegfx::clamp(fBlue, -1.0, 1.0)),
245*49c58f9bSArmin Le Grand         mfLuminance(basegfx::clamp(fLuminance, -1.0, 1.0)),
246*49c58f9bSArmin Le Grand         mfContrast(basegfx::clamp(fContrast, -1.0, 1.0)),
247*49c58f9bSArmin Le Grand         mfContrastOff(1.0),
248*49c58f9bSArmin Le Grand         mfRedOff(0.0),
249*49c58f9bSArmin Le Grand         mfGreenOff(0.0),
250*49c58f9bSArmin Le Grand         mfBlueOff(0.0),
251*49c58f9bSArmin Le Grand         mbUseIt(false)
252*49c58f9bSArmin Le Grand     {
253*49c58f9bSArmin Le Grand         if(!basegfx::fTools::equalZero(mfRed)
254*49c58f9bSArmin Le Grand             || !basegfx::fTools::equalZero(mfGreen)
255*49c58f9bSArmin Le Grand             || !basegfx::fTools::equalZero(mfBlue)
256*49c58f9bSArmin Le Grand             || !basegfx::fTools::equalZero(mfLuminance)
257*49c58f9bSArmin Le Grand             || !basegfx::fTools::equalZero(mfContrast))
258*49c58f9bSArmin Le Grand         {
259*49c58f9bSArmin Le Grand             // calculate slope
260*49c58f9bSArmin Le Grand             if(mfContrast >= 0.0)
261ddde725dSArmin Le Grand             {
262*49c58f9bSArmin Le Grand                 mfContrastOff = 128.0 / (128.0 - (mfContrast * 127.0));
263ddde725dSArmin Le Grand             }
264*49c58f9bSArmin Le Grand             else
265ddde725dSArmin Le Grand             {
266*49c58f9bSArmin Le Grand                 mfContrastOff = ( 128.0 + (mfContrast * 127.0)) / 128.0;
267ddde725dSArmin Le Grand             }
268*49c58f9bSArmin Le Grand 
269*49c58f9bSArmin Le Grand             // calculate unified contrast offset
270*49c58f9bSArmin Le Grand             const double fPreparedContrastOff((128.0 - mfContrastOff * 128.0) / 255.0);
271*49c58f9bSArmin Le Grand             const double fCombinedOffset(mfLuminance + fPreparedContrastOff);
272*49c58f9bSArmin Le Grand 
273*49c58f9bSArmin Le Grand             // set full offsets
274*49c58f9bSArmin Le Grand             mfRedOff = mfRed + fCombinedOffset;
275*49c58f9bSArmin Le Grand             mfGreenOff = mfGreen + fCombinedOffset;
276*49c58f9bSArmin Le Grand             mfBlueOff = mfBlue + fCombinedOffset;
277*49c58f9bSArmin Le Grand 
278*49c58f9bSArmin Le Grand             mbUseIt = true;
279*49c58f9bSArmin Le Grand         }
280*49c58f9bSArmin Le Grand     }
281*49c58f9bSArmin Le Grand 
~BColorModifier_RGBLuminanceContrast()282*49c58f9bSArmin Le Grand     BColorModifier_RGBLuminanceContrast::~BColorModifier_RGBLuminanceContrast()
283*49c58f9bSArmin Le Grand     {
284*49c58f9bSArmin Le Grand     }
285*49c58f9bSArmin Le Grand 
operator ==(const BColorModifier & rCompare) const286*49c58f9bSArmin Le Grand     bool BColorModifier_RGBLuminanceContrast::operator==(const BColorModifier& rCompare) const
287*49c58f9bSArmin Le Grand     {
288*49c58f9bSArmin Le Grand         const BColorModifier_RGBLuminanceContrast* pCompare = dynamic_cast< const BColorModifier_RGBLuminanceContrast* >(&rCompare);
289*49c58f9bSArmin Le Grand 
290*49c58f9bSArmin Le Grand         if(!pCompare)
291*49c58f9bSArmin Le Grand         {
292*49c58f9bSArmin Le Grand             return false;
293*49c58f9bSArmin Le Grand         }
294*49c58f9bSArmin Le Grand 
295*49c58f9bSArmin Le Grand         // no need to compare other values, these are just helpers
296*49c58f9bSArmin Le Grand         return getRed() == pCompare->getRed()
297*49c58f9bSArmin Le Grand             && getGreen() == pCompare->getGreen()
298*49c58f9bSArmin Le Grand             && getBlue() == pCompare->getBlue()
299*49c58f9bSArmin Le Grand             && getLuminance() == pCompare->getLuminance()
300*49c58f9bSArmin Le Grand             && getContrast() == pCompare->getContrast();
301*49c58f9bSArmin Le Grand     }
302*49c58f9bSArmin Le Grand 
getModifiedColor(const::basegfx::BColor & aSourceColor) const303*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifier_RGBLuminanceContrast::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
304*49c58f9bSArmin Le Grand     {
305*49c58f9bSArmin Le Grand         if(mbUseIt)
306*49c58f9bSArmin Le Grand         {
307*49c58f9bSArmin Le Grand             return basegfx::BColor(
308*49c58f9bSArmin Le Grand                 basegfx::clamp(aSourceColor.getRed() * mfContrastOff + mfRedOff, 0.0, 1.0),
309*49c58f9bSArmin Le Grand                 basegfx::clamp(aSourceColor.getGreen() * mfContrastOff + mfGreenOff, 0.0, 1.0),
310*49c58f9bSArmin Le Grand                 basegfx::clamp(aSourceColor.getBlue() * mfContrastOff + mfBlueOff, 0.0, 1.0));
311*49c58f9bSArmin Le Grand         }
312*49c58f9bSArmin Le Grand         else
313*49c58f9bSArmin Le Grand         {
314*49c58f9bSArmin Le Grand             return aSourceColor;
315*49c58f9bSArmin Le Grand         }
316*49c58f9bSArmin Le Grand     }
317*49c58f9bSArmin Le Grand } // end of namespace basegfx
318*49c58f9bSArmin Le Grand 
319*49c58f9bSArmin Le Grand //////////////////////////////////////////////////////////////////////////////
320*49c58f9bSArmin Le Grand 
321*49c58f9bSArmin Le Grand namespace basegfx
322*49c58f9bSArmin Le Grand {
getModifiedColor(const::basegfx::BColor & rSource) const323*49c58f9bSArmin Le Grand     ::basegfx::BColor BColorModifierStack::getModifiedColor(const ::basegfx::BColor& rSource) const
324*49c58f9bSArmin Le Grand     {
325*49c58f9bSArmin Le Grand         if(maBColorModifiers.empty())
326*49c58f9bSArmin Le Grand         {
327*49c58f9bSArmin Le Grand             return rSource;
328*49c58f9bSArmin Le Grand         }
329*49c58f9bSArmin Le Grand 
330*49c58f9bSArmin Le Grand         ::basegfx::BColor aRetval(rSource);
331*49c58f9bSArmin Le Grand 
332*49c58f9bSArmin Le Grand         for(sal_uInt32 a(maBColorModifiers.size()); a;)
333*49c58f9bSArmin Le Grand         {
334*49c58f9bSArmin Le Grand             a--;
335*49c58f9bSArmin Le Grand             aRetval = maBColorModifiers[a]->getModifiedColor(aRetval);
336*49c58f9bSArmin Le Grand         }
337*49c58f9bSArmin Le Grand 
338*49c58f9bSArmin Le Grand         return aRetval;
339*49c58f9bSArmin Le Grand     }
340cdf0e10cSrcweir } // end of namespace basegfx
341cdf0e10cSrcweir 
342cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
343cdf0e10cSrcweir // eof
344