1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <com/sun/star/uno/Reference.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
24 #include <basegfx/basegfxdllapi.h>
27 namespace com::sun::star::geometry
29 struct AffineMatrix2D
;
30 struct AffineMatrix3D
;
33 struct RealRectangle2D
;
34 struct RealRectangle3D
;
36 struct IntegerRectangle2D
;
37 struct RealBezierSegment2D
;
40 namespace com::sun::star::rendering
46 namespace com::sun::star::awt
66 namespace basegfx::unotools
68 // Polygon conversions
71 BASEGFX_DLLPUBLIC
css::uno::Reference
< css::rendering::XPolyPolygon2D
>
72 xPolyPolygonFromB2DPolygon( const css::uno::Reference
< css::rendering::XGraphicDevice
>& xGraphicDevice
,
73 const ::basegfx::B2DPolygon
& rPoly
);
75 BASEGFX_DLLPUBLIC
css::uno::Reference
< css::rendering::XPolyPolygon2D
>
76 xPolyPolygonFromB2DPolyPolygon( const css::uno::Reference
< css::rendering::XGraphicDevice
>& xGraphicDevice
,
77 const ::basegfx::B2DPolyPolygon
& rPolyPoly
);
81 css::uno::Sequence
< css::geometry::RealBezierSegment2D
> >
82 bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPolyPoly
);
85 css::uno::Sequence
< css::geometry::RealPoint2D
> >
86 pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPolyPoly
);
88 ::basegfx::B2DPolygon
polygonFromPoint2DSequence(
89 const css::uno::Sequence
< css::geometry::RealPoint2D
>& rPoints
);
91 BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon
polyPolygonFromPoint2DSequenceSequence(
92 const css::uno::Sequence
< css::uno::Sequence
< css::geometry::RealPoint2D
> >& rPoints
);
94 ::basegfx::B2DPolygon
polygonFromBezier2DSequence(
95 const css::uno::Sequence
< css::geometry::RealBezierSegment2D
>& rPoints
);
97 BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon
polyPolygonFromBezier2DSequenceSequence(
98 const css::uno::Sequence
< css::uno::Sequence
< css::geometry::RealBezierSegment2D
> >& rPoints
);
100 BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon
b2DPolyPolygonFromXPolyPolygon2D(
101 const css::uno::Reference
< css::rendering::XPolyPolygon2D
>& rPoly
);
103 // Matrix conversions
106 BASEGFX_DLLPUBLIC
css::geometry::AffineMatrix2D
&
107 affineMatrixFromHomMatrix( css::geometry::AffineMatrix2D
& matrix
,
108 const ::basegfx::B2DHomMatrix
& transform
);
110 css::geometry::AffineMatrix3D
& affineMatrixFromHomMatrix3D(
111 css::geometry::AffineMatrix3D
& matrix
,
112 const ::basegfx::B3DHomMatrix
& transform
);
114 BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix
&
115 homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix
& transform
,
116 const css::geometry::AffineMatrix2D
& matrix
);
118 BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix
homMatrixFromAffineMatrix3D( const css::geometry::AffineMatrix3D
& matrix
);
120 // Geometry conversions
123 BASEGFX_DLLPUBLIC
css::geometry::RealSize2D
size2DFromB2DSize( const ::basegfx::B2DSize
& );
124 BASEGFX_DLLPUBLIC
css::geometry::RealPoint2D
point2DFromB2DPoint( const ::basegfx::B2DPoint
& );
125 BASEGFX_DLLPUBLIC
css::geometry::RealRectangle2D
rectangle2DFromB2DRectangle( const ::basegfx::B2DRange
& );
126 BASEGFX_DLLPUBLIC
css::geometry::RealRectangle3D
rectangle3DFromB3DRectangle( const ::basegfx::B3DRange
& );
128 BASEGFX_DLLPUBLIC ::basegfx::B2DPoint
b2DPointFromRealPoint2D( const css::geometry::RealPoint2D
& );
129 BASEGFX_DLLPUBLIC ::basegfx::B2DRange
b2DRectangleFromRealRectangle2D( const css::geometry::RealRectangle2D
& );
130 ::basegfx::B3DRange
b3DRectangleFromRealRectangle3D( const css::geometry::RealRectangle3D
& );
132 BASEGFX_DLLPUBLIC
css::geometry::IntegerSize2D
integerSize2DFromB2ISize( const ::basegfx::B2IVector
& );
134 BASEGFX_DLLPUBLIC ::basegfx::B2IVector
b2ISizeFromIntegerSize2D( const css::geometry::IntegerSize2D
& );
135 BASEGFX_DLLPUBLIC ::basegfx::B2IRange
b2IRectangleFromIntegerRectangle2D( const css::geometry::IntegerRectangle2D
& );
137 BASEGFX_DLLPUBLIC ::basegfx::B2IRange
b2IRectangleFromAwtRectangle( const css::awt::Rectangle
& );
139 // Geometry comparisons
142 /** Return smalltest integer range, which completely contains
143 given floating point range.
146 Input range. Values must be within the representable
149 @return the closest integer range, which completely
152 BASEGFX_DLLPUBLIC ::basegfx::B2IRange
b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange
& rRange
);
154 /** Return smalltest B2DRange with integer values, which
155 completely contains given floating point range.
160 @return the closest B2DRange with integer coordinates,
161 which completely contains rRange.
163 BASEGFX_DLLPUBLIC ::basegfx::B2DRange
b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange
& rRange
);
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */