Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / basegfx / polygon / b3dpolygon.hxx
blobea9ea2fdedcfeba0a969fc53cdc8710cb98a37b0
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 <sal/types.h>
23 #include <o3tl/cow_wrapper.hxx>
24 #include <basegfx/basegfxdllapi.h>
26 class ImplB3DPolygon;
28 namespace basegfx
30 class B3DPoint;
31 class B3DHomMatrix;
32 class B3DVector;
33 class B2DPoint;
34 class B2DHomMatrix;
35 class BColor;
38 namespace basegfx
40 class BASEGFX_DLLPUBLIC B3DPolygon
42 public:
43 typedef o3tl::cow_wrapper< ImplB3DPolygon, o3tl::ThreadSafeRefCountingPolicy > ImplType;
45 private:
46 // internal data.
47 ImplType mpPolygon;
49 public:
50 B3DPolygon();
51 B3DPolygon(const B3DPolygon& rPolygon);
52 B3DPolygon(B3DPolygon&& rPolygon);
53 ~B3DPolygon();
55 // assignment operator
56 B3DPolygon& operator=(const B3DPolygon& rPolygon);
57 B3DPolygon& operator=(B3DPolygon&& rPolygon);
59 // compare operators
60 bool operator==(const B3DPolygon& rPolygon) const;
61 bool operator!=(const B3DPolygon& rPolygon) const;
63 // member count
64 sal_uInt32 count() const;
66 // Coordinate interface
67 B3DPoint const & getB3DPoint(sal_uInt32 nIndex) const;
68 void setB3DPoint(sal_uInt32 nIndex, const B3DPoint& rValue);
70 // Coordinate append
71 void append(const B3DPoint& rPoint, sal_uInt32 nCount = 1);
73 // BColor interface
74 BColor const & getBColor(sal_uInt32 nIndex) const;
75 void setBColor(sal_uInt32 nIndex, const BColor& rValue);
76 bool areBColorsUsed() const;
77 void clearBColors();
79 // Normals interface
80 B3DVector const & getNormal() const; // plane normal
81 B3DVector const & getNormal(sal_uInt32 nIndex) const; // normal in each point
82 void setNormal(sal_uInt32 nIndex, const B3DVector& rValue);
83 void transformNormals(const B3DHomMatrix& rMatrix);
84 bool areNormalsUsed() const;
85 void clearNormals();
87 // TextureCoordinate interface
88 B2DPoint const & getTextureCoordinate(sal_uInt32 nIndex) const;
89 void setTextureCoordinate(sal_uInt32 nIndex, const B2DPoint& rValue);
90 void transformTextureCoordinates(const B2DHomMatrix& rMatrix);
91 bool areTextureCoordinatesUsed() const;
92 void clearTextureCoordinates();
94 // append other 2D polygons
95 void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
97 // remove
98 void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
100 // clear all points
101 void clear();
103 // closed state
104 bool isClosed() const;
105 void setClosed(bool bNew);
107 // flip polygon direction
108 void flip();
110 // test if Polygon has double points
111 bool hasDoublePoints() const;
113 // remove double points, at the begin/end and follow-ups, too
114 void removeDoublePoints();
116 // apply transformation given in matrix form to the polygon
117 void transform(const B3DHomMatrix& rMatrix);
119 } // end of namespace basegfx
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */