workaround segfault in compiler on macos-clang-intel
[LibreOffice.git] / include / basegfx / DrawCommands.hxx
blob14d3ad2459cf0a8f11d1a89f02797f0412798baa
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/.
8 */
10 #ifndef INCLUDED_BASEGFX_DRAWCOMMANDS_H
11 #define INCLUDED_BASEGFX_DRAWCOMMANDS_H
13 #include <memory>
14 #include <utility>
15 #include <vector>
17 #include <basegfx/color/bcolor.hxx>
18 #include <basegfx/polygon/b2dpolypolygon.hxx>
19 #include <basegfx/range/b2drange.hxx>
20 #include <basegfx/matrix/b2dhommatrix.hxx>
22 namespace gfx
24 class DrawBase;
26 class DrawCommand
28 public:
29 std::vector<std::shared_ptr<DrawBase>> maChildren;
32 enum class DrawCommandType
34 Root,
35 Rectangle,
36 Path
39 enum class GradientType
41 Linear
44 class GradientStop
46 public:
47 basegfx::BColor maColor;
48 float mfOffset;
49 float mfOpacity;
52 class GradientInfo
54 public:
55 GradientType meType;
57 std::vector<GradientStop> maGradientStops;
59 GradientInfo(GradientType eType)
60 : meType(eType)
65 class LinearGradientInfo : public GradientInfo
67 public:
68 LinearGradientInfo()
69 : GradientInfo(GradientType::Linear)
70 , x1(0.0)
71 , y1(0.0)
72 , x2(0.0)
73 , y2(0.0)
77 double x1;
78 double y1;
79 double x2;
80 double y2;
82 basegfx::B2DHomMatrix maMatrix;
85 class DrawBase : public DrawCommand
87 private:
88 DrawCommandType meType;
90 public:
91 DrawBase(DrawCommandType eType)
92 : meType(eType)
96 DrawCommandType getType() const { return meType; }
99 class DrawRoot : public DrawBase
101 public:
102 basegfx::B2DRange maRectangle;
104 DrawRoot()
105 : DrawBase(DrawCommandType::Root)
110 class DrawRectangle : public DrawBase
112 public:
113 basegfx::B2DRange maRectangle;
114 double mnRx;
115 double mnRy;
117 double mnStrokeWidth;
118 double mnOpacity;
119 std::shared_ptr<basegfx::BColor> mpFillColor;
120 std::shared_ptr<basegfx::BColor> mpStrokeColor;
121 std::shared_ptr<GradientInfo> mpFillGradient;
123 DrawRectangle(basegfx::B2DRange const& rRectangle)
124 : DrawBase(DrawCommandType::Rectangle)
125 , maRectangle(rRectangle)
126 , mnRx(1.0)
127 , mnRy(1.0)
128 , mnStrokeWidth(1.0)
129 , mnOpacity(1.0)
134 class DrawPath : public DrawBase
136 public:
137 basegfx::B2DPolyPolygon maPolyPolygon;
139 double mnStrokeWidth;
140 double mnOpacity;
141 std::shared_ptr<basegfx::BColor> mpFillColor;
142 std::shared_ptr<basegfx::BColor> mpStrokeColor;
143 std::shared_ptr<GradientInfo> mpFillGradient;
145 DrawPath(basegfx::B2DPolyPolygon aPolyPolygon)
146 : DrawBase(DrawCommandType::Path)
147 , maPolyPolygon(std::move(aPolyPolygon))
148 , mnStrokeWidth(1.0)
149 , mnOpacity(1.0)
154 } // end namespace gfx
156 #endif // INCLUDED_BASEGFX_DRAWCOMMANDS_H
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */