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/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
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
52 /// the hairline geometry
53 basegfx::B2DPolyPolygon maPolyPolygon
;
55 /// the hairline color
56 basegfx::BColor maBColor
;
59 /// local decomposition.
60 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
64 PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon
& rPolyPolygon
, const basegfx::BColor
& rBColor
);
67 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
68 const basegfx::BColor
& getBColor() const { return maBColor
; }
71 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
74 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
77 DeclPrimitive2DIDBlock()
79 } // end of namespace primitive2d
80 } // end of namespace drawinglayer
83 // PolyPolygonMarkerPrimitive2D class
85 namespace drawinglayer
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
98 /// the marker hairline geometry
99 basegfx::B2DPolyPolygon maPolyPolygon
;
102 basegfx::BColor maRGBColorA
;
103 basegfx::BColor maRGBColorB
;
105 /// the dash distance in 'pixels'
106 double mfDiscreteDashLength
;
109 /// local decomposition.
110 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
114 PolyPolygonMarkerPrimitive2D(
115 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
116 const basegfx::BColor
& rRGBColorA
,
117 const basegfx::BColor
& rRGBColorB
,
118 double fDiscreteDashLength
);
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
; }
127 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
130 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_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
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
;
164 /// local decomposition.
165 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
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
);
179 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
180 const attribute::LineAttribute
& getLineAttribute() const { return maLineAttribute
; }
181 const attribute::StrokeAttribute
& getStrokeAttribute() const { return maStrokeAttribute
; }
184 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
187 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_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
208 class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D
: public BasePrimitive2D
211 /// the tools::PolyPolygon geometry
212 basegfx::B2DPolyPolygon maPolyPolygon
;
214 /// the polygon fill color
215 basegfx::BColor maBColor
;
219 PolyPolygonColorPrimitive2D(
220 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
221 const basegfx::BColor
& rBColor
);
224 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
225 const basegfx::BColor
& getBColor() const { return maBColor
; }
228 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
231 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_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
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
;
265 /// local decomposition.
266 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
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
);
279 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
280 const basegfx::B2DRange
& getDefinitionRange() const { return maDefinitionRange
; }
281 const attribute::FillGradientAttribute
& getFillGradient() const { return maFillGradient
; }
284 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_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
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
;
321 /// local decomposition.
322 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
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
);
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
; }
343 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_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
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
;
377 /// local decomposition.
378 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
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
);
391 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
392 const basegfx::B2DRange
& getDefinitionRange() const { return maDefinitionRange
; }
393 const attribute::FillGraphicAttribute
& getFillGraphic() const { return maFillGraphic
; }
396 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_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
420 /// the tools::PolyPolygon geometry
421 basegfx::B2DPolyPolygon maPolyPolygon
;
424 basegfx::BColor maColor
;
426 /// the transparence [0.0 .. 1.0]
427 double mfTransparence
;
429 /// the discrete grow size ('pixels'), only posivive values allowed
430 double mfDiscreteGrow
;
433 /// draw polygons filled when fill is set
437 /// local decomposition.
438 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
442 PolyPolygonSelectionPrimitive2D(
443 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
444 const basegfx::BColor
& rColor
,
445 double fTransparence
,
446 double fDiscreteGrow
,
450 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
451 const basegfx::BColor
& getColor() const { return maColor
; }
452 double getTransparence() const { return mfTransparence
; }
453 double getDiscreteGrow() const { return mfDiscreteGrow
; }
454 bool getFill() const { return mbFill
; }
457 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
460 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
462 /// provide unique ID
463 DeclPrimitive2DIDBlock()
465 } // end of namespace primitive2d
466 } // end of namespace drawinglayer
470 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
472 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */