diff options
Diffstat (limited to 'basegfx/inc/basegfx/tools')
-rw-r--r-- | basegfx/inc/basegfx/tools/b2dclipstate.hxx | 120 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/canvastools.hxx | 225 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/debugplotter.hxx | 111 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/gradienttools.hxx | 414 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/keystoplerp.hxx | 101 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/lerp.hxx | 60 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/rectcliptools.hxx | 91 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/tools.hxx | 135 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/unopolypolygon.hxx | 116 | ||||
-rw-r--r-- | basegfx/inc/basegfx/tools/unotools.hxx | 55 |
10 files changed, 0 insertions, 1428 deletions
diff --git a/basegfx/inc/basegfx/tools/b2dclipstate.hxx b/basegfx/inc/basegfx/tools/b2dclipstate.hxx deleted file mode 100644 index 236b81c0d2..0000000000 --- a/basegfx/inc/basegfx/tools/b2dclipstate.hxx +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * 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_TOOLS_CLIPSTATE_HXX -#define _BGFX_TOOLS_CLIPSTATE_HXX - -#include <sal/types.h> -#include <o3tl/cow_wrapper.hxx> -#include <basegfx/basegfxdllapi.h> - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - class B2DRange; - class B2DPolyRange; - class B2DPolygon; - class B2DPolyPolygon; - - namespace tools - { - class ImplB2DClipState; - - /** This class provides an optimized, symbolic clip state for graphical output - - Having a current 'clip' state is a common attribute of - almost all graphic output APIs, most of which internally - represent it via a list of rectangular bands. In contrast, - this implementation purely uses symbolic clips, but in a - quite efficient manner, deferring actual evaluation until - a clip representation is requested, and using faster code - paths for common special cases (like all-rectangle clips) - */ - class BASEGFX_DLLPUBLIC B2DClipState - { - public: - typedef o3tl::cow_wrapper< ImplB2DClipState > ImplType; - - private: - ImplType mpImpl; - - public: - /// Init clip, in 'cleared' state - everything is visible - B2DClipState(); - ~B2DClipState(); - B2DClipState( const B2DClipState& ); - explicit B2DClipState( const B2DRange& ); - explicit B2DClipState( const B2DPolygon& ); - explicit B2DClipState( const B2DPolyPolygon& ); - B2DClipState& operator=( const B2DClipState& ); - - /// unshare this poly-range with all internally shared instances - void makeUnique(); - - /// Set clip to 'null' - nothing is visible - void makeNull(); - /// returns true when clip is 'null' - nothing is visible - bool isNull() const; - - /// Set clip 'cleared' - everything is visible - void makeClear(); - /// returns true when clip is 'cleared' - everything is visible - bool isCleared() const; - - bool operator==(const B2DClipState&) const; - bool operator!=(const B2DClipState&) const; - - void unionRange(const B2DRange& ); - void unionPolygon(const B2DPolygon& ); - void unionPolyPolygon(const B2DPolyPolygon& ); - void unionClipState(const B2DClipState& ); - - void intersectRange(const B2DRange& ); - void intersectPolygon(const B2DPolygon& ); - void intersectPolyPolygon(const B2DPolyPolygon& ); - void intersectClipState(const B2DClipState& ); - - void subtractRange(const B2DRange& ); - void subtractPolygon(const B2DPolygon& ); - void subtractPolyPolygon(const B2DPolyPolygon& ); - void subtractClipState(const B2DClipState& ); - - void xorRange(const B2DRange& ); - void xorPolygon(const B2DPolygon& ); - void xorPolyPolygon(const B2DPolyPolygon& ); - void xorClipState(const B2DClipState& ); - - B2DPolyPolygon getClipPoly() const; - }; - } -} - -#endif // _BGFX_TOOLS_CLIPSTATE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/canvastools.hxx b/basegfx/inc/basegfx/tools/canvastools.hxx deleted file mode 100644 index c3458c4657..0000000000 --- a/basegfx/inc/basegfx/tools/canvastools.hxx +++ /dev/null @@ -1,225 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_TOOLS_CANVASTOOLS_HXX -#define _BGFX_TOOLS_CANVASTOOLS_HXX - -#include <com/sun/star/uno/Reference.hxx> -#include <com/sun/star/uno/Sequence.hxx> -#include <basegfx/basegfxdllapi.h> - - -namespace com { namespace sun { namespace star { namespace geometry -{ - struct AffineMatrix2D; - struct AffineMatrix3D; - struct Matrix2D; - struct RealPoint2D; - struct RealSize2D; - struct RealRectangle2D; - struct RealRectangle3D; - struct IntegerPoint2D; - struct IntegerSize2D; - struct IntegerRectangle2D; - struct RealBezierSegment2D; -} } } } - -namespace com { namespace sun { namespace star { namespace rendering -{ - class XGraphicDevice; - class XPolyPolygon2D; -} } } } - -namespace com { namespace sun { namespace star { namespace awt -{ - struct Point; - struct Size; - struct Rectangle; -} } } } - -namespace basegfx -{ - class B2DHomMatrix; - class B3DHomMatrix; - class B2DVector; - class B2DPoint; - class B2DRange; - class B3DRange; - class B2IVector; - class B2IPoint; - class B2IRange; - class B2DPolygon; - class B2DPolyPolygon; - - namespace unotools - { - // Polygon conversions - // =================================================================== - - BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > - xPolyPolygonFromB2DPolygon( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, - const ::basegfx::B2DPolygon& rPoly ); - - BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D > - xPolyPolygonFromB2DPolyPolygon( const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XGraphicDevice >& xGraphicDevice, - const ::basegfx::B2DPolyPolygon& rPolyPoly ); - - - BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Sequence< - ::com::sun::star::geometry::RealBezierSegment2D > > - bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ); - - BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Sequence< - ::com::sun::star::geometry::RealPoint2D > > - pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon polygonFromPoint2DSequence( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::geometry::RealPoint2D >& rPoints ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromPoint2DSequenceSequence( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& rPoints ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon polygonFromBezier2DSequence( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::geometry::RealBezierSegment2D >& rPoints ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon polyPolygonFromBezier2DSequenceSequence( - const ::com::sun::star::uno::Sequence< - ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& rPoints ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon b2DPolyPolygonFromXPolyPolygon2D( - const ::com::sun::star::uno::Reference< - ::com::sun::star::rendering::XPolyPolygon2D >& rPoly ); - - // Matrix conversions - // =================================================================== - - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D& - affineMatrixFromHomMatrix( ::com::sun::star::geometry::AffineMatrix2D& matrix, - const ::basegfx::B2DHomMatrix& transform); - - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix3D& affineMatrixFromHomMatrix3D( - ::com::sun::star::geometry::AffineMatrix3D& matrix, - const ::basegfx::B3DHomMatrix& transform); - - BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix& - homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix& transform, - const ::com::sun::star::geometry::AffineMatrix2D& matrix ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix homMatrixFromAffineMatrix( const ::com::sun::star::geometry::AffineMatrix2D& matrix ); - BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D& matrix ); - - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::Matrix2D& - matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D& matrix, - const ::basegfx::B2DHomMatrix& transform); - - BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix& - homMatrixFromMatrix( ::basegfx::B2DHomMatrix& transform, - const ::com::sun::star::geometry::Matrix2D& matrix ); - - // Geometry conversions - // =================================================================== - - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealSize2D size2DFromB2DSize( const ::basegfx::B2DVector& ); - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealPoint2D point2DFromB2DPoint( const ::basegfx::B2DPoint& ); - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle2D rectangle2DFromB2DRectangle( const ::basegfx::B2DRange& ); - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle3D rectangle3DFromB3DRectangle( const ::basegfx::B3DRange& ); - - BASEGFX_DLLPUBLIC ::basegfx::B2DVector b2DSizeFromRealSize2D( const ::com::sun::star::geometry::RealSize2D& ); - BASEGFX_DLLPUBLIC ::basegfx::B2DPoint b2DPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D& ); - BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DRectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D& ); - BASEGFX_DLLPUBLIC ::basegfx::B3DRange b3DRectangleFromRealRectangle3D( const ::com::sun::star::geometry::RealRectangle3D& ); - - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::IntegerSize2D integerSize2DFromB2ISize( const ::basegfx::B2IVector& ); - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::IntegerPoint2D integerPoint2DFromB2IPoint( const ::basegfx::B2IPoint& ); - BASEGFX_DLLPUBLIC ::com::sun::star::geometry::IntegerRectangle2D integerRectangle2DFromB2IRectangle( const ::basegfx::B2IRange& ); - - BASEGFX_DLLPUBLIC ::basegfx::B2IVector b2ISizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D& ); - BASEGFX_DLLPUBLIC ::basegfx::B2IPoint b2IPointFromIntegerPoint2D( const ::com::sun::star::geometry::IntegerPoint2D& ); - BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D& ); - - BASEGFX_DLLPUBLIC ::com::sun::star::awt::Size awtSizeFromB2ISize( const ::basegfx::B2IVector& ); - BASEGFX_DLLPUBLIC ::com::sun::star::awt::Point awtPointFromB2IPoint( const ::basegfx::B2IPoint& ); - BASEGFX_DLLPUBLIC ::com::sun::star::awt::Rectangle awtRectangleFromB2IRectangle( const ::basegfx::B2IRange& ); - - BASEGFX_DLLPUBLIC ::basegfx::B2IVector b2ISizeFromAwtSize( const ::com::sun::star::awt::Size& ); - BASEGFX_DLLPUBLIC ::basegfx::B2IPoint b2IPointFromAwtPoint( const ::com::sun::star::awt::Point& ); - BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2IRectangleFromAwtRectangle( const ::com::sun::star::awt::Rectangle& ); - - // Geometry comparisons - // =================================================================== - - BASEGFX_DLLPUBLIC bool RealSize2DAreEqual( const ::com::sun::star::geometry::RealSize2D& rA, const ::com::sun::star::geometry::RealSize2D& rB ); - BASEGFX_DLLPUBLIC bool RealPoint2DAreEqual( const ::com::sun::star::geometry::RealPoint2D& rA, const ::com::sun::star::geometry::RealPoint2D& rB ); - BASEGFX_DLLPUBLIC bool RealRectangle2DAreEqual( const ::com::sun::star::geometry::RealRectangle2D& rA, const ::com::sun::star::geometry::RealRectangle2D& rB ); - BASEGFX_DLLPUBLIC bool RealRectangle3DAreEqual( const ::com::sun::star::geometry::RealRectangle3D& rA, const ::com::sun::star::geometry::RealRectangle3D& rB ); - BASEGFX_DLLPUBLIC bool AffineMatrix2DAreEqual( const ::com::sun::star::geometry::AffineMatrix2D& rA, const ::com::sun::star::geometry::AffineMatrix2D& rB ); - - BASEGFX_DLLPUBLIC bool IntegerSize2DAreEqual( const ::com::sun::star::geometry::IntegerSize2D& rA, const ::com::sun::star::geometry::IntegerSize2D& rB ); - BASEGFX_DLLPUBLIC bool IntegerPoint2DAreEqual( const ::com::sun::star::geometry::IntegerPoint2D& rA, const ::com::sun::star::geometry::IntegerPoint2D& rB ); - BASEGFX_DLLPUBLIC bool IntegerRectangle2DAreEqual( const ::com::sun::star::geometry::IntegerRectangle2D& rA, const ::com::sun::star::geometry::IntegerRectangle2D& rB ); - - BASEGFX_DLLPUBLIC bool awtSizeAreEqual( const ::com::sun::star::awt::Size& rA, const ::com::sun::star::awt::Size& rB ); - BASEGFX_DLLPUBLIC bool awtPointAreEqual( const ::com::sun::star::awt::Point& rA, const ::com::sun::star::awt::Point& rB ); - BASEGFX_DLLPUBLIC bool awtRectangleAreEqual( const ::com::sun::star::awt::Rectangle& rA, const ::com::sun::star::awt::Rectangle& rB ); - - /** Return smalltest integer range, which completely contains - given floating point range. - - @param rRange - Input range. Values must be within the representable - bounds of sal_Int32 - - @return the closest integer range, which completely - contains rRange. - */ - BASEGFX_DLLPUBLIC ::basegfx::B2IRange b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); - - /** Return smalltest B2DRange with integer values, which - completely contains given floating point range. - - @param rRange - Input range. - - @return the closest B2DRange with integer coordinates, - which completely contains rRange. - */ - BASEGFX_DLLPUBLIC ::basegfx::B2DRange b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange& rRange ); - - } -} - -#endif /* _BGFX_TOOLS_CANVASTOOLS_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/debugplotter.hxx b/basegfx/inc/basegfx/tools/debugplotter.hxx deleted file mode 100644 index 9ce9d0f1fb..0000000000 --- a/basegfx/inc/basegfx/tools/debugplotter.hxx +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_TOOLS_DEBUGPLOTTER_HXX -#define _BGFX_TOOLS_DEBUGPLOTTER_HXX - -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/vector/b2dvector.hxx> -#include <basegfx/range/b2drange.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <rtl/string.hxx> -#include <boost/utility.hpp> // for noncopyable -#include <vector> -#include <utility> -#include <iosfwd> -#include <basegfx/basegfxdllapi.h> - - -namespace basegfx -{ - class B2DCubicBezier; - - /** Generates debug output for various basegfx data types. - - Use this class to produce debug (trace) output for various - basegfx geometry data types. By default, this class outputs - via OSL_TRACE (i.e. to stderr), and uses the gnuplot output - format. - - To be able to generate one coherent block of output, this - class delays actual writing to its destructor - */ - class BASEGFX_DLLPUBLIC DebugPlotter : private ::boost::noncopyable - { - public: - /** Create new debug output object - - @param pTitle - Title of the debug output, will appear in trace output - */ - explicit DebugPlotter( const sal_Char* pTitle ); - - /** Create new debug output object - - @param pTitle - Title of the debug output, will appear in trace output - - @param rOutputStream - Stream to write output to. Must stay valid over the - lifetime of this object! - */ - DebugPlotter( const sal_Char* pTitle, - ::std::ostream& rOutputStream ); - - ~DebugPlotter(); - - void plot( const B2DPoint& rPoint, - const sal_Char* pTitle ); - void plot( const B2DVector& rVec, - const sal_Char* pTitle ); - void plot( const B2DCubicBezier& rBezier, - const sal_Char* pTitle ); - void plot( const B2DRange& rRange, - const sal_Char* pTitle ); - void plot( const B2DPolygon& rPoly, - const sal_Char* pTitle ); - void plot( const B2DPolyPolygon& rPoly, - const sal_Char* pTitle ); - - private: - void print( const sal_Char* ); - - ::rtl::OString maTitle; - ::std::vector< ::std::pair< B2DPoint, ::rtl::OString > > maPoints; - ::std::vector< ::std::pair< B2DVector, ::rtl::OString > > maVectors; - ::std::vector< ::std::pair< B2DRange, ::rtl::OString > > maRanges; - ::std::vector< ::std::pair< B2DPolygon, ::rtl::OString > > maPolygons; - - ::std::ostream* mpOutputStream; - }; -} - -#endif /* _BGFX_TOOLS_DEBUGPLOTTER_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/gradienttools.hxx b/basegfx/inc/basegfx/tools/gradienttools.hxx deleted file mode 100644 index fb233d3b4b..0000000000 --- a/basegfx/inc/basegfx/tools/gradienttools.hxx +++ /dev/null @@ -1,414 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_TOOLS_GRADIENTTOOLS_HXX -#define _BGFX_TOOLS_GRADIENTTOOLS_HXX - -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/range/b2drange.hxx> -#include <basegfx/vector/b2dvector.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/numeric/ftools.hxx> -#include <basegfx/basegfxdllapi.h> - -#include <vector> -#include <algorithm> - -namespace basegfx -{ - /** Gradient definition as used in ODF 1.2 - - This struct collects all data necessary for rendering ODF - 1.2-compatible gradients. Use the createXXXODFGradientInfo() - methods below for initializing from ODF attributes. - */ - struct BASEGFX_DLLPUBLIC ODFGradientInfo - { - /** transformation mapping from [0,1]^2 texture coordinate - space to [0,1]^2 shape coordinate space - */ - B2DHomMatrix maTextureTransform; - - /** transformation mapping from [0,1]^2 shape coordinate space - to [0,1]^2 texture coordinate space. This is the - transformation commonly used to create gradients from a - scanline rasterizer (put shape u/v coordinates into it, get - texture s/t coordinates out of it) - */ - B2DHomMatrix maBackTextureTransform; - - /** Aspect ratio of the gradient. Only used in drawinglayer - for generating nested gradient polygons currently. Already - catered for in the transformations above. - */ - double mfAspectRatio; - - /** Requested gradient steps to render. See the - implementations of the getXXXGradientAlpha() methods below, - the semantic differs slightly for the different gradient - types. - */ - sal_uInt32 mnSteps; - }; - - namespace tools - { - /** Create matrix for ODF's linear gradient definition - - Note that odf linear gradients are varying in y direction. - - @param o_rGradientInfo - Receives the calculated texture transformation matrix (for - use with standard [0,1]x[0,1] texture coordinates) - - @param rTargetArea - Output area, needed for aspect ratio calculations and - texture transformation - - @param nSteps - Number of gradient steps (from ODF) - - @param fBorder - Width of gradient border (from ODF) - - @param fAngle - Gradient angle (from ODF) - */ - BASEGFX_DLLPUBLIC ODFGradientInfo& createLinearODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - sal_uInt32 nSteps, - double fBorder, - double fAngle); - - /** Calculate linear gradient blend value - - This method generates you the lerp alpha value for - blending linearly between gradient start and end color, - according to the formula (startCol*(1.0-alpha) + endCol*alpha) - - @param rUV - Current uv coordinate. Values outside [0,1] will be - clamped. Assumes gradient color varies along the y axis. - - @param rGradInfo - Gradient info, for transformation and number of steps - */ - inline double getLinearGradientAlpha(const B2DPoint& rUV, - const ODFGradientInfo& rGradInfo ) - { - const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); - const double t(clamp(aCoor.getY(), 0.0, 1.0)); - const sal_uInt32 nSteps(rGradInfo.mnSteps); - - if(nSteps > 2L && nSteps < 128L) - return floor(t * nSteps) / double(nSteps + 1L); - - return t; - } - - /** Create matrix for ODF's axial gradient definition - - Note that odf axial gradients are varying in y - direction. Note further that you can map the axial - gradient to a linear gradient (in case you want or need to - avoid an extra gradient renderer), by using - createLinearODFGradientInfo() instead, shifting the - resulting texture transformation by 0.5 to the top and - appending the same stop colors again, but mirrored. - - @param o_rGradientInfo - Receives the calculated texture transformation matrix (for - use with standard [0,1]x[0,1] texture coordinates) - - @param rTargetArea - Output area, needed for aspect ratio calculations and - texture transformation - - @param nSteps - Number of gradient steps (from ODF) - - @param fBorder - Width of gradient border (from ODF) - - @param fAngle - Gradient angle (from ODF) - */ - BASEGFX_DLLPUBLIC ODFGradientInfo& createAxialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - sal_uInt32 nSteps, - double fBorder, - double fAngle); - - /** Calculate axial gradient blend value - - This method generates you the lerp alpha value for - blending linearly between gradient start and end color, - according to the formula (startCol*(1.0-alpha) + endCol*alpha) - - @param rUV - Current uv coordinate. Values outside [0,1] will be - clamped. Assumes gradient color varies along the y axis. - - @param rGradInfo - Gradient info, for transformation and number of steps - */ - inline double getAxialGradientAlpha(const B2DPoint& rUV, - const ODFGradientInfo& rGradInfo ) - { - const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); - const double t(clamp(fabs(aCoor.getY()), 0.0, 1.0)); - const sal_uInt32 nSteps(rGradInfo.mnSteps); - const double fInternalSteps((nSteps * 2L) - 1L); - - if(nSteps > 2L && nSteps < 128L) - return floor(((t * fInternalSteps) + 1.0) / 2.0) / double(nSteps - 1L); - - return t; - } - - /** Create matrix for ODF's radial gradient definition - - @param o_rGradientInfo - Receives the calculated texture transformation matrix (for - use with standard [0,1]x[0,1] texture coordinates) - - @param rTargetArea - Output area, needed for aspect ratio calculations and - texture transformation - - @param rOffset - Gradient offset value (from ODF) - - @param nSteps - Number of gradient steps (from ODF) - - @param fBorder - Width of gradient border (from ODF) - - @param fAngle - Gradient angle (from ODF) - */ - BASEGFX_DLLPUBLIC ODFGradientInfo& createRadialODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder); - - /** Calculate radial gradient blend value - - This method generates you the lerp alpha value for - blending linearly between gradient start and end color, - according to the formula (startCol*(1.0-alpha) + endCol*alpha) - - @param rUV - Current uv coordinate. Values outside [0,1] will be - clamped. - - @param rGradInfo - Gradient info, for transformation and number of steps - */ - inline double getRadialGradientAlpha(const B2DPoint& rUV, - const ODFGradientInfo& rGradInfo ) - { - const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); - const double fDist( - clamp(aCoor.getX() * aCoor.getX() + aCoor.getY() * aCoor.getY(), - 0.0, - 1.0)); - - const double t(1.0 - sqrt(fDist)); - const sal_uInt32 nSteps(rGradInfo.mnSteps); - - if(nSteps > 2L && nSteps < 128L) - return floor(t * nSteps) / double(nSteps - 1L); - - return t; - } - - /** Create matrix for ODF's elliptical gradient definition - - @param o_rGradientInfo - Receives the calculated texture transformation matrix (for - use with standard [0,1]x[0,1] texture coordinates) - - @param rTargetArea - Output area, needed for aspect ratio calculations and - texture transformation - - @param rOffset - Gradient offset value (from ODF) - - @param nSteps - Number of gradient steps (from ODF) - - @param fBorder - Width of gradient border (from ODF) - - @param fAngle - Gradient angle (from ODF) - */ - BASEGFX_DLLPUBLIC ODFGradientInfo& createEllipticalODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder, - double fAngle); - - /** Calculate elliptical gradient blend value - - This method generates you the lerp alpha value for - blending linearly between gradient start and end color, - according to the formula (startCol*(1.0-alpha) + endCol*alpha) - - @param rUV - Current uv coordinate. Values outside [0,1] will be - clamped. - - @param rGradInfo - Gradient info, for transformation and number of steps - */ - inline double getEllipticalGradientAlpha(const B2DPoint& rUV, - const ODFGradientInfo& rGradInfo ) - { - return getRadialGradientAlpha(rUV,rGradInfo); // only matrix setup differs - } - - /** Create matrix for ODF's square gradient definition - - @param o_rGradientInfo - Receives the calculated texture transformation matrix (for - use with standard [0,1]x[0,1] texture coordinates) - - @param rTargetArea - Output area, needed for aspect ratio calculations and - texture transformation - - @param rOffset - Gradient offset value (from ODF) - - @param nSteps - Number of gradient steps (from ODF) - - @param fBorder - Width of gradient border (from ODF) - - @param fAngle - Gradient angle (from ODF) - */ - BASEGFX_DLLPUBLIC ODFGradientInfo& createSquareODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder, - double fAngle); - - /** Calculate square gradient blend value - - This method generates you the lerp alpha value for - blending linearly between gradient start and end color, - according to the formula (startCol*(1.0-alpha) + endCol*alpha) - - @param rUV - Current uv coordinate. Values outside [0,1] will be - clamped. - - @param rGradInfo - Gradient info, for transformation and number of steps - */ - inline double getSquareGradientAlpha(const B2DPoint& rUV, - const ODFGradientInfo& rGradInfo ) - { - const B2DPoint aCoor(rGradInfo.maBackTextureTransform * rUV); - const double fAbsX(fabs(aCoor.getX())); - const double fAbsY(fabs(aCoor.getY())); - - if(fTools::moreOrEqual(fAbsX, 1.0) || fTools::moreOrEqual(fAbsY, 1.0)) - return 0.0; - - const double t(1.0 - (fAbsX > fAbsY ? fAbsX : fAbsY)); - const sal_uInt32 nSteps(rGradInfo.mnSteps); - - if(nSteps > 2L && nSteps < 128L) - return floor(t * nSteps) / double(nSteps - 1L); - - return t; - } - - /** Create matrix for ODF's rectangular gradient definition - - @param o_rGradientInfo - Receives the calculated texture transformation matrix (for - use with standard [0,1]x[0,1] texture coordinates) - - @param rTargetArea - Output area, needed for aspect ratio calculations and - texture transformation - - @param rOffset - Gradient offset value (from ODF) - - @param nSteps - Number of gradient steps (from ODF) - - @param fBorder - Width of gradient border (from ODF) - - @param fAngle - Gradient angle (from ODF) - */ - BASEGFX_DLLPUBLIC ODFGradientInfo& createRectangularODFGradientInfo(ODFGradientInfo& o_rGradientInfo, - const B2DRange& rTargetArea, - const B2DVector& rOffset, - sal_uInt32 nSteps, - double fBorder, - double fAngle); - - /** Calculate rectangular gradient blend value - - This method generates you the lerp alpha value for - blending linearly between gradient start and end color, - according to the formula (startCol*(1.0-alpha) + endCol*alpha) - - @param rUV - Current uv coordinate. Values outside [0,1] will be - clamped. - - @param rGradInfo - Gradient info, for transformation and number of steps - */ - inline double getRectangularGradientAlpha(const B2DPoint& rUV, - const ODFGradientInfo& rGradInfo ) - { - return getSquareGradientAlpha(rUV, rGradInfo); // only matrix setup differs - } - } -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/keystoplerp.hxx b/basegfx/inc/basegfx/tools/keystoplerp.hxx deleted file mode 100644 index c6694c02b5..0000000000 --- a/basegfx/inc/basegfx/tools/keystoplerp.hxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * 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_TOOLS_KEYSTOPLERP_HXX -#define _BGFX_TOOLS_KEYSTOPLERP_HXX - -#include <basegfx/numeric/ftools.hxx> -#include <vector> -#include <basegfx/basegfxdllapi.h> - -namespace com{ namespace sun{ namespace star{ namespace uno { - template<typename T> class Sequence; -}}}} - -namespace basegfx -{ - namespace tools - { - /** Lerp in a vector of key stops - - This class holds a key stop vector and provides the - functionality to lerp inside it. Useful e.g. for - multi-stop gradients, or the SMIL key time activity. - - For those, given a global [0,1] lerp alpha, one need to - find the suitable bucket index from key stop vector, and - then calculate the relative alpha between the two buckets - found. - */ - class BASEGFX_DLLPUBLIC KeyStopLerp - { - public: - typedef std::pair<std::ptrdiff_t,double> ResultType; - - /** Create lerper with given vector of stops - - @param rKeyStops - - Vector of stops, must contain at least two elements - (though preferrably more, otherwise you probably don't - need key stop lerping in the first place). All - elements must be of monotonically increasing value. - */ - explicit KeyStopLerp( const std::vector<double>& rKeyStops ); - - /** Create lerper with given sequence of stops - - @param rKeyStops - - Sequence of stops, must contain at least two elements - (though preferrably more, otherwise you probably don't - need key stop lerping in the first place). All - elements must be of monotonically increasing value. - */ - explicit KeyStopLerp( const ::com::sun::star::uno::Sequence<double>& rKeyStops ); - - /** Find two nearest bucket index & interpolate - - @param fAlpha - Find bucket index i, with keyStops[i] < fAlpha <= - keyStops[i+1]. Return new alpha value in [0,1), - proportional to fAlpha's position between keyStops[i] - and keyStops[i+1] - */ - ResultType lerp(double fAlpha) const; - - private: - std::vector<double> maKeyStops; - mutable std::ptrdiff_t mnLastIndex; - }; - } -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/lerp.hxx b/basegfx/inc/basegfx/tools/lerp.hxx deleted file mode 100644 index c0f61bc910..0000000000 --- a/basegfx/inc/basegfx/tools/lerp.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * 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 - * - * 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_TOOLS_LERP_HXX -#define _BGFX_TOOLS_LERP_HXX - -#include <sal/types.h> - -namespace basegfx -{ - namespace tools - { - /** Generic linear interpolator - - @tpl ValueType - Must have operator+ and operator* defined, and should - have value semantics. - - @param t - As usual, t must be in the [0,1] range - */ - template< typename ValueType > ValueType lerp( const ValueType& rFrom, - const ValueType& rTo, - double t ) - { - // This is only to suppress a double->int warning. All other - // types should be okay here. - return static_cast<ValueType>( (1.0-t)*rFrom + t*rTo ); - } - } -} - -#endif /* _BGFX_TOOLS_LERP_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/rectcliptools.hxx b/basegfx/inc/basegfx/tools/rectcliptools.hxx deleted file mode 100644 index 18bd6c57ec..0000000000 --- a/basegfx/inc/basegfx/tools/rectcliptools.hxx +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_TOOLS_RECTCLIPTOOLS_HXX -#define _BGFX_TOOLS_RECTCLIPTOOLS_HXX - -#include <sal/types.h> - -////////////////////////////////////////////////////////////////////////////// - -namespace basegfx -{ - namespace tools - { - namespace RectClipFlags - { - static const sal_uInt32 LEFT = (sal_Int32)0x01; - static const sal_uInt32 RIGHT = (sal_Int32)0x02; - static const sal_uInt32 TOP = (sal_Int32)0x04; - static const sal_uInt32 BOTTOM = (sal_Int32)0x08; - } - - /** Calc clip mask for Cohen-Sutherland rectangle clip - - This function returns a clip mask used for the - Cohen-Sutherland rectangle clip method, where one or more - of the lower four bits are set, if the given point is - outside one or more of the four half planes defining the - rectangle (see RectClipFlags for possible values) - */ - template< class Point, class Rect > inline - sal_uInt32 getCohenSutherlandClipFlags( const Point& rP, - const Rect& rR ) - { - // maxY | minY | maxX | minX - sal_uInt32 clip = (rP.getX() < rR.getMinX()) << 0; - clip |= (rP.getX() > rR.getMaxX()) << 1; - clip |= (rP.getY() < rR.getMinY()) << 2; - clip |= (rP.getY() > rR.getMaxY()) << 3; - return clip; - } - - /** Determine number of clip planes hit by given clip mask - - This method returns the number of one bits in the four - least significant bits of the argument, which amounts to - the number of clip planes hit within the - getCohenSutherlandClipFlags() method. - */ - inline sal_uInt32 getNumberOfClipPlanes( sal_uInt32 nFlags ) - { - // classic bit count algo, see e.g. Reingold, Nievergelt, - // Deo: Combinatorial Algorithms, Theory and Practice, - // Prentice-Hall 1977 - nFlags = (nFlags & 0x05) + ((nFlags >> 1) & 0x05); - nFlags = (nFlags & 0x03) + (nFlags >> 2); // no need for & - // 0x03, can't - // overflow - return nFlags; - } - } -} - -#endif // _BGFX_TOOLS_RECTCLIPTOOLS_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/tools.hxx b/basegfx/inc/basegfx/tools/tools.hxx deleted file mode 100644 index 67dd7ee691..0000000000 --- a/basegfx/inc/basegfx/tools/tools.hxx +++ /dev/null @@ -1,135 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_TOOLS_TOOLS_HXX -#define _BGFX_TOOLS_TOOLS_HXX - -#include <sal/types.h> -#include <basegfx/basegfxdllapi.h> - -namespace basegfx -{ - class B2DPoint; - class B2DRange; - - namespace tools - { - /** Liang-Barsky 2D line clipping algorithm - - This function clips a line given by two points against the - given rectangle. The resulting line is returned in the - given points. - - @param io_rStart - Start point of the line. On return, contains the clipped - start point. - - @param io_rEnd - End point of the line. On return, contains the clipped - end point. - - @param rClipRect - The rectangle to clip against - - @return true, when at least part of the line is visible - after the clip, false otherwise - */ - BASEGFX_DLLPUBLIC bool liangBarskyClip2D( ::basegfx::B2DPoint& io_rStart, - ::basegfx::B2DPoint& io_rEnd, - const ::basegfx::B2DRange& rClipRect ); - - /** Expand given parallelogram, such that it extends beyond - bound rect in a given direction. - - This method is useful when e.g. generating one-dimensional - gradients, such as linear or axial gradients: those - gradients vary only in one direction, the other has - constant color. Most of the time, those gradients extends - infinitely in the direction with the constant color, but - practically, one always has a limiting bound rect into - which the gradient is painted. The method at hand now - extends a given parallelogram (e.g. the transformed - bounding box of a gradient) virtually into infinity to the - top and to the bottom (i.e. normal to the line io_rLeftTop - io_rRightTop), such that the given rectangle is guaranteed - to be covered in that direction. - - @attention There might be some peculiarities with this - method, that might limit its usage to the described - gradients. One of them is the fact that when determining - how far the parallelogram has to be extended to the top or - the bottom, the upper and lower border are assumed to be - infinite lines. - - @param io_rLeftTop - Left, top edge of the parallelogramm. Note that this need - not be the left, top edge geometrically, it's just used - when determining the extension direction. Thus, it's - perfectly legal to affine-transform a rectangle, and given - the transformed point here. On method return, this - parameter will contain the adapted output. - - @param io_rLeftBottom - Left, bottom edge of the parallelogramm. Note that this need - not be the left, bottom edge geometrically, it's just used - when determining the extension direction. Thus, it's - perfectly legal to affine-transform a rectangle, and given - the transformed point here. On method return, this - parameter will contain the adapted output. - - @param io_rRightTop - Right, top edge of the parallelogramm. Note that this need - not be the right, top edge geometrically, it's just used - when determining the extension direction. Thus, it's - perfectly legal to affine-transform a rectangle, and given - the transformed point here. On method return, this - parameter will contain the adapted output. - - @param io_rRightBottom - Right, bottom edge of the parallelogramm. Note that this need - not be the right, bottom edge geometrically, it's just used - when determining the extension direction. Thus, it's - perfectly legal to affine-transform a rectangle, and given - the transformed point here. On method return, this - parameter will contain the adapted output. - - @param rFitTarget - The rectangle to fit the parallelogram into. - */ - BASEGFX_DLLPUBLIC void infiniteLineFromParallelogram( ::basegfx::B2DPoint& io_rLeftTop, - ::basegfx::B2DPoint& io_rLeftBottom, - ::basegfx::B2DPoint& io_rRightTop, - ::basegfx::B2DPoint& io_rRightBottom, - const ::basegfx::B2DRange& rFitTarget ); - - } -} - -#endif /* _BGFX_TOOLS_TOOLS_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/unopolypolygon.hxx b/basegfx/inc/basegfx/tools/unopolypolygon.hxx deleted file mode 100644 index ec0f3e6062..0000000000 --- a/basegfx/inc/basegfx/tools/unopolypolygon.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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 INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX -#define INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX - -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase3.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/rendering/FillRule.hpp> -#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp> -#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp> -#include <basegfx/polygon/b2dpolypolygon.hxx> -#include <basegfx/basegfxdllapi.h> - - -namespace basegfx -{ -namespace unotools -{ - typedef ::cppu::WeakComponentImplHelper3< - ::com::sun::star::rendering::XLinePolyPolygon2D, - ::com::sun::star::rendering::XBezierPolyPolygon2D, - ::com::sun::star::lang::XServiceInfo > UnoPolyPolygonBase; - - class BASEGFX_DLLPUBLIC UnoPolyPolygon : private cppu::BaseMutex, - public UnoPolyPolygonBase - { - public: - explicit UnoPolyPolygon( const B2DPolyPolygon& ); - - // XPolyPolygon2D - virtual void SAL_CALL addPolyPolygon( const ::com::sun::star::geometry::RealPoint2D& position, const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XPolyPolygon2D >& polyPolygon ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getNumberOfPolygons( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Int32 SAL_CALL getNumberOfPolygonPoints( ::sal_Int32 polygon ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::rendering::FillRule SAL_CALL getFillRule( ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFillRule( ::com::sun::star::rendering::FillRule fillRule ) throw (::com::sun::star::uno::RuntimeException); - virtual ::sal_Bool SAL_CALL isClosed( ::sal_Int32 index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setClosed( ::sal_Int32 index, ::sal_Bool closedState ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XLinePolyPolygon2D - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > > SAL_CALL getPoints( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPoints( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::geometry::RealPoint2D SAL_CALL getPoint( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setPoint( const ::com::sun::star::geometry::RealPoint2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XBezierPolyPolygon2D - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > > SAL_CALL getBezierSegments( ::sal_Int32 nPolygonIndex, ::sal_Int32 nNumberOfPolygons, ::sal_Int32 nPointIndex, ::sal_Int32 nNumberOfPoints ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBezierSegments( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealBezierSegment2D > >& points, ::sal_Int32 nPolygonIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::geometry::RealBezierSegment2D SAL_CALL getBezierSegment( ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBezierSegment( const ::com::sun::star::geometry::RealBezierSegment2D& point, ::sal_Int32 nPolygonIndex, ::sal_Int32 nPointIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - - B2DPolyPolygon getPolyPolygon() const; - - protected: - /// Check whether index is a valid polygon index - void checkIndex( sal_Int32 nIndex ) const // throw (::com::sun::star::lang::IndexOutOfBoundsException); - { - if( nIndex < 0 || nIndex >= static_cast<sal_Int32>(maPolyPoly.count()) ) - throw ::com::sun::star::lang::IndexOutOfBoundsException(); - } - - B2DPolyPolygon getSubsetPolyPolygon( sal_Int32 nPolygonIndex, - sal_Int32 nNumberOfPolygons, - sal_Int32 nPointIndex, - sal_Int32 nNumberOfPoints ) const; - - /// Get cow copy of internal polygon. not thread-safe outside this object. - B2DPolyPolygon getPolyPolygonUnsafe() const; - - /// Called whenever internal polypolygon gets modified - virtual void modifying() const {} - - private: - UnoPolyPolygon( const UnoPolyPolygon& ); - UnoPolyPolygon& operator=( const UnoPolyPolygon& ); - - B2DPolyPolygon maPolyPoly; - ::com::sun::star::rendering::FillRule meFillRule; - }; -} -} - -#endif /* INCLUDED_BASEGFX_UNOPOLYPOLYGON_HXX */ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/basegfx/inc/basegfx/tools/unotools.hxx b/basegfx/inc/basegfx/tools/unotools.hxx deleted file mode 100644 index 52e2069075..0000000000 --- a/basegfx/inc/basegfx/tools/unotools.hxx +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Version: MPL 1.1 / GPLv3+ / LGPLv3+ - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License or as specified alternatively below. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Initial Developer of the Original Code is - * Thorsten Behrens <tbehrens@novell.com> - * Portions created by the Initial Developer are Copyright (C) 2011 the - * Initial Developer. All Rights Reserved. - * - * For minor contributions see the git repository. - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 3 or later (the "GPLv3+"), or - * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), - * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable - * instead of those above. - */ - -#ifndef INCLUDED_BASEGFX_UNOTOOLS_HXX -#define INCLUDED_BASEGFX_UNOTOOLS_HXX - -#include <cppuhelper/basemutex.hxx> -#include <cppuhelper/compbase3.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/rendering/FillRule.hpp> -#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp> -#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp> -#include <basegfx/polygon/b2dpolypolygon.hxx> - - -namespace basegfx -{ -class B2DPolyPolygon; - -namespace unotools -{ - - BASEGFX_DLLPUBLIC B2DPolyPolygon polyPolygonBezierToB2DPolyPolygon(const ::com::sun::star::drawing::PolyPolygonBezierCoords& rSourcePolyPolygon) - throw( ::com::sun::star::lang::IllegalArgumentException ); - - BASEGFX_DLLPUBLIC void b2DPolyPolygonToPolyPolygonBezier( const B2DPolyPolygon& rPolyPoly, - ::com::sun::star::drawing::PolyPolygonBezierCoords& rRetval ); -} -} - -#endif /* INCLUDED_BASEGFX_UNOTOOLS_HXX */ |