Bump version to 6.4-15
[LibreOffice.git] / include / basegfx / DrawCommands.hxx
blobe9e3b935b8cff1b33a1c33c19dbca9bd7f92a1cb
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 <vector>
16 #include <basegfx/color/bcolor.hxx>
17 #include <basegfx/polygon/b2dpolypolygon.hxx>
18 #include <basegfx/range/b2drange.hxx>
19 #include <basegfx/matrix/b2dhommatrix.hxx>
21 namespace gfx
23 class DrawBase;
25 class DrawCommand
27 public:
28 std::vector<std::shared_ptr<DrawBase>> maChildren;
31 enum class DrawCommandType
33 Root,
34 Rectangle,
35 Path
38 enum class GradientType
40 Linear
43 class GradientStop
45 public:
46 float mfOffset;
47 basegfx::BColor maColor;
48 float mfOpacity;
51 class GradientInfo
53 public:
54 GradientType meType;
56 std::vector<GradientStop> maGradientStops;
58 GradientInfo(GradientType eType)
59 : meType(eType)
64 class LinearGradientInfo : public GradientInfo
66 public:
67 LinearGradientInfo()
68 : GradientInfo(GradientType::Linear)
69 , x1(0.0)
70 , y1(0.0)
71 , x2(0.0)
72 , y2(0.0)
76 double x1;
77 double y1;
78 double x2;
79 double y2;
81 basegfx::B2DHomMatrix maMatrix;
84 class DrawBase : public DrawCommand
86 private:
87 DrawCommandType meType;
89 public:
90 DrawBase(DrawCommandType eType)
91 : meType(eType)
95 DrawCommandType getType() const { return meType; }
98 class DrawRoot : public DrawBase
100 public:
101 basegfx::B2DRange maRectangle;
103 DrawRoot()
104 : DrawBase(DrawCommandType::Root)
109 class DrawRectangle : public DrawBase
111 public:
112 basegfx::B2DRange maRectangle;
113 double mnRx;
114 double mnRy;
116 double mnStrokeWidth;
117 double mnOpacity;
118 std::shared_ptr<basegfx::BColor> mpFillColor;
119 std::shared_ptr<basegfx::BColor> mpStrokeColor;
120 std::shared_ptr<GradientInfo> mpFillGradient;
122 DrawRectangle(basegfx::B2DRange const& rRectangle)
123 : DrawBase(DrawCommandType::Rectangle)
124 , maRectangle(rRectangle)
125 , mnRx(1.0)
126 , mnRy(1.0)
127 , mnStrokeWidth(1.0)
128 , mnOpacity(1.0)
133 class DrawPath : public DrawBase
135 public:
136 basegfx::B2DPolyPolygon maPolyPolygon;
138 double mnStrokeWidth;
139 double mnOpacity;
140 std::shared_ptr<basegfx::BColor> mpFillColor;
141 std::shared_ptr<basegfx::BColor> mpStrokeColor;
142 std::shared_ptr<GradientInfo> mpFillGradient;
144 DrawPath(basegfx::B2DPolyPolygon const& rPolyPolygon)
145 : DrawBase(DrawCommandType::Path)
146 , maPolyPolygon(rPolyPolygon)
147 , mnStrokeWidth(1.0)
148 , mnOpacity(1.0)
153 } // end namespace gfx
155 #endif // INCLUDED_BASEGFX_DRAWCOMMANDS_H
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */