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/fillbitmapattribute.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 <basegfx/color/bcolor.hxx>
35 //////////////////////////////////////////////////////////////////////////////
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 Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
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;
73 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const;
76 DeclPrimitive2DIDBlock()
78 } // end of namespace primitive2d
79 } // end of namespace drawinglayer
81 //////////////////////////////////////////////////////////////////////////////
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 Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
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;
129 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const;
131 /// provide unique ID
132 DeclPrimitive2DIDBlock()
134 } // end of namespace primitive2d
135 } // end of namespace drawinglayer
137 //////////////////////////////////////////////////////////////////////////////
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 Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
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;
186 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const;
188 /// provide unique ID
189 DeclPrimitive2DIDBlock()
191 } // end of namespace primitive2d
192 } // end of namespace drawinglayer
194 //////////////////////////////////////////////////////////////////////////////
195 // PolyPolygonColorPrimitive2D class
197 namespace drawinglayer
199 namespace primitive2d
201 /** PolyPolygonColorPrimitive2D class
203 This primitive defines a 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 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;
230 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const;
232 /// provide unique ID
233 DeclPrimitive2DIDBlock()
235 } // end of namespace primitive2d
236 } // end of namespace drawinglayer
238 //////////////////////////////////////////////////////////////////////////////
239 // PolyPolygonGradientPrimitive2D class
241 namespace drawinglayer
243 namespace primitive2d
245 /** PolyPolygonColorPrimitive2D class
247 This primitive defines a 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 PolyPolygon geometry
255 basegfx::B2DPolyPolygon maPolyPolygon
;
257 /// the gradient definition
258 attribute::FillGradientAttribute maFillGradient
;
261 /// local decomposition.
262 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
266 PolyPolygonGradientPrimitive2D(
267 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
268 const attribute::FillGradientAttribute
& rFillGradient
);
271 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
272 const attribute::FillGradientAttribute
& getFillGradient() const { return maFillGradient
; }
275 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const;
277 /// provide unique ID
278 DeclPrimitive2DIDBlock()
280 } // end of namespace primitive2d
281 } // end of namespace drawinglayer
283 //////////////////////////////////////////////////////////////////////////////
284 // PolyPolygonHatchPrimitive2D class
286 namespace drawinglayer
288 namespace primitive2d
290 /** PolyPolygonHatchPrimitive2D class
292 This primitive defines a PolyPolygon filled with a hatch. The
293 decomosition will create a MaskPrimitive2D containing a
294 FillHatchPrimitive2D.
296 class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D
: public BufferedDecompositionPrimitive2D
299 /// the PolyPolygon geometry
300 basegfx::B2DPolyPolygon maPolyPolygon
;
302 /// the hatch background color (if used)
303 basegfx::BColor maBackgroundColor
;
305 /// the hatch definition
306 attribute::FillHatchAttribute maFillHatch
;
309 /// local decomposition.
310 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
314 PolyPolygonHatchPrimitive2D(
315 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
316 const basegfx::BColor
& rBackgroundColor
,
317 const attribute::FillHatchAttribute
& rFillHatch
);
320 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
321 const basegfx::BColor
& getBackgroundColor() const { return maBackgroundColor
; }
322 const attribute::FillHatchAttribute
& getFillHatch() const { return maFillHatch
; }
325 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const;
327 /// provide unique ID
328 DeclPrimitive2DIDBlock()
330 } // end of namespace primitive2d
331 } // end of namespace drawinglayer
333 //////////////////////////////////////////////////////////////////////////////
334 // PolyPolygonBitmapPrimitive2D class
336 namespace drawinglayer
338 namespace primitive2d
340 /** PolyPolygonBitmapPrimitive2D class
342 This primitive defines a PolyPolygon filled with bitmap data
343 (including transparence). The decomosition will create a MaskPrimitive2D
344 containing a FillBitmapPrimitive2D.
346 class DRAWINGLAYER_DLLPUBLIC PolyPolygonBitmapPrimitive2D
: public BufferedDecompositionPrimitive2D
349 /// the PolyPolygon geometry
350 basegfx::B2DPolyPolygon maPolyPolygon
;
352 /// the bitmap fill definition (may include tiling)
353 attribute::FillBitmapAttribute maFillBitmap
;
356 /// local decomposition.
357 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
361 PolyPolygonBitmapPrimitive2D(
362 const basegfx::B2DPolyPolygon
& rPolyPolygon
,
363 const attribute::FillBitmapAttribute
& rFillBitmap
);
366 const basegfx::B2DPolyPolygon
& getB2DPolyPolygon() const { return maPolyPolygon
; }
367 const attribute::FillBitmapAttribute
& getFillBitmap() const { return maFillBitmap
; }
370 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const;
372 /// provide unique ID
373 DeclPrimitive2DIDBlock()
375 } // end of namespace primitive2d
376 } // end of namespace drawinglayer
378 //////////////////////////////////////////////////////////////////////////////
380 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
382 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */