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_POLYGON_B2DPOLYGONCLIPPER_HXX
21 #define INCLUDED_BASEGFX_POLYGON_B2DPOLYGONCLIPPER_HXX
23 #include <basegfx/polygon/b2dpolypolygon.hxx>
24 #include <basegfx/polygon/b2dpolygon.hxx>
25 #include <basegfx/basegfxdllapi.h>
35 // This method clips the given tools::PolyPolygon against a horizontal or vertical axis (parallel to X or Y axis). The axis is
36 // defined by bParallelToXAxis (true -> it's parallel to the X-Axis of the coordinate system, else to the Y-Axis) and the
37 // fValueOnOtherAxis (gives the translation to the coordinate system axis). For example, when You want to define
38 // a clip axis parallel to X.Axis and 100 above it, use bParallelToXAxis = true and fValueOnOtherAxis = 100.
39 // The value bAboveAxis defines on which side the return value will be (true -> above X, right of Y).
40 // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
41 BASEGFX_DLLPUBLIC B2DPolyPolygon
clipPolyPolygonOnParallelAxis(const B2DPolyPolygon
& rCandidate
, bool bParallelToXAxis
, bool bAboveAxis
, double fValueOnOtherAxis
, bool bStroke
);
42 BASEGFX_DLLPUBLIC B2DPolyPolygon
clipPolygonOnParallelAxis(const B2DPolygon
& rCandidate
, bool bParallelToXAxis
, bool bAboveAxis
, double fValueOnOtherAxis
, bool bStroke
);
44 // Clip the given tools::PolyPolygon against the given range. bInside defines if the result will contain the
45 // parts which are contained in the range or vice versa.
46 // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
47 BASEGFX_DLLPUBLIC B2DPolyPolygon
clipPolyPolygonOnRange(const B2DPolyPolygon
& rCandidate
, const B2DRange
& rRange
, bool bInside
, bool bStroke
);
48 BASEGFX_DLLPUBLIC B2DPolyPolygon
clipPolygonOnRange(const B2DPolygon
& rCandidate
, const B2DRange
& rRange
, bool bInside
, bool bStroke
);
50 // Clip given tools::PolyPolygon against given clipping polygon.
51 // The switch bStroke decides if the polygon is interpreted as area (false) or strokes (true).
52 // With stroke polygons, You get all line snippets inside rCip.
53 // With filled polygons, You get all tools::PolyPolygon parts which were inside rClip.
54 // The switch bInside decides if the parts inside the clip polygon or outside shall be created.
55 // The clip polygon is always assumed closed, even when it's isClosed() is false.
56 BASEGFX_DLLPUBLIC B2DPolyPolygon
clipPolyPolygonOnPolyPolygon(const B2DPolyPolygon
& rCandidate
, const B2DPolyPolygon
& rClip
, bool bInside
, bool bStroke
);
57 BASEGFX_DLLPUBLIC B2DPolyPolygon
clipPolygonOnPolyPolygon(const B2DPolygon
& rCandidate
, const B2DPolyPolygon
& rClip
, bool bInside
, bool bStroke
);
59 // clip the given polygon against the given range. the resulting polygon will always contain
60 // the inside parts which will always be interpreted as areas. the incoming polygon is expected
61 // to be a simple triangle list. the result is also a simple triangle list.
62 BASEGFX_DLLPUBLIC B2DPolygon
clipTriangleListOnRange( const B2DPolygon
& rCandidate
, const B2DRange
& rRange
);
64 } // end of namespace utils
65 } // end of namespace basegfx
67 #endif // INCLUDED_BASEGFX_POLYGON_B2DPOLYGONCLIPPER_HXX
69 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */