Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / basegfx / utils / canvastools.hxx
blob228a1b0f504ae936fc44e74dbd68f7720470cd5d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
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;
31 struct RealPoint2D;
32 struct RealSize2D;
33 struct RealRectangle2D;
34 struct RealRectangle3D;
35 struct IntegerSize2D;
36 struct IntegerRectangle2D;
37 struct RealBezierSegment2D;
40 namespace com::sun::star::rendering
42 class XGraphicDevice;
43 class XPolyPolygon2D;
46 namespace com::sun::star::awt
48 struct Rectangle;
51 namespace basegfx
53 class B2DHomMatrix;
54 class B3DHomMatrix;
55 class B2DVector;
56 class B2DPoint;
57 class B2DRange;
58 class B3DRange;
59 class B2IVector;
60 class B2IRange;
61 class B2DPolygon;
62 class B2DPolyPolygon;
63 class B2DSize;
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 );
80 css::uno::Sequence<
81 css::uno::Sequence< css::geometry::RealBezierSegment2D > >
82 bezierSequenceSequenceFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly );
84 css::uno::Sequence<
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.
145 @param rRange
146 Input range. Values must be within the representable
147 bounds of sal_Int32
149 @return the closest integer range, which completely
150 contains rRange.
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.
157 @param rRange
158 Input 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: */