[ooo-build-commit] Branch 'ooo/master' - 4 commits - basegfx/inc basegfx/prj basegfx/source basegfx/test svtools/source vcl/prj vcl/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Wed Sep 9 22:32:48 PDT 2009
basegfx/inc/basegfx/color/bcolortools.hxx | 76 ++++++++
basegfx/prj/d.lst | 1
basegfx/source/color/bcolortools.cxx | 272 ++++++++++++++++++++++++++++++
basegfx/source/color/makefile.mk | 1
basegfx/test/basegfx2d.cxx | 175 +++++++++++++++++++
basegfx/test/makefile.mk | 1
svtools/source/filter.vcl/wmf/wmfwr.cxx | 11 -
vcl/prj/build.lst | 2
vcl/source/gdi/outdev3.cxx | 1
9 files changed, 528 insertions(+), 12 deletions(-)
New commits:
commit 1625fbc7a90075b1ea12096aeca96acabb416f7d
Author: Hans-Joachim Lankenau <hjs at openoffice.org>
Date: Wed Sep 9 13:42:15 2009 +0000
#i10000# dependency missing: source/component on inc (pch)
diff --git a/vcl/prj/build.lst b/vcl/prj/build.lst
index 52b4441..e8a328b 100644
--- a/vcl/prj/build.lst
+++ b/vcl/prj/build.lst
@@ -14,7 +14,7 @@ vc vcl\os2\source\app nmake - p vc__appp vc_inc NULL
vc vcl\os2\source\gdi nmake - p vc__gdip vc_inc NULL
vc vcl\os2\source\window nmake - p vc__winp vc_inc NULL
vc vcl\os2\source\src nmake - p vc__srcp vc_inc NULL
-vc vcl\source\components nmake - all vc_components NULL
+vc vcl\source\components nmake - all vc_components vc_inc NULL
vc vcl\win\source\app nmake - w vc__appw vc_inc NULL
vc vcl\win\source\gdi nmake - w vc__gdiw vc_inc NULL
vc vcl\win\source\window nmake - w vc__winw vc_inc NULL
commit a7f05894f02f4d9b6f03694f715fe48506c012be
Author: Rüdiger Timm <rt at openoffice.org>
Date: Wed Sep 9 12:29:23 2009 +0000
#i10000# vcl/source/gdi/outdev3.cxx: Avoid duplicate declaration of aStrikeoutTest
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index ec2601e..d1136fd 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -4515,7 +4515,6 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
// calculate approximation of strikeout atom size
long nStrikeoutWidth = nWidth;
- String aStrikeoutTest( aChars, 4 );
SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen );
if( pLayout )
{
commit c1fc7698cb6062b5393f750b564026a935b48a85
Author: Oliver Bolte <obo at openoffice.org>
Date: Wed Sep 9 11:12:23 2009 +0000
#i10000# pChars -> aChars by HDU
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index 90c4340..ec2601e 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -4515,7 +4515,7 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
// calculate approximation of strikeout atom size
long nStrikeoutWidth = nWidth;
- String aStrikeoutTest( pChars, 4 );
+ String aStrikeoutTest( aChars, 4 );
SalLayout* pLayout = ImplLayout( aStrikeoutTest, 0, nTestStrLen );
if( pLayout )
{
commit f3d1d09b3977ec133ba70023f7fcd6a80bdcf86a
Author: Oliver Bolte <obo at openoffice.org>
Date: Wed Sep 9 09:19:53 2009 +0000
CWS-TOOLING: integrate CWS impress174
2009-08-27 18:21:38 +0200 af r275502 : #i73289# Fixed detection of the cases when the layout menu is be disabled.
2009-08-24 17:45:50 +0200 sj r275326 : #i103360# only setting filltype if there is also a correct fill element
2009-08-24 16:11:06 +0200 cl r275322 : #i73871# only remove replaced objects from mark list if replaced by SdrEditView::ReplaceObjectAtView(). see issue for reason
2009-08-24 15:03:33 +0200 cl r275319 : fixed merge error
2009-08-20 12:45:29 +0200 sj r275174 : CWS-TOOLING: rebase CWS impress174 to trunk at 275001 (milestone: DEV300:m55)
2009-08-19 15:54:47 +0200 sj r275153 : #158486# text of flipped shapes is not flipped in word
2009-08-17 17:30:16 +0200 sj r275063 : #158486# also correcting text bound for additional text rotation
2009-08-05 11:09:32 +0200 sj r274643 : #i102797# adapted customshape coloring (fixed fontwork)
2009-08-04 14:17:36 +0200 sj r274620 : #i99501# pdf export: fixed export of rotated graphics
2009-07-30 16:15:44 +0200 sj r274494 : #158653# binary ppt import: fixed table border lines
2009-07-27 18:28:02 +0200 sj r274376 : added shape text clipping for customshapes
2009-07-20 18:09:14 +0200 sj r274154 : #i101918# fixed gallery preview (now taking the correct mapmode)
2009-07-13 18:00:58 +0200 cl r273948 : #i103238# clear hard set attributes only if new style set is manually applied
2009-07-13 17:58:07 +0200 cl r273947 : #i73289# do not expand a toolpanel when it gets enabled
2009-07-08 12:39:49 +0200 sj r273827 : #i101566# applied patch from cmc to solve font width inconsistencies
2009-07-08 12:11:13 +0200 sj r273826 : #i87727# added PDFDialog service
2009-07-06 17:22:40 +0200 sj r273755 : #i103360# fixed a merge problem, no more looping when loading transparence gradients on background page
2009-07-03 14:42:07 +0200 sj r273701 : #102797# added patch from thb (Adapted customshape coloring)
2009-07-03 14:09:44 +0200 sj r273696 : #102797# removed warning
2009-07-03 14:01:47 +0200 sj r273695 : #102797# added patch from thb (Adapted customshape coloring)
2009-07-03 13:13:39 +0200 sj r273688 : #102797# added patch from thb (Adapted customshape coloring)
2009-07-03 11:25:30 +0200 sj r273684 : #i103278# fixed import of lines
2009-07-01 16:23:47 +0200 cl r273599 : #i96820# correctly call setChanged on model if table is modified
2009-07-01 14:43:09 +0200 cl r273588 : #i8770# Patch: fix missing type provider for pdf export dialog
2009-07-01 14:40:28 +0200 cl r273586 : #i73871# activate picture bar after converting shape to bitmap
2009-07-01 14:39:05 +0200 cl r273584 : #i73871# activate picture bar after converting shape to bitmap
2009-07-01 14:04:53 +0200 cl r273578 : #i73289# PATCH: Disable layout pane on the masterslide
diff --git a/basegfx/inc/basegfx/color/bcolortools.hxx b/basegfx/inc/basegfx/color/bcolortools.hxx
new file mode 100644
index 0000000..f32f85f
--- /dev/null
+++ b/basegfx/inc/basegfx/color/bcolortools.hxx
@@ -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: bcolor.hxx,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.
+ *
+ ************************************************************************/
+
+#ifndef _BGFX_COLOR_BCOLORTOOLS_HXX
+#define _BGFX_COLOR_BCOLORTOOLS_HXX
+
+#include <sal/types.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx
+{
+ class BColor;
+
+ namespace tools
+ {
+ /// Transform from RGB to HSL
+ BColor rgb2hsl(const BColor& rRGBColor);
+ /// Transform from HSL to RGB
+ BColor hsl2rgb(const BColor& rHSLColor);
+
+ /// Transform from RGB to HSV
+ BColor rgb2hsv(const BColor& rRGBColor);
+ /// Transform from HSV to RGB
+ BColor hsv2rgb(const BColor& rHSVColor);
+
+ /// Transform from R'G'B' to YIQ (NTSC color model - Y is used in monochrome mode)
+ BColor rgb2yiq(const BColor& rRGBColor);
+ /// Transform from YIQ to R'G'B' (NTSC color model - Y is used in monochrome mode)
+ BColor yiq2rgb(const BColor& rYIQColor);
+
+ /// Transform from R'G'B' to Y'PbPr (the [0,1]x[-.5,.5]x[-.5,.5] equivalent of Y'CbCr (which is scaled into 8bit))
+ BColor rgb2ypbpr(const BColor& rRGBColor);
+ /// Transform from Y'PbPr (the [0,1]x[-.5,.5]x[-.5,.5] equivalent of Y'CbCr (which is scaled into 8bit)) into R'G'B'
+ BColor ypbpr2rgb(const BColor& rYPbPrColor);
+
+ /// Transform from CIE XYZ into Rec. 709 RGB (D65 white point)
+ BColor ciexyz2rgb( const BColor& rXYZColor );
+ /// Transform from Rec. 709 RGB (D65 white point) into CIE XYZ
+ BColor rgb2ciexyz( const BColor& rRGBColor );
+
+ }
+} // end of namespace basegfx
+
+#endif /* _BGFX_COLOR_BCOLORTOOLS_HXX */
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst
index 9dd6085..a58cd33 100644
--- a/basegfx/prj/d.lst
+++ b/basegfx/prj/d.lst
@@ -96,6 +96,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\tools
mkdir: %_DEST%\inc%_EXT%\basegfx\color
..\inc\basegfx\color\bcolor.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolor.hxx
+..\inc\basegfx\color\bcolortools.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolortools.hxx
..\inc\basegfx\color\bcolormodifier.hxx %_DEST%\inc%_EXT%\basegfx\color\bcolormodifier.hxx
mkdir: %_DEST%\inc%_EXT%\basegfx\pixel
diff --git a/basegfx/source/color/bcolortools.cxx b/basegfx/source/color/bcolortools.cxx
new file mode 100644
index 0000000..5e55e55
--- /dev/null
+++ b/basegfx/source/color/bcolortools.cxx
@@ -0,0 +1,272 @@
+/*************************************************************************
+ *
+ * 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: bcolor.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/numeric/ftools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolortools.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace basegfx { namespace tools
+{
+ BColor rgb2hsl(const BColor& rRGBColor)
+ {
+ const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue();
+ const double minVal = ::std::min( ::std::min( r, g ), b );
+ const double maxVal = ::std::max( ::std::max( r, g ), b );
+ const double d = maxVal - minVal;
+
+ double h=0, s=0, l=0;
+
+ l = (maxVal + minVal) / 2.0;
+
+ if( ::basegfx::fTools::equalZero(d) )
+ {
+ s = h = 0; // hue undefined (achromatic case)
+ }
+ else
+ {
+ s = l > 0.5 ? d/(2.0-maxVal-minVal) :
+ d/(maxVal + minVal);
+
+ if( r == maxVal )
+ h = (g - b)/d;
+ else if( g == maxVal )
+ h = 2.0 + (b - r)/d;
+ else
+ h = 4.0 + (r - h)/d;
+
+ h *= 60.0;
+
+ if( h < 0.0 )
+ h += 360.0;
+ }
+
+ return BColor(h,s,l);
+ }
+
+ static inline double hsl2rgbHelper( double nValue1, double nValue2, double nHue )
+ {
+ // clamp hue to [0,360]
+ nHue = fmod( nHue, 360.0 );
+
+ // cope with wrap-arounds
+ if( nHue < 0.0 )
+ nHue += 360.0;
+
+ if( nHue < 60.0 )
+ return nValue1 + (nValue2 - nValue1)*nHue/60.0;
+ else if( nHue < 180.0 )
+ return nValue2;
+ else if( nHue < 240.0 )
+ return nValue1 + (nValue2 - nValue1)*(240.0 - nHue)/60.0;
+ else
+ return nValue1;
+ }
+
+ BColor hsl2rgb(const BColor& rHSLColor)
+ {
+ const double h=rHSLColor.getRed(), s=rHSLColor.getGreen(), l=rHSLColor.getBlue();
+
+ if( fTools::equalZero(s) )
+ return BColor(l, l, l ); // achromatic case
+
+ const double nVal1( l <= 0.5 ? l*(1.0 + s) : l + s - l*s );
+ const double nVal2( 2.0*l - nVal1 );
+
+ return BColor(
+ hsl2rgbHelper(nVal2,
+ nVal1,
+ h + 120.0),
+ hsl2rgbHelper(nVal2,
+ nVal1,
+ h),
+ hsl2rgbHelper(nVal2,
+ nVal1,
+ h - 120.0) );
+ }
+
+ BColor rgb2hsv(const BColor& rRGBColor)
+ {
+ const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue();
+ const double maxVal = std::max(std::max(r,g),b);
+ const double minVal = std::min(std::min(r,g),b);
+ const double delta = maxVal-minVal;
+
+ double h=0, s=0, v=0;
+
+ v = maxVal;
+ if( fTools::equalZero(v) )
+ s = 0;
+ else
+ s = delta / v;
+
+ if( !fTools::equalZero(s) )
+ {
+ if( maxVal == r )
+ {
+ h = (g - b) / delta;
+ }
+ else if( maxVal == g )
+ {
+ h = 2.0 + (b - r) / delta;
+ }
+ else
+ {
+ h = 4.0 + (r - g) / delta;
+ }
+
+ h *= 60.0;
+
+ if( h < 0 )
+ h += 360;
+ }
+
+ return BColor(h,s,v);
+ }
+
+ BColor hsv2rgb(const BColor& rHSVColor)
+ {
+ double h=rHSVColor.getRed();
+ const double s=rHSVColor.getGreen(), v=rHSVColor.getBlue();
+
+ if( fTools::equalZero(s) )
+ {
+ // achromatic case: no hue.
+ return BColor(v,v,v);
+ }
+ else
+ {
+ if( fTools::equal(h,360) )
+ h = 0; // 360 degrees is equivalent to 0 degrees
+
+ h /= 60.0;
+ const sal_Int32 intval = static_cast< sal_Int32 >( h );
+ const double f = h - intval;
+ const double p = v*(1.0-s);
+ const double q = v*(1.0-(s*f));
+ const double t = v*(1.0-(s*(1.0-f)));
+
+ /* which hue area? */
+ switch( intval )
+ {
+ case 0:
+ return BColor(v,t,p);
+
+ case 1:
+ return BColor(q,v,p);
+
+ case 2:
+ return BColor(p,v,t);
+
+ case 3:
+ return BColor(p,q,v);
+
+ case 4:
+ return BColor(t,p,v);
+
+ case 5:
+ return BColor(v,p,q);
+
+ default:
+ // hue overflow
+ return BColor();
+ }
+ }
+ }
+
+ BColor rgb2yiq(const BColor& rRGBColor)
+ {
+ // from Foley, van Dam, Computer Graphics
+ const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue();
+ return BColor(
+ 0.299*r + 0.587*g + 0.114*b,
+ 0.596*r - 0.274*g - 0.322*b,
+ 0.211*r - 0.522*g + 0.311*b);
+ }
+
+ BColor yiq2rgb(const BColor& rYIQColor)
+ {
+ // from Foley, van Dam, Computer Graphics
+ const double y=rYIQColor.getRed(), i=rYIQColor.getGreen(), q=rYIQColor.getBlue();
+ return BColor(
+ y + 0.956*i + 0.623*q,
+ y - 0.272*i - 0.648*q,
+ y - 1.105*i + 1.705*q );
+ }
+
+ BColor ciexyz2rgb( const BColor& rXYZColor )
+ {
+ // from Poynton color faq, and SMPTE RP 177-1993, Derivation
+ // of Basic Television Color Equations
+ const double x=rXYZColor.getRed(), y=rXYZColor.getGreen(), z=rXYZColor.getBlue();
+ return BColor(
+ 3.240479*x - 1.53715*y - 0.498535*z,
+ -0.969256*x + 1.875991*y + 0.041556*z,
+ 0.055648*x - 0.204043*y + 1.057311*z );
+ }
+
+ BColor rgb2ciexyz( const BColor& rRGBColor )
+ {
+ // from Poynton color faq, and SMPTE RP 177-1993, Derivation
+ // of Basic Television Color Equations
+ const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue();
+ return BColor(
+ 0.412453*r + 0.35758*g + 0.180423*b,
+ 0.212671*r + 0.71516*g + 0.072169*b,
+ 0.019334*r + 0.119193*g + 0.950227*b);
+ }
+
+ BColor rgb2ypbpr(const BColor& rRGBColor)
+ {
+ const double r=rRGBColor.getRed(), g=rRGBColor.getGreen(), b=rRGBColor.getBlue();
+ return BColor(
+ 0.299*r + 0.587*g + 0.114*b,
+ -0.168736*r - 0.331264*g + 0.5*b,
+ 0.5*r - 0.418688*g - 0.081312*b);
+ }
+
+ BColor ypbpr2rgb(const BColor& rYPbPrColor)
+ {
+ const double y=rYPbPrColor.getRed(), pb=rYPbPrColor.getGreen(), pr=rYPbPrColor.getBlue();
+ return BColor(
+ 1.*y + 0.*pb + 1.402*pr,
+ 1.*y - 0.344136*pb - 0.714136*pr,
+ 1.*y + 1.772*pb + 0.*pr);
+ }
+
+} } // end of namespace basegfx
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/basegfx/source/color/makefile.mk b/basegfx/source/color/makefile.mk
index 9fd7970..77b91a8 100644
--- a/basegfx/source/color/makefile.mk
+++ b/basegfx/source/color/makefile.mk
@@ -45,6 +45,7 @@ TARGET=color
SLOFILES= \
$(SLO)$/bcolor.obj \
+ $(SLO)$/bcolortools.obj \
$(SLO)$/bcolormodifier.obj
# --- Targets ----------------------------------
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 660a19d..1bb14b8 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -43,6 +43,8 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2dmultirange.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <basegfx/color/bcolor.hxx>
+#include <basegfx/color/bcolortools.hxx>
#include <basegfx/tools/debugplotter.hxx>
@@ -1443,6 +1445,178 @@ public:
CPPUNIT_TEST_SUITE_END();
}; // class b2dvector
+class bcolor : public CppUnit::TestFixture
+{
+ BColor maWhite;
+ BColor maBlack;
+ BColor maRed;
+ BColor maGreen;
+ BColor maBlue;
+ BColor maYellow;
+ BColor maMagenta;
+ BColor maCyan;
+
+public:
+ bcolor() :
+ maWhite(1,1,1),
+ maBlack(0,0,0),
+ maRed(1,0,0),
+ maGreen(0,1,0),
+ maBlue(0,0,1),
+ maYellow(1,1,0),
+ maMagenta(1,0,1),
+ maCyan(0,1,1)
+ {}
+
+
+ // initialise your test code values here.
+ void setUp()
+ {
+ }
+
+ void tearDown()
+ {
+ }
+
+ // insert your test code here.
+ void hslTest()
+ {
+ CPPUNIT_ASSERT_MESSAGE("white",
+ tools::rgb2hsl(maWhite) == BColor(0,0,1));
+ CPPUNIT_ASSERT_MESSAGE("black",
+ tools::rgb2hsl(maBlack) == BColor(0,0,0));
+ CPPUNIT_ASSERT_MESSAGE("red",
+ tools::rgb2hsl(maRed) == BColor(0,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("green",
+ tools::rgb2hsl(maGreen) == BColor(120,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("blue",
+ tools::rgb2hsl(maBlue) == BColor(240,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("yellow",
+ tools::rgb2hsl(maYellow) == BColor(60,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("magenta",
+ tools::rgb2hsl(maMagenta) == BColor(300,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("cyan",
+ tools::rgb2hsl(maCyan) == BColor(180,1,0.5));
+
+ CPPUNIT_ASSERT_MESSAGE("roundtrip white",
+ tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip black",
+ tools::hsl2rgb(tools::rgb2hsl(maBlack)) == maBlack);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip red",
+ tools::hsl2rgb(tools::rgb2hsl(maRed)) == maRed);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip green",
+ tools::hsl2rgb(tools::rgb2hsl(maGreen)) == maGreen);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip blue",
+ tools::hsl2rgb(tools::rgb2hsl(maBlue)) == maBlue);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip yellow",
+ tools::hsl2rgb(tools::rgb2hsl(maYellow)) == maYellow);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip magenta",
+ tools::hsl2rgb(tools::rgb2hsl(maMagenta)) == maMagenta);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip cyan",
+ tools::hsl2rgb(tools::rgb2hsl(maCyan)) == maCyan);
+
+ CPPUNIT_ASSERT_MESSAGE("grey10",
+ tools::rgb2hsl(maWhite*.1) == BColor(0,0,.1));
+ CPPUNIT_ASSERT_MESSAGE("grey90",
+ tools::rgb2hsl(maWhite*.9) == BColor(0,0,.9));
+ CPPUNIT_ASSERT_MESSAGE("red/2",
+ tools::rgb2hsl(maRed*.5) == BColor(0,1,0.25));
+ CPPUNIT_ASSERT_MESSAGE("green/2",
+ tools::rgb2hsl(maGreen*.5) == BColor(120,1,0.25));
+ CPPUNIT_ASSERT_MESSAGE("blue/2",
+ tools::rgb2hsl(maBlue*.5) == BColor(240,1,0.25));
+ CPPUNIT_ASSERT_MESSAGE("yellow/2",
+ tools::rgb2hsl(maYellow*.5) == BColor(60,1,0.25));
+ CPPUNIT_ASSERT_MESSAGE("magenta/2",
+ tools::rgb2hsl(maMagenta*.5) == BColor(300,1,0.25));
+ CPPUNIT_ASSERT_MESSAGE("cyan/2",
+ tools::rgb2hsl(maCyan*.5) == BColor(180,1,0.25));
+
+ CPPUNIT_ASSERT_MESSAGE("pastel",
+ tools::rgb2hsl(BColor(.75,.25,.25)) == BColor(0,.5,.5));
+ }
+
+ // insert your test code here.
+ void hsvTest()
+ {
+ CPPUNIT_ASSERT_MESSAGE("white",
+ tools::rgb2hsv(maWhite) == BColor(0,0,1));
+ CPPUNIT_ASSERT_MESSAGE("black",
+ tools::rgb2hsv(maBlack) == BColor(0,0,0));
+ CPPUNIT_ASSERT_MESSAGE("red",
+ tools::rgb2hsv(maRed) == BColor(0,1,1));
+ CPPUNIT_ASSERT_MESSAGE("green",
+ tools::rgb2hsv(maGreen) == BColor(120,1,1));
+ CPPUNIT_ASSERT_MESSAGE("blue",
+ tools::rgb2hsv(maBlue) == BColor(240,1,1));
+ CPPUNIT_ASSERT_MESSAGE("yellow",
+ tools::rgb2hsv(maYellow) == BColor(60,1,1));
+ CPPUNIT_ASSERT_MESSAGE("magenta",
+ tools::rgb2hsv(maMagenta) == BColor(300,1,1));
+ CPPUNIT_ASSERT_MESSAGE("cyan",
+ tools::rgb2hsv(maCyan) == BColor(180,1,1));
+
+ CPPUNIT_ASSERT_MESSAGE("roundtrip white",
+ tools::hsv2rgb(tools::rgb2hsv(maWhite)) == maWhite);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip black",
+ tools::hsv2rgb(tools::rgb2hsv(maBlack)) == maBlack);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip red",
+ tools::hsv2rgb(tools::rgb2hsv(maRed)) == maRed);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip green",
+ tools::hsv2rgb(tools::rgb2hsv(maGreen)) == maGreen);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip blue",
+ tools::hsv2rgb(tools::rgb2hsv(maBlue)) == maBlue);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip yellow",
+ tools::hsv2rgb(tools::rgb2hsv(maYellow)) == maYellow);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip magenta",
+ tools::hsv2rgb(tools::rgb2hsv(maMagenta)) == maMagenta);
+ CPPUNIT_ASSERT_MESSAGE("roundtrip cyan",
+ tools::hsv2rgb(tools::rgb2hsv(maCyan)) == maCyan);
+
+ CPPUNIT_ASSERT_MESSAGE("grey10",
+ tools::rgb2hsv(maWhite*.1) == BColor(0,0,.1));
+ CPPUNIT_ASSERT_MESSAGE("grey90",
+ tools::rgb2hsv(maWhite*.9) == BColor(0,0,.9));
+ CPPUNIT_ASSERT_MESSAGE("red/2",
+ tools::rgb2hsv(maRed*.5) == BColor(0,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("green/2",
+ tools::rgb2hsv(maGreen*.5) == BColor(120,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("blue/2",
+ tools::rgb2hsv(maBlue*.5) == BColor(240,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("yellow/2",
+ tools::rgb2hsv(maYellow*.5) == BColor(60,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("magenta/2",
+ tools::rgb2hsv(maMagenta*.5) == BColor(300,1,0.5));
+ CPPUNIT_ASSERT_MESSAGE("cyan/2",
+ tools::rgb2hsv(maCyan*.5) == BColor(180,1,0.5));
+
+ CPPUNIT_ASSERT_MESSAGE("pastel",
+ tools::rgb2hsv(BColor(.5,.25,.25)) == BColor(0,.5,.5));
+ }
+
+ void ciexyzTest()
+ {
+ tools::rgb2ciexyz(maWhite);
+ tools::rgb2ciexyz(maBlack);
+ tools::rgb2ciexyz(maRed);
+ tools::rgb2ciexyz(maGreen);
+ tools::rgb2ciexyz(maBlue);
+ tools::rgb2ciexyz(maYellow);
+ tools::rgb2ciexyz(maMagenta);
+ tools::rgb2ciexyz(maCyan);
+ }
+
+ // Change the following lines only, if you add, remove or rename
+ // member functions of the current class,
+ // because these macros are need by auto register mechanism.
+
+ CPPUNIT_TEST_SUITE(bcolor);
+ CPPUNIT_TEST(hslTest);
+ CPPUNIT_TEST(hsvTest);
+ CPPUNIT_TEST(ciexyzTest);
+ CPPUNIT_TEST_SUITE_END();
+}; // class b2dvector
+
// -----------------------------------------------------------------------------
//CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d");
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex, "basegfx2d");
@@ -1458,6 +1632,7 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dquadraticbezier, "basegfx2d"
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2drange, "basegfx2d");
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dtuple, "basegfx2d");
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dvector, "basegfx2d");
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::bcolor, "basegfx2d");
} // namespace basegfx2d
diff --git a/basegfx/test/makefile.mk b/basegfx/test/makefile.mk
index 8e47a13..1bd4d59 100644
--- a/basegfx/test/makefile.mk
+++ b/basegfx/test/makefile.mk
@@ -58,6 +58,7 @@ SHL1LIBS=\
$(SLB)$/range.lib \
$(SLB)$/tuple.lib \
$(SLB)$/tools.lib \
+ $(SLB)$/color.lib \
$(SLB)$/vector.lib
SHL1TARGET= basegfx_tests
diff --git a/svtools/source/filter.vcl/wmf/wmfwr.cxx b/svtools/source/filter.vcl/wmf/wmfwr.cxx
index 8735c58..dbf6ead 100644
--- a/svtools/source/filter.vcl/wmf/wmfwr.cxx
+++ b/svtools/source/filter.vcl/wmf/wmfwr.cxx
@@ -438,16 +438,7 @@ void WMFWriter::WMFRecord_CreateFontIndirect(const Font & rFont)
BYTE nPitchFamily;
WriteRecordHeader(0x00000000,W_META_CREATEFONTINDIRECT);
-
- if ( !rFont.GetSize().Width() )
- {
- VirtualDevice aDev;
- FontMetric aMetric( aDev.GetFontMetric( rFont ) );
- WriteHeightWidth(Size(aMetric.GetWidth(),-rFont.GetSize().Height()));
- }
- else
- WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height()));
-
+ WriteHeightWidth(Size(rFont.GetSize().Width(),-rFont.GetSize().Height()));
*pWMF << (short)rFont.GetOrientation() << (short)rFont.GetOrientation();
switch (rFont.GetWeight()) {
More information about the ooo-build-commit
mailing list