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 .
20 #ifndef INCLUDED_BASEGFX_TOOLS_CANVASTOOLS_HXX
21 #define INCLUDED_BASEGFX_TOOLS_CANVASTOOLS_HXX
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
25 #include <basegfx/basegfxdllapi.h>
28 namespace com
{ namespace sun
{ namespace star
{ namespace geometry
30 struct AffineMatrix2D
;
31 struct AffineMatrix3D
;
35 struct RealRectangle2D
;
36 struct RealRectangle3D
;
37 struct IntegerPoint2D
;
39 struct IntegerRectangle2D
;
40 struct RealBezierSegment2D
;
43 namespace com
{ namespace sun
{ namespace star
{ namespace rendering
49 namespace com
{ namespace sun
{ namespace star
{ namespace awt
73 // Polygon conversions
76 BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XPolyPolygon2D
>
77 xPolyPolygonFromB2DPolygon( const ::com::sun::star::uno::Reference
<
78 ::com::sun::star::rendering::XGraphicDevice
>& xGraphicDevice
,
79 const ::basegfx::B2DPolygon
& rPoly
);
81 BASEGFX_DLLPUBLIC ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XPolyPolygon2D
>
82 xPolyPolygonFromB2DPolyPolygon( const ::com::sun::star::uno::Reference
<
83 ::com::sun::star::rendering::XGraphicDevice
>& xGraphicDevice
,
84 const ::basegfx::B2DPolyPolygon
& rPolyPoly
);
87 BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence
<
88 ::com::sun::star::uno::Sequence
<
89 ::com::sun::star::geometry::RealBezierSegment2D
> >
90 bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPolyPoly
);
92 BASEGFX_DLLPUBLIC ::com::sun::star::uno::Sequence
<
93 ::com::sun::star::uno::Sequence
<
94 ::com::sun::star::geometry::RealPoint2D
> >
95 pointSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPolyPoly
);
97 BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon
polygonFromPoint2DSequence(
98 const ::com::sun::star::uno::Sequence
<
99 ::com::sun::star::geometry::RealPoint2D
>& rPoints
);
101 BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon
polyPolygonFromPoint2DSequenceSequence(
102 const ::com::sun::star::uno::Sequence
<
103 ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealPoint2D
> >& rPoints
);
105 BASEGFX_DLLPUBLIC ::basegfx::B2DPolygon
polygonFromBezier2DSequence(
106 const ::com::sun::star::uno::Sequence
<
107 ::com::sun::star::geometry::RealBezierSegment2D
>& rPoints
);
109 BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon
polyPolygonFromBezier2DSequenceSequence(
110 const ::com::sun::star::uno::Sequence
<
111 ::com::sun::star::uno::Sequence
< ::com::sun::star::geometry::RealBezierSegment2D
> >& rPoints
);
113 BASEGFX_DLLPUBLIC ::basegfx::B2DPolyPolygon
b2DPolyPolygonFromXPolyPolygon2D(
114 const ::com::sun::star::uno::Reference
<
115 ::com::sun::star::rendering::XPolyPolygon2D
>& rPoly
);
117 // Matrix conversions
120 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix2D
&
121 affineMatrixFromHomMatrix( ::com::sun::star::geometry::AffineMatrix2D
& matrix
,
122 const ::basegfx::B2DHomMatrix
& transform
);
124 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::AffineMatrix3D
& affineMatrixFromHomMatrix3D(
125 ::com::sun::star::geometry::AffineMatrix3D
& matrix
,
126 const ::basegfx::B3DHomMatrix
& transform
);
128 BASEGFX_DLLPUBLIC ::basegfx::B2DHomMatrix
&
129 homMatrixFromAffineMatrix( ::basegfx::B2DHomMatrix
& transform
,
130 const ::com::sun::star::geometry::AffineMatrix2D
& matrix
);
132 BASEGFX_DLLPUBLIC ::basegfx::B3DHomMatrix
homMatrixFromAffineMatrix3D( const ::com::sun::star::geometry::AffineMatrix3D
& matrix
);
134 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::Matrix2D
&
135 matrixFromHomMatrix( ::com::sun::star::geometry::Matrix2D
& matrix
,
136 const ::basegfx::B2DHomMatrix
& transform
);
138 // Geometry conversions
141 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealSize2D
size2DFromB2DSize( const ::basegfx::B2DVector
& );
142 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealPoint2D
point2DFromB2DPoint( const ::basegfx::B2DPoint
& );
143 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle2D
rectangle2DFromB2DRectangle( const ::basegfx::B2DRange
& );
144 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::RealRectangle3D
rectangle3DFromB3DRectangle( const ::basegfx::B3DRange
& );
146 BASEGFX_DLLPUBLIC ::basegfx::B2DPoint
b2DPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D
& );
147 BASEGFX_DLLPUBLIC ::basegfx::B2DRange
b2DRectangleFromRealRectangle2D( const ::com::sun::star::geometry::RealRectangle2D
& );
148 BASEGFX_DLLPUBLIC ::basegfx::B3DRange
b3DRectangleFromRealRectangle3D( const ::com::sun::star::geometry::RealRectangle3D
& );
150 BASEGFX_DLLPUBLIC ::com::sun::star::geometry::IntegerSize2D
integerSize2DFromB2ISize( const ::basegfx::B2IVector
& );
152 BASEGFX_DLLPUBLIC ::basegfx::B2IVector
b2ISizeFromIntegerSize2D( const ::com::sun::star::geometry::IntegerSize2D
& );
153 BASEGFX_DLLPUBLIC ::basegfx::B2IRange
b2IRectangleFromIntegerRectangle2D( const ::com::sun::star::geometry::IntegerRectangle2D
& );
155 BASEGFX_DLLPUBLIC ::basegfx::B2IRange
b2IRectangleFromAwtRectangle( const ::com::sun::star::awt::Rectangle
& );
157 // Geometry comparisons
160 /** Return smalltest integer range, which completely contains
161 given floating point range.
164 Input range. Values must be within the representable
167 @return the closest integer range, which completely
170 BASEGFX_DLLPUBLIC ::basegfx::B2IRange
b2ISurroundingRangeFromB2DRange( const ::basegfx::B2DRange
& rRange
);
172 /** Return smalltest integer box, which completely contains
173 given floating point range.
176 Input range. Values must be within the representable
179 @return the closest integer box, which completely contains
180 rRange. Note that this box will contain all pixel affected
181 by a polygon fill operation over the input range.
183 BASEGFX_DLLPUBLIC ::basegfx::B2IBox
b2ISurroundingBoxFromB2DRange( const ::basegfx::B2DRange
& rRange
);
185 /** Return smalltest B2DRange with integer values, which
186 completely contains given floating point range.
191 @return the closest B2DRange with integer coordinates,
192 which completely contains rRange.
194 BASEGFX_DLLPUBLIC ::basegfx::B2DRange
b2DSurroundingIntegerRangeFromB2DRange( const ::basegfx::B2DRange
& rRange
);
199 #endif // INCLUDED_BASEGFX_TOOLS_CANVASTOOLS_HXX
201 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */