merged tag ooo/OOO330_m14
[LibreOffice.git] / basegfx / source / tools / canvastools.cxx
blob2192148461dcdd560e24e641b6ba2e92cad24ec4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_basegfx.hxx"
31 #include <com/sun/star/geometry/RealSize2D.hpp>
32 #include <com/sun/star/geometry/RealPoint2D.hpp>
33 #include <com/sun/star/geometry/RealRectangle2D.hpp>
34 #include <com/sun/star/geometry/RealRectangle3D.hpp>
35 #include <com/sun/star/geometry/RealBezierSegment2D.hpp>
36 #include <com/sun/star/geometry/AffineMatrix2D.hpp>
37 #include <com/sun/star/geometry/AffineMatrix3D.hpp>
38 #include <com/sun/star/geometry/Matrix2D.hpp>
39 #include <com/sun/star/geometry/IntegerSize2D.hpp>
40 #include <com/sun/star/geometry/IntegerPoint2D.hpp>
41 #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
42 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
43 #include <com/sun/star/rendering/XGraphicDevice.hpp>
44 #include <com/sun/star/awt/Size.hpp>
45 #include <com/sun/star/awt/Point.hpp>
46 #include <com/sun/star/awt/Rectangle.hpp>
47 #include <basegfx/tools/unopolypolygon.hxx>
48 #include <basegfx/matrix/b2dhommatrix.hxx>
49 #include <basegfx/matrix/b3dhommatrix.hxx>
50 #include <basegfx/vector/b2dsize.hxx>
51 #include <basegfx/point/b2dpoint.hxx>
52 #include <basegfx/range/b2drectangle.hxx>
53 #include <basegfx/range/b3drange.hxx>
54 #include <basegfx/vector/b2isize.hxx>
55 #include <basegfx/point/b2ipoint.hxx>
56 #include <basegfx/range/b2irectangle.hxx>
57 #include <basegfx/polygon/b2dpolygon.hxx>
58 #include <basegfx/polygon/b2dpolypolygon.hxx>
59 #include <basegfx/tools/canvastools.hxx>
60 #include <limits>
62 using namespace ::com::sun::star;
64 namespace basegfx
67 namespace unotools
69 namespace
71 uno::Sequence< geometry::RealBezierSegment2D > bezierSequenceFromB2DPolygon(const ::basegfx::B2DPolygon& rPoly)
73 const sal_uInt32 nPointCount(rPoly.count());
74 uno::Sequence< geometry::RealBezierSegment2D > outputSequence(nPointCount);
75 geometry::RealBezierSegment2D* pOutput = outputSequence.getArray();
77 // fill sequences and imply clodes polygon on this implementation layer
78 for(sal_uInt32 a(0); a < nPointCount; a++)
80 const basegfx::B2DPoint aStart(rPoly.getB2DPoint(a));
81 const basegfx::B2DPoint aControlA(rPoly.getNextControlPoint(a));
82 const basegfx::B2DPoint aControlB(rPoly.getPrevControlPoint((a + 1) % nPointCount));
84 pOutput[a] = geometry::RealBezierSegment2D(
85 aStart.getX(), aStart.getY(),
86 aControlA.getX(), aControlA.getY(),
87 aControlB.getX(), aControlB.getY());
90 return outputSequence;
93 uno::Sequence< geometry::RealPoint2D > pointSequenceFromB2DPolygon( const ::basegfx::B2DPolygon& rPoly )
95 const sal_uInt32 nNumPoints( rPoly.count() );
97 uno::Sequence< geometry::RealPoint2D > outputSequence( nNumPoints );
98 geometry::RealPoint2D* pOutput = outputSequence.getArray();
100 // fill sequence from polygon
101 sal_uInt32 i;
102 for( i=0; i<nNumPoints; ++i )
104 const ::basegfx::B2DPoint aPoint( rPoly.getB2DPoint(i) );
106 pOutput[i] = geometry::RealPoint2D( aPoint.getX(),
107 aPoint.getY() );
110 return outputSequence;
114 //---------------------------------------------------------------------------------------
116 uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
118 const sal_uInt32 nNumPolies( rPolyPoly.count() );
119 sal_uInt32 i;
121 uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > outputSequence( nNumPolies );
122 uno::Sequence< geometry::RealBezierSegment2D >* pOutput = outputSequence.getArray();
124 for( i=0; i<nNumPolies; ++i )
126 pOutput[i] = bezierSequenceFromB2DPolygon( rPolyPoly.getB2DPolygon(i) );
129 return outputSequence;
132 //---------------------------------------------------------------------------------------
134 uno::Sequence< uno::Sequence< geometry::RealPoint2D > > pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
136 const sal_uInt32 nNumPolies( rPolyPoly.count() );
137 sal_uInt32 i;
139 uno::Sequence< uno::Sequence< geometry::RealPoint2D > > outputSequence( nNumPolies );
140 uno::Sequence< geometry::RealPoint2D >* pOutput = outputSequence.getArray();
142 for( i=0; i<nNumPolies; ++i )
144 pOutput[i] = pointSequenceFromB2DPolygon( rPolyPoly.getB2DPolygon(i) );
147 return outputSequence;
150 //---------------------------------------------------------------------------------------
152 uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolygon( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice,
153 const ::basegfx::B2DPolygon& rPoly )
155 uno::Reference< rendering::XPolyPolygon2D > xRes;
157 if( !xGraphicDevice.is() )
158 return xRes;
160 if( rPoly.areControlPointsUsed() )
162 uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > > outputSequence( 1 );
163 outputSequence[0] = bezierSequenceFromB2DPolygon( rPoly );
165 xRes.set( xGraphicDevice->createCompatibleBezierPolyPolygon( outputSequence ),
166 uno::UNO_QUERY );
168 else
170 uno::Sequence< uno::Sequence< geometry::RealPoint2D > > outputSequence( 1 );
171 outputSequence[0] = pointSequenceFromB2DPolygon( rPoly );
173 xRes.set( xGraphicDevice->createCompatibleLinePolyPolygon( outputSequence ),
174 uno::UNO_QUERY );
177 if( xRes.is() && rPoly.isClosed() )
178 xRes->setClosed( 0, sal_True );
180 return xRes;
183 //---------------------------------------------------------------------------------------
185 uno::Reference< rendering::XPolyPolygon2D > xPolyPolygonFromB2DPolyPolygon( const uno::Reference< rendering::XGraphicDevice >& xGraphicDevice,
186 const ::basegfx::B2DPolyPolygon& rPolyPoly )
188 uno::Reference< rendering::XPolyPolygon2D > xRes;
190 if( !xGraphicDevice.is() )
191 return xRes;
193 const sal_uInt32 nNumPolies( rPolyPoly.count() );
194 sal_uInt32 i;
196 if( rPolyPoly.areControlPointsUsed() )
198 xRes.set( xGraphicDevice->createCompatibleBezierPolyPolygon(
199 bezierSequenceSequenceFromB2DPolyPolygon( rPolyPoly ) ),
200 uno::UNO_QUERY );
202 else
204 xRes.set( xGraphicDevice->createCompatibleLinePolyPolygon(
205 pointSequenceSequenceFromB2DPolyPolygon( rPolyPoly ) ),
206 uno::UNO_QUERY );
209 for( i=0; i<nNumPolies; ++i )
211 xRes->setClosed( i, rPolyPoly.getB2DPolygon(i).isClosed() );
214 return xRes;
217 //---------------------------------------------------------------------------------------
219 ::basegfx::B2DPolygon polygonFromPoint2DSequence( const uno::Sequence< geometry::RealPoint2D >& points )
221 const sal_Int32 nCurrSize( points.getLength() );
223 ::basegfx::B2DPolygon aPoly;
225 for( sal_Int32 nCurrPoint=0; nCurrPoint<nCurrSize; ++nCurrPoint )
226 aPoly.append( b2DPointFromRealPoint2D( points[nCurrPoint] ) );
228 return aPoly;
231 //---------------------------------------------------------------------------------------
233 ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence( const uno::Sequence< uno::Sequence< geometry::RealPoint2D > >& points )
235 ::basegfx::B2DPolyPolygon aRes;
237 for( sal_Int32 nCurrPoly=0; nCurrPoly<points.getLength(); ++nCurrPoly )
239 aRes.append( polygonFromPoint2DSequence( points[nCurrPoly] ) );
242 return aRes;
245 //---------------------------------------------------------------------------------------
247 ::basegfx::B2DPolygon polygonFromBezier2DSequence( const uno::Sequence< geometry::RealBezierSegment2D >& curves )
249 const sal_Int32 nSize(curves.getLength());
250 basegfx::B2DPolygon aRetval;
252 if(nSize)
254 // prepare start with providing a start point. Use the first point from
255 // the sequence for this
256 const geometry::RealBezierSegment2D& rFirstSegment(curves[0]); // #i79917# first segment, not last
257 aRetval.append(basegfx::B2DPoint(rFirstSegment.Px, rFirstSegment.Py));
259 for(sal_Int32 a(0); a < nSize; a++)
261 const geometry::RealBezierSegment2D& rCurrSegment(curves[a]);
262 const geometry::RealBezierSegment2D& rNextSegment(curves[(a + 1) % nSize]);
264 // append curved edge with the control points and the next point
265 aRetval.appendBezierSegment(
266 basegfx::B2DPoint(rCurrSegment.C1x, rCurrSegment.C1y),
267 basegfx::B2DPoint(rCurrSegment.C2x, rCurrSegment.C2y), // #i79917# Argh! An x for an y!!
268 basegfx::B2DPoint(rNextSegment.Px, rNextSegment.Py));
271 // rescue the control point and remove the now double-added point
272 aRetval.setPrevControlPoint(0, aRetval.getPrevControlPoint(aRetval.count() - 1));
273 aRetval.remove(aRetval.count() - 1);
276 return aRetval;
279 //---------------------------------------------------------------------------------------
281 ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence( const uno::Sequence< uno::Sequence< geometry::RealBezierSegment2D > >& curves )
283 ::basegfx::B2DPolyPolygon aRes;
285 for( sal_Int32 nCurrPoly=0; nCurrPoly<curves.getLength(); ++nCurrPoly )
287 aRes.append( polygonFromBezier2DSequence( curves[nCurrPoly] ) );
290 return aRes;
293 //---------------------------------------------------------------------------------------
295 ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D( const uno::Reference< rendering::XPolyPolygon2D >& xPoly )
297 ::basegfx::unotools::UnoPolyPolygon* pPolyImpl =
298 dynamic_cast< ::basegfx::unotools::UnoPolyPolygon* >( xPoly.get() );
300 if( pPolyImpl )
302 return pPolyImpl->getPolyPolygon();
304 else
306 // not a known implementation object - try data source
307 // interfaces
308 const sal_Int32 nPolys( xPoly->getNumberOfPolygons() );
310 uno::Reference< rendering::XBezierPolyPolygon2D > xBezierPoly(
311 xPoly,
312 uno::UNO_QUERY );
314 if( xBezierPoly.is() )
316 return ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence(
317 xBezierPoly->getBezierSegments( 0,
318 nPolys,
320 -1 ) );
322 else
324 uno::Reference< rendering::XLinePolyPolygon2D > xLinePoly(
325 xPoly,
326 uno::UNO_QUERY );
328 // no implementation class and no data provider
329 // found - contract violation.
330 if( !xLinePoly.is() )
332 throw lang::IllegalArgumentException(
333 ::rtl::OUString::createFromAscii(
334 "basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(): Invalid input"
335 "poly-polygon, cannot retrieve vertex data"),
336 uno::Reference< uno::XInterface >(),
337 0 );
340 return ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence(
341 xLinePoly->getPoints( 0,
342 nPolys,
344 -1 ));
349 //---------------------------------------------------------------------------------------
351 ::basegfx::B2DHomMatrix& homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& output,
352 const geometry::AffineMatrix2D& input )
354 // ensure last row is [0,0,1] (and optimized away)
355 output.identity();
357 output.set(0,0, input.m00);
358 output.set(0,1, input.m01);
359 output.set(0,2, input.m02);
360 output.set(1,0, input.m10);
361 output.set(1,1, input.m11);
362 output.set(1,2, input.m12);
364 return output;
367 ::basegfx::B2DHomMatrix homMatrixFromAffineMatrix( const geometry::AffineMatrix2D& input )
369 ::basegfx::B2DHomMatrix output;
371 output.set(0,0, input.m00);
372 output.set(0,1, input.m01);
373 output.set(0,2, input.m02);
374 output.set(1,0, input.m10);
375 output.set(1,1, input.m11);
376 output.set(1,2, input.m12);
378 return output;
381 ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& input )
383 ::basegfx::B3DHomMatrix output;
385 output.set(0,0, input.m00);
386 output.set(0,1, input.m01);
387 output.set(0,2, input.m02);
388 output.set(0,3, input.m03);
390 output.set(1,0, input.m10);
391 output.set(1,1, input.m11);
392 output.set(1,2, input.m12);
393 output.set(1,3, input.m13);
395 output.set(2,0, input.m20);
396 output.set(2,1, input.m21);
397 output.set(2,2, input.m22);
398 output.set(2,3, input.m23);
400 return output;
403 geometry::AffineMatrix2D& affineMatrixFromHomMatrix( geometry::AffineMatrix2D& output,
404 const ::basegfx::B2DHomMatrix& input)
406 output.m00 = input.get(0,0);
407 output.m01 = input.get(0,1);
408 output.m02 = input.get(0,2);
409 output.m10 = input.get(1,0);
410 output.m11 = input.get(1,1);
411 output.m12 = input.get(1,2);
413 return output;
416 geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D(
417 geometry::AffineMatrix3D& output,
418 const ::basegfx::B3DHomMatrix& input)
420 output.m00 = input.get(0,0);
421 output.m01 = input.get(0,1);
422 output.m02 = input.get(0,2);
423 output.m03 = input.get(0,3);
425 output.m10 = input.get(1,0);
426 output.m11 = input.get(1,1);
427 output.m12 = input.get(1,2);
428 output.m13 = input.get(1,3);
430 output.m20 = input.get(2,0);
431 output.m21 = input.get(2,1);
432 output.m22 = input.get(2,2);
433 output.m23 = input.get(2,3);
435 return output;
438 //---------------------------------------------------------------------------------------
440 ::basegfx::B2DHomMatrix& homMatrixFromMatrix( ::basegfx::B2DHomMatrix& output,
441 const geometry::Matrix2D& input )
443 // ensure last row is [0,0,1] (and optimized away)
444 output.identity();
446 output.set(0,0, input.m00);
447 output.set(0,1, input.m01);
448 output.set(1,0, input.m10);
449 output.set(1,1, input.m11);
451 return output;
454 //---------------------------------------------------------------------------------------
456 geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& rVec )
458 return geometry::RealSize2D( rVec.getX(),
459 rVec.getY() );
462 geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& rPoint )
464 return geometry::RealPoint2D( rPoint.getX(),
465 rPoint.getY() );
468 geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& rRect )
470 return geometry::RealRectangle2D( rRect.getMinX(),
471 rRect.getMinY(),
472 rRect.getMaxX(),
473 rRect.getMaxY() );
476 geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& rRect )
478 return geometry::RealRectangle3D( rRect.getMinX(),
479 rRect.getMinY(),
480 rRect.getMinZ(),
481 rRect.getMaxX(),
482 rRect.getMaxY(),
483 rRect.getMaxZ());
486 ::basegfx::B2DVector b2DSizeFromRealSize2D( const geometry::RealSize2D& rSize )
488 return ::basegfx::B2DVector( rSize.Width,
489 rSize.Height );
492 ::basegfx::B2DPoint b2DPointFromRealPoint2D( const geometry::RealPoint2D& rPoint )
494 return ::basegfx::B2DPoint( rPoint.X,
495 rPoint.Y );
498 ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const geometry::RealRectangle2D& rRect )
500 return ::basegfx::B2DRange( rRect.X1,
501 rRect.Y1,
502 rRect.X2,
503 rRect.Y2 );
506 ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const geometry::RealRectangle3D& rRect )
508 return ::basegfx::B3DRange( rRect.X1,
509 rRect.Y1,
510 rRect.Z1,
511 rRect.X2,
512 rRect.Y2,
513 rRect.Z2);
516 geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& rSize )
518 return geometry::IntegerSize2D( rSize.getX(),
519 rSize.getY() );
522 geometry::IntegerPoint2D integerPoint2DFromB2IPoint( const ::basegfx::B2IPoint& rPoint )
524 return geometry::IntegerPoint2D( rPoint.getX(),
525 rPoint.getY() );
528 geometry::IntegerRectangle2D integerRectangle2DFromB2IRectangle( const ::basegfx::B2IRange& rRectangle )
530 return geometry::IntegerRectangle2D( rRectangle.getMinX(), rRectangle.getMinY(),
531 rRectangle.getMaxX(), rRectangle.getMaxY() );
534 ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const geometry::IntegerSize2D& rSize )
536 return ::basegfx::B2IVector( rSize.Width,
537 rSize.Height );
540 ::basegfx::B2IPoint b2IPointFromIntegerPoint2D( const geometry::IntegerPoint2D& rPoint )
542 return ::basegfx::B2IPoint( rPoint.X,
543 rPoint.Y );
546 ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const geometry::IntegerRectangle2D& rRectangle )
548 return ::basegfx::B2IRange( rRectangle.X1, rRectangle.Y1,
549 rRectangle.X2, rRectangle.Y2 );
552 awt::Size awtSizeFromB2ISize( const ::basegfx::B2IVector& rVec )
554 return awt::Size( rVec.getX(),
555 rVec.getY() );
558 awt::Point awtPointFromB2IPoint( const ::basegfx::B2IPoint& rPoint )
560 return awt::Point( rPoint.getX(),
561 rPoint.getY() );
564 awt::Rectangle awtRectangleFromB2IRectangle( const ::basegfx::B2IRange& rRect )
566 OSL_ENSURE( rRect.getWidth() < ::std::numeric_limits< sal_Int32 >::max() &&
567 rRect.getWidth() > ::std::numeric_limits< sal_Int32 >::min(),
568 "awtRectangleFromB2IRectangle(): width overflow" );
569 OSL_ENSURE( rRect.getHeight() < ::std::numeric_limits< sal_Int32 >::max() &&
570 rRect.getHeight() > ::std::numeric_limits< sal_Int32 >::min(),
571 "awtRectangleFromB2IRectangle(): height overflow" );
573 return awt::Rectangle( rRect.getMinX(),
574 rRect.getMinY(),
575 static_cast< sal_Int32 >(rRect.getWidth()),
576 static_cast< sal_Int32 >(rRect.getHeight()) );
579 ::basegfx::B2IVector b2ISizeFromAwtSize( const awt::Size& rSize )
581 return ::basegfx::B2IVector( rSize.Width,
582 rSize.Height );
585 ::basegfx::B2IPoint b2IPointFromAwtPoint( const awt::Point& rPoint )
587 return ::basegfx::B2IPoint( rPoint.X,
588 rPoint.Y );
591 ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const awt::Rectangle& rRect )
593 return ::basegfx::B2IRange( rRect.X,
594 rRect.Y,
595 rRect.X + rRect.Width,
596 rRect.Y + rRect.Height );
599 ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange )
601 return ::basegfx::B2IRange( static_cast<sal_Int32>( floor(rRange.getMinX()) ),
602 static_cast<sal_Int32>( floor(rRange.getMinY()) ),
603 static_cast<sal_Int32>( ceil(rRange.getMaxX()) ),
604 static_cast<sal_Int32>( ceil(rRange.getMaxY()) ) );
607 ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange )
609 return ::basegfx::B2DRange( floor(rRange.getMinX()),
610 floor(rRange.getMinY()),
611 ceil(rRange.getMaxX()),
612 ceil(rRange.getMaxY()) );
615 // Geometry comparisons
616 // ===================================================================
618 bool RealSize2DAreEqual( const ::com::sun::star::geometry::RealSize2D& rA, const ::com::sun::star::geometry::RealSize2D& rB )
620 return (rA.Width == rB.Width && rA.Height == rB.Height);
623 bool RealPoint2DAreEqual( const ::com::sun::star::geometry::RealPoint2D& rA, const ::com::sun::star::geometry::RealPoint2D& rB )
625 return (rA.X == rB.X && rA.Y == rB.Y);
628 bool RealRectangle2DAreEqual( const ::com::sun::star::geometry::RealRectangle2D& rA, const ::com::sun::star::geometry::RealRectangle2D& rB )
630 return (rA.X1 == rB.X1 && rA.Y1 == rB.Y1 && rA.X2 == rB.X2 && rA.Y2 == rB.Y2);
633 bool RealRectangle3DAreEqual( const ::com::sun::star::geometry::RealRectangle3D& rA, const ::com::sun::star::geometry::RealRectangle3D& rB )
635 return (rA.X1 == rB.X1 && rA.Y1 == rB.Y1 && rA.Z1 == rB.Z1 && rA.X2 == rB.X2 && rA.Y2 == rB.Y2 && rA.Z2 == rB.Z2);
638 bool AffineMatrix2DAreEqual( const ::com::sun::star::geometry::AffineMatrix2D& rA, const ::com::sun::star::geometry::AffineMatrix2D& rB )
640 return (rA.m00 == rB.m00 && rA.m01 == rB.m01 && rA.m02 == rB.m02 && rA.m10 == rB.m10 && rA.m11 == rB.m11 && rA.m12 == rB.m12);
643 bool IntegerSize2DAreEqual( const ::com::sun::star::geometry::IntegerSize2D& rA, const ::com::sun::star::geometry::IntegerSize2D& rB )
645 return (rA.Width == rB.Width && rA.Height == rB.Height);
648 bool IntegerPoint2DAreEqual( const ::com::sun::star::geometry::IntegerPoint2D& rA, const ::com::sun::star::geometry::IntegerPoint2D& rB )
650 return (rA.X == rB.X && rA.Y == rB.Y);
653 bool IntegerRectangle2DAreEqual( const ::com::sun::star::geometry::IntegerRectangle2D& rA, const ::com::sun::star::geometry::IntegerRectangle2D& rB )
655 return (rA.X1 == rB.X1 && rA.Y1 == rB.Y1 && rA.X2 == rB.X2 && rA.Y2 == rB.Y2);
658 bool awtSizeAreEqual( const ::com::sun::star::awt::Size& rA, const ::com::sun::star::awt::Size& rB )
660 return (rA.Width == rB.Width && rA.Height == rB.Height);
663 bool awtPointAreEqual( const ::com::sun::star::awt::Point& rA, const ::com::sun::star::awt::Point& rB )
665 return (rA.X == rB.X && rA.Y == rB.Y);
668 bool awtRectangleAreEqual( const ::com::sun::star::awt::Rectangle& rA, const ::com::sun::star::awt::Rectangle& rB )
670 return (rA.X == rB.X && rA.Y == rB.Y && rA.Width == rB.Width && rA.Height == rB.Height);
672 } // namespace bgfxtools
674 } // namespace canvas