summaryrefslogtreecommitdiff
path: root/basegfx/source/color
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-08-19 22:59:05 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-08-19 22:59:05 +0000
commitf2e63cc81d923e144dc0cbce1ca287a3c49db6ff (patch)
tree6f7cab0020275c6882c8cb9569375850a1ea1757 /basegfx/source/color
parent85e5123ec89560228f528d59c2ce1336f85b5793 (diff)
INTEGRATION: CWS aw033 (1.1.2); FILE ADDED
2008/08/19 16:43:44 cl 1.1.2.5: fixed license files 2008/05/27 14:08:44 aw 1.1.2.4: #i39532# changes DEV300 m12 resync corrections 2007/01/22 17:28:18 aw 1.1.2.3: changes after resync 2006/12/12 10:15:10 aw 1.1.2.2: #i39532# changes after resync 2006/06/02 13:51:31 aw 1.1.2.1: #i39523# added standard colorModifier
Diffstat (limited to 'basegfx/source/color')
-rw-r--r--basegfx/source/color/bcolormodifier.cxx76
1 files changed, 76 insertions, 0 deletions
diff --git a/basegfx/source/color/bcolormodifier.cxx b/basegfx/source/color/bcolormodifier.cxx
new file mode 100644
index 000000000000..f1947c70e0f2
--- /dev/null
+++ b/basegfx/source/color/bcolormodifier.cxx
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: bcolormodifier.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_basegfx.hxx"
+
+#include <basegfx/color/bcolormodifier.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ ::basegfx::BColor BColorModifier::getModifiedColor(const ::basegfx::BColor& aSourceColor) const
+ {
+ switch(meMode)
+ {
+ case BCOLORMODIFYMODE_INTERPOLATE :
+ {
+ return interpolate(maBColor, aSourceColor, mfValue);
+ }
+ case BCOLORMODIFYMODE_GRAY :
+ {
+ const double fLuminance(aSourceColor.luminance());
+ return ::basegfx::BColor(fLuminance, fLuminance, fLuminance);
+ }
+ case BCOLORMODIFYMODE_BLACKANDWHITE :
+ {
+ const double fLuminance(aSourceColor.luminance());
+
+ if(fLuminance < mfValue)
+ {
+ return ::basegfx::BColor::getEmptyBColor();
+ }
+ else
+ {
+ return ::basegfx::BColor(1.0, 1.0, 1.0);
+ }
+ }
+ default : // BCOLORMODIFYMODE_REPLACE
+ {
+ return maBColor;
+ }
+ }
+ }
+} // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// eof