build fix: no comphelper/profilezone.hxx in this branch
[LibreOffice.git] / include / drawinglayer / primitive2d / polypolygonprimitive2d.hxx
blob2cbc032e775d05833a4405c746d141741029161b
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 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <drawinglayer/attribute/fillgraphicattribute.hxx>
27 #include <basegfx/polygon/b2dpolypolygon.hxx>
28 #include <drawinglayer/attribute/lineattribute.hxx>
29 #include <drawinglayer/attribute/strokeattribute.hxx>
30 #include <drawinglayer/attribute/linestartendattribute.hxx>
31 #include <drawinglayer/attribute/fillgradientattribute.hxx>
32 #include <drawinglayer/attribute/fillhatchattribute.hxx>
33 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
34 #include <basegfx/color/bcolor.hxx>
37 // PolyPolygonHairlinePrimitive2D class
39 namespace drawinglayer
41 namespace primitive2d
43 /** PolyPolygonHairlinePrimitive2D class
45 This primitive defines a multi-PolygonHairlinePrimitive2D and is
46 just for convenience. The definition is not different from the single
47 defined PolygonHairlinePrimitive2Ds.
49 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D
51 private:
52 /// the hairline geometry
53 basegfx::B2DPolyPolygon maPolyPolygon;
55 /// the hairline color
56 basegfx::BColor maBColor;
58 protected:
59 /// local decomposition.
60 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
62 public:
63 /// constructor
64 PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor);
66 /// data read access
67 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
68 const basegfx::BColor& getBColor() const { return maBColor; }
70 /// compare operator
71 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
73 /// get range
74 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
76 /// provide unique ID
77 DeclPrimitive2DIDBlock()
79 } // end of namespace primitive2d
80 } // end of namespace drawinglayer
83 // PolyPolygonMarkerPrimitive2D class
85 namespace drawinglayer
87 namespace primitive2d
89 /** PolyPolygonMarkerPrimitive2D class
91 This primitive defines a multi-PolygonMarkerPrimitive2D and is
92 just for convenience. The definition is not different from the single
93 defined PolygonMarkerPrimitive2Ds.
95 class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
97 private:
98 /// the marker hairline geometry
99 basegfx::B2DPolyPolygon maPolyPolygon;
101 /// the two colors
102 basegfx::BColor maRGBColorA;
103 basegfx::BColor maRGBColorB;
105 /// the dash distance in 'pixels'
106 double mfDiscreteDashLength;
108 protected:
109 /// local decomposition.
110 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
112 public:
113 /// constructor
114 PolyPolygonMarkerPrimitive2D(
115 const basegfx::B2DPolyPolygon& rPolyPolygon,
116 const basegfx::BColor& rRGBColorA,
117 const basegfx::BColor& rRGBColorB,
118 double fDiscreteDashLength);
120 // data read access
121 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
122 const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
123 const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
124 double getDiscreteDashLength() const { return mfDiscreteDashLength; }
126 /// compare operator
127 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
129 /// get range
130 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
132 /// provide unique ID
133 DeclPrimitive2DIDBlock()
135 } // end of namespace primitive2d
136 } // end of namespace drawinglayer
139 // PolyPolygonStrokePrimitive2D class
141 namespace drawinglayer
143 namespace primitive2d
145 /** PolyPolygonStrokePrimitive2D class
147 This primitive defines a multi-PolygonStrokePrimitive2D and is
148 just for convenience. The definition is not different from the single
149 defined PolygonStrokePrimitive2Ds.
151 class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
153 private:
154 /// the line geometry
155 basegfx::B2DPolyPolygon maPolyPolygon;
157 /// the line attributes like width, join and color
158 attribute::LineAttribute maLineAttribute;
160 /// the line stroking (if used)
161 attribute::StrokeAttribute maStrokeAttribute;
163 protected:
164 /// local decomposition.
165 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
167 public:
168 /// constructor
169 PolyPolygonStrokePrimitive2D(
170 const basegfx::B2DPolyPolygon& rPolyPolygon,
171 const attribute::LineAttribute& rLineAttribute,
172 const attribute::StrokeAttribute& rStrokeAttribute);
174 PolyPolygonStrokePrimitive2D(
175 const basegfx::B2DPolyPolygon& rPolyPolygon,
176 const attribute::LineAttribute& rLineAttribute);
178 /// data read access
179 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
180 const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
181 const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
183 /// compare operator
184 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
186 /// get range
187 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
189 /// provide unique ID
190 DeclPrimitive2DIDBlock()
192 } // end of namespace primitive2d
193 } // end of namespace drawinglayer
196 // PolyPolygonColorPrimitive2D class
198 namespace drawinglayer
200 namespace primitive2d
202 /** PolyPolygonColorPrimitive2D class
204 This primitive defines a tools::PolyPolygon filled with a single color.
205 This is one of the non-decomposable primitives, so a renderer
206 should process it.
208 class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D : public BasePrimitive2D
210 private:
211 /// the tools::PolyPolygon geometry
212 basegfx::B2DPolyPolygon maPolyPolygon;
214 /// the polygon fill color
215 basegfx::BColor maBColor;
217 public:
218 /// constructor
219 PolyPolygonColorPrimitive2D(
220 const basegfx::B2DPolyPolygon& rPolyPolygon,
221 const basegfx::BColor& rBColor);
223 /// data read access
224 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
225 const basegfx::BColor& getBColor() const { return maBColor; }
227 /// compare operator
228 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
230 /// get range
231 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
233 /// provide unique ID
234 DeclPrimitive2DIDBlock()
236 } // end of namespace primitive2d
237 } // end of namespace drawinglayer
240 // PolyPolygonGradientPrimitive2D class
242 namespace drawinglayer
244 namespace primitive2d
246 /** PolyPolygonColorPrimitive2D class
248 This primitive defines a tools::PolyPolygon filled with a gradient. The
249 decomosition will create a MaskPrimitive2D containing a
250 FillGradientPrimitive2D.
252 class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D
254 private:
255 /// the tools::PolyPolygon geometry
256 basegfx::B2DPolyPolygon maPolyPolygon;
258 /// the definition range
259 basegfx::B2DRange maDefinitionRange;
261 /// the gradient definition
262 attribute::FillGradientAttribute maFillGradient;
264 protected:
265 /// local decomposition.
266 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
268 public:
269 /// constructors. The one without definition range will use output range as definition range
270 PolyPolygonGradientPrimitive2D(
271 const basegfx::B2DPolyPolygon& rPolyPolygon,
272 const attribute::FillGradientAttribute& rFillGradient);
273 PolyPolygonGradientPrimitive2D(
274 const basegfx::B2DPolyPolygon& rPolyPolygon,
275 const basegfx::B2DRange& rDefinitionRange,
276 const attribute::FillGradientAttribute& rFillGradient);
278 /// data read access
279 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
280 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
281 const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
283 /// compare operator
284 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
286 /// provide unique ID
287 DeclPrimitive2DIDBlock()
289 } // end of namespace primitive2d
290 } // end of namespace drawinglayer
293 // PolyPolygonHatchPrimitive2D class
295 namespace drawinglayer
297 namespace primitive2d
299 /** PolyPolygonHatchPrimitive2D class
301 This primitive defines a tools::PolyPolygon filled with a hatch. The
302 decomosition will create a MaskPrimitive2D containing a
303 FillHatchPrimitive2D.
305 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D
307 private:
308 /// the tools::PolyPolygon geometry
309 basegfx::B2DPolyPolygon maPolyPolygon;
311 /// the definition range
312 basegfx::B2DRange maDefinitionRange;
314 /// the hatch background color (if used)
315 basegfx::BColor maBackgroundColor;
317 /// the hatch definition
318 attribute::FillHatchAttribute maFillHatch;
320 protected:
321 /// local decomposition.
322 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
324 public:
325 /// constructors. The one without definition range will use output range as definition range
326 PolyPolygonHatchPrimitive2D(
327 const basegfx::B2DPolyPolygon& rPolyPolygon,
328 const basegfx::BColor& rBackgroundColor,
329 const attribute::FillHatchAttribute& rFillHatch);
330 PolyPolygonHatchPrimitive2D(
331 const basegfx::B2DPolyPolygon& rPolyPolygon,
332 const basegfx::B2DRange& rDefinitionRange,
333 const basegfx::BColor& rBackgroundColor,
334 const attribute::FillHatchAttribute& rFillHatch);
336 /// data read access
337 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
338 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
339 const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
340 const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
342 /// compare operator
343 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
345 /// provide unique ID
346 DeclPrimitive2DIDBlock()
348 } // end of namespace primitive2d
349 } // end of namespace drawinglayer
352 // PolyPolygonGraphicPrimitive2D class
354 namespace drawinglayer
356 namespace primitive2d
358 /** PolyPolygonGraphicPrimitive2D class
360 This primitive defines a tools::PolyPolygon filled with bitmap data
361 (including transparence). The decomosition will create a MaskPrimitive2D
362 containing a FillGraphicPrimitive2D.
364 class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D : public BufferedDecompositionPrimitive2D
366 private:
367 /// the tools::PolyPolygon geometry
368 basegfx::B2DPolyPolygon maPolyPolygon;
370 /// the definition range
371 basegfx::B2DRange maDefinitionRange;
373 /// the bitmap fill definition (may include tiling)
374 attribute::FillGraphicAttribute maFillGraphic;
376 protected:
377 /// local decomposition.
378 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
380 public:
381 /// constructors. The one without definition range will use output range as definition range
382 PolyPolygonGraphicPrimitive2D(
383 const basegfx::B2DPolyPolygon& rPolyPolygon,
384 const attribute::FillGraphicAttribute& rFillGraphic);
385 PolyPolygonGraphicPrimitive2D(
386 const basegfx::B2DPolyPolygon& rPolyPolygon,
387 const basegfx::B2DRange& rDefinitionRange,
388 const attribute::FillGraphicAttribute& rFillGraphic);
390 /// data read access
391 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
392 const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
393 const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
395 /// compare operator
396 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
398 /// provide unique ID
399 DeclPrimitive2DIDBlock()
401 } // end of namespace primitive2d
402 } // end of namespace drawinglayer
405 // PolyPolygonSelectionPrimitive2D class
407 namespace drawinglayer
409 namespace primitive2d
411 /** PolyPolygonSelectionPrimitive2D class
413 This primitive defines a tools::PolyPolygon which gets filled with a defined color
414 and a defined transparence, but also gets extended ('grown') by the given
415 discrete size (thus being a view-dependent primitive)
417 class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D : public DiscreteMetricDependentPrimitive2D
419 private:
420 /// the tools::PolyPolygon geometry
421 basegfx::B2DPolyPolygon maPolyPolygon;
423 /// the color
424 basegfx::BColor maColor;
426 /// the transparence [0.0 .. 1.0]
427 double mfTransparence;
429 /// the discrete grow size ('pixels'), only positive values allowed
430 double mfDiscreteGrow;
432 /// draw polygons filled when fill is set
433 bool mbFill : 1;
435 protected:
436 /// local decomposition.
437 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
439 public:
440 /// constructor
441 PolyPolygonSelectionPrimitive2D(
442 const basegfx::B2DPolyPolygon& rPolyPolygon,
443 const basegfx::BColor& rColor,
444 double fTransparence,
445 double fDiscreteGrow,
446 bool bFill);
448 /// data read access
449 const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
450 const basegfx::BColor& getColor() const { return maColor; }
451 double getTransparence() const { return mfTransparence; }
452 double getDiscreteGrow() const { return mfDiscreteGrow; }
453 bool getFill() const { return mbFill; }
455 /// compare operator
456 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
458 /// get range
459 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
461 /// provide unique ID
462 DeclPrimitive2DIDBlock()
464 } // end of namespace primitive2d
465 } // end of namespace drawinglayer
468 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
470 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */