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_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/fillgradientattribute.hxx>
31 #include <drawinglayer/attribute/fillhatchattribute.hxx>
32 #include <drawinglayer/primitive2d/primitivetools2d.hxx>
33 #include <basegfx/color/bcolor.hxx>
36 // PolyPolygonHairlinePrimitive2D class
38 namespace drawinglayer
42 /** PolyPolygonHairlinePrimitive2D class
44 This primitive defines a multi-PolygonHairlinePrimitive2D and is
45 just for convenience. The definition is not different from the single
46 defined PolygonHairlinePrimitive2Ds.
48 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D
: public BufferedDecompositionPrimitive2D
51 /// the hairline geometry
52 basegfx::B2DPolyPolygon maPolyPolygon
;
54 /// the hairline color
55 basegfx::BColor maBColor
;
58 /// local decomposition.
59 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
63 PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon
& rPolyPolygon
, const basegfx::BColor
& rBColor
);
66 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
67 const basegfx::BColor
& getBColor() const { return maBColor
; }
70 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
73 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
76 DeclPrimitive2DIDBlock()
78 } // end of namespace primitive2d
79 } // end of namespace drawinglayer
82 // PolyPolygonMarkerPrimitive2D class
84 namespace drawinglayer
88 /** PolyPolygonMarkerPrimitive2D class
90 This primitive defines a multi-PolygonMarkerPrimitive2D and is
91 just for convenience. The definition is not different from the single
92 defined PolygonMarkerPrimitive2Ds.
94 class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D
: public BufferedDecompositionPrimitive2D
97 /// the marker hairline geometry
98 basegfx::B2DPolyPolygon maPolyPolygon
;
101 basegfx::BColor maRGBColorA
;
102 basegfx::BColor maRGBColorB
;
104 /// the dash distance in 'pixels'
105 double mfDiscreteDashLength
;
108 /// local decomposition.
109 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
113 PolyPolygonMarkerPrimitive2D(
114 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
115 const basegfx::BColor
& rRGBColorA
,
116 const basegfx::BColor
& rRGBColorB
,
117 double fDiscreteDashLength
);
120 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
121 const basegfx::BColor
& getRGBColorA() const { return maRGBColorA
; }
122 const basegfx::BColor
& getRGBColorB() const { return maRGBColorB
; }
123 double getDiscreteDashLength() const { return mfDiscreteDashLength
; }
126 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
129 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
131 /// provide unique ID
132 DeclPrimitive2DIDBlock()
134 } // end of namespace primitive2d
135 } // end of namespace drawinglayer
138 // PolyPolygonStrokePrimitive2D class
140 namespace drawinglayer
142 namespace primitive2d
144 /** PolyPolygonStrokePrimitive2D class
146 This primitive defines a multi-PolygonStrokePrimitive2D and is
147 just for convenience. The definition is not different from the single
148 defined PolygonStrokePrimitive2Ds.
150 class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D
: public BufferedDecompositionPrimitive2D
153 /// the line geometry
154 basegfx::B2DPolyPolygon maPolyPolygon
;
156 /// the line attributes like width, join and color
157 attribute::LineAttribute maLineAttribute
;
159 /// the line stroking (if used)
160 attribute::StrokeAttribute maStrokeAttribute
;
163 /// local decomposition.
164 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
168 PolyPolygonStrokePrimitive2D(
169 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
170 const attribute::LineAttribute
& rLineAttribute
,
171 const attribute::StrokeAttribute
& rStrokeAttribute
);
173 PolyPolygonStrokePrimitive2D(
174 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
175 const attribute::LineAttribute
& rLineAttribute
);
178 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
179 const attribute::LineAttribute
& getLineAttribute() const { return maLineAttribute
; }
180 const attribute::StrokeAttribute
& getStrokeAttribute() const { return maStrokeAttribute
; }
183 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
186 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
188 /// provide unique ID
189 DeclPrimitive2DIDBlock()
191 } // end of namespace primitive2d
192 } // end of namespace drawinglayer
195 // PolyPolygonColorPrimitive2D class
197 namespace drawinglayer
199 namespace primitive2d
201 /** PolyPolygonColorPrimitive2D class
203 This primitive defines a tools::PolyPolygon filled with a single color.
204 This is one of the non-decomposable primitives, so a renderer
207 class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D
: public BasePrimitive2D
210 /// the tools::PolyPolygon geometry
211 basegfx::B2DPolyPolygon maPolyPolygon
;
213 /// the polygon fill color
214 basegfx::BColor maBColor
;
218 PolyPolygonColorPrimitive2D(
219 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
220 const basegfx::BColor
& rBColor
);
223 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
224 const basegfx::BColor
& getBColor() const { return maBColor
; }
227 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
230 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
232 /// provide unique ID
233 DeclPrimitive2DIDBlock()
235 } // end of namespace primitive2d
236 } // end of namespace drawinglayer
239 // PolyPolygonGradientPrimitive2D class
241 namespace drawinglayer
243 namespace primitive2d
245 /** PolyPolygonColorPrimitive2D class
247 This primitive defines a tools::PolyPolygon filled with a gradient. The
248 decomosition will create a MaskPrimitive2D containing a
249 FillGradientPrimitive2D.
251 class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D
: public BufferedDecompositionPrimitive2D
254 /// the tools::PolyPolygon geometry
255 basegfx::B2DPolyPolygon maPolyPolygon
;
257 /// the definition range
258 basegfx::B2DRange maDefinitionRange
;
260 /// the gradient definition
261 attribute::FillGradientAttribute maFillGradient
;
264 /// local decomposition.
265 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
268 /// constructors. The one without definition range will use output range as definition range
269 PolyPolygonGradientPrimitive2D(
270 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
271 const attribute::FillGradientAttribute
& rFillGradient
);
272 PolyPolygonGradientPrimitive2D(
273 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
274 const basegfx::B2DRange
& rDefinitionRange
,
275 const attribute::FillGradientAttribute
& rFillGradient
);
278 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
279 const basegfx::B2DRange
& getDefinitionRange() const { return maDefinitionRange
; }
280 const attribute::FillGradientAttribute
& getFillGradient() const { return maFillGradient
; }
283 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
285 /// provide unique ID
286 DeclPrimitive2DIDBlock()
288 } // end of namespace primitive2d
289 } // end of namespace drawinglayer
292 // PolyPolygonHatchPrimitive2D class
294 namespace drawinglayer
296 namespace primitive2d
298 /** PolyPolygonHatchPrimitive2D class
300 This primitive defines a tools::PolyPolygon filled with a hatch. The
301 decomosition will create a MaskPrimitive2D containing a
302 FillHatchPrimitive2D.
304 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D
: public BufferedDecompositionPrimitive2D
307 /// the tools::PolyPolygon geometry
308 basegfx::B2DPolyPolygon maPolyPolygon
;
310 /// the definition range
311 basegfx::B2DRange maDefinitionRange
;
313 /// the hatch background color (if used)
314 basegfx::BColor maBackgroundColor
;
316 /// the hatch definition
317 attribute::FillHatchAttribute maFillHatch
;
320 /// local decomposition.
321 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
324 /// constructors. The one without definition range will use output range as definition range
325 PolyPolygonHatchPrimitive2D(
326 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
327 const basegfx::BColor
& rBackgroundColor
,
328 const attribute::FillHatchAttribute
& rFillHatch
);
329 PolyPolygonHatchPrimitive2D(
330 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
331 const basegfx::B2DRange
& rDefinitionRange
,
332 const basegfx::BColor
& rBackgroundColor
,
333 const attribute::FillHatchAttribute
& rFillHatch
);
336 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
337 const basegfx::B2DRange
& getDefinitionRange() const { return maDefinitionRange
; }
338 const basegfx::BColor
& getBackgroundColor() const { return maBackgroundColor
; }
339 const attribute::FillHatchAttribute
& getFillHatch() const { return maFillHatch
; }
342 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
344 /// provide unique ID
345 DeclPrimitive2DIDBlock()
347 } // end of namespace primitive2d
348 } // end of namespace drawinglayer
351 // PolyPolygonGraphicPrimitive2D class
353 namespace drawinglayer
355 namespace primitive2d
357 /** PolyPolygonGraphicPrimitive2D class
359 This primitive defines a tools::PolyPolygon filled with bitmap data
360 (including transparence). The decomosition will create a MaskPrimitive2D
361 containing a FillGraphicPrimitive2D.
363 class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D
: public BufferedDecompositionPrimitive2D
366 /// the tools::PolyPolygon geometry
367 basegfx::B2DPolyPolygon maPolyPolygon
;
369 /// the definition range
370 basegfx::B2DRange maDefinitionRange
;
372 /// the bitmap fill definition (may include tiling)
373 attribute::FillGraphicAttribute maFillGraphic
;
376 /// local decomposition.
377 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
380 PolyPolygonGraphicPrimitive2D(
381 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
382 const basegfx::B2DRange
& rDefinitionRange
,
383 const attribute::FillGraphicAttribute
& rFillGraphic
);
386 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
387 const basegfx::B2DRange
& getDefinitionRange() const { return maDefinitionRange
; }
388 const attribute::FillGraphicAttribute
& getFillGraphic() const { return maFillGraphic
; }
391 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
393 /// provide unique ID
394 DeclPrimitive2DIDBlock()
396 } // end of namespace primitive2d
397 } // end of namespace drawinglayer
400 // PolyPolygonSelectionPrimitive2D class
402 namespace drawinglayer
404 namespace primitive2d
406 /** PolyPolygonSelectionPrimitive2D class
408 This primitive defines a tools::PolyPolygon which gets filled with a defined color
409 and a defined transparence, but also gets extended ('grown') by the given
410 discrete size (thus being a view-dependent primitive)
412 class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D
: public DiscreteMetricDependentPrimitive2D
415 /// the tools::PolyPolygon geometry
416 basegfx::B2DPolyPolygon maPolyPolygon
;
419 basegfx::BColor maColor
;
421 /// the transparence [0.0 .. 1.0]
422 double mfTransparence
;
424 /// the discrete grow size ('pixels'), only positive values allowed
425 double mfDiscreteGrow
;
427 /// draw polygons filled when fill is set
431 /// local decomposition.
432 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
436 PolyPolygonSelectionPrimitive2D(
437 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
438 const basegfx::BColor
& rColor
,
439 double fTransparence
,
440 double fDiscreteGrow
,
444 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
445 const basegfx::BColor
& getColor() const { return maColor
; }
446 double getTransparence() const { return mfTransparence
; }
447 double getDiscreteGrow() const { return mfDiscreteGrow
; }
448 bool getFill() const { return mbFill
; }
451 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
454 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
456 /// provide unique ID
457 DeclPrimitive2DIDBlock()
459 } // end of namespace primitive2d
460 } // end of namespace drawinglayer
463 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
465 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */