Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
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>
34 :
35 : //////////////////////////////////////////////////////////////////////////////
36 : // PolyPolygonHairlinePrimitive2D class
37 :
38 : namespace drawinglayer
39 : {
40 : namespace primitive2d
41 : {
42 : /** PolyPolygonHairlinePrimitive2D class
43 :
44 : This primitive defines a multi-PolygonHairlinePrimitive2D and is
45 : just for convenience. The definition is not different from the single
46 : defined PolygonHairlinePrimitive2Ds.
47 : */
48 324 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonHairlinePrimitive2D : public BufferedDecompositionPrimitive2D
49 : {
50 : private:
51 : /// the hairline geometry
52 : basegfx::B2DPolyPolygon maPolyPolygon;
53 :
54 : /// the hairline color
55 : basegfx::BColor maBColor;
56 :
57 : protected:
58 : /// local decomposition.
59 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
60 :
61 : public:
62 : /// constructor
63 : PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor);
64 :
65 : /// data read access
66 221 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
67 944 : const basegfx::BColor& getBColor() const { return maBColor; }
68 :
69 : /// compare operator
70 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
71 :
72 : /// get range
73 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
74 :
75 : /// provide unique ID
76 : DeclPrimitrive2DIDBlock()
77 : };
78 : } // end of namespace primitive2d
79 : } // end of namespace drawinglayer
80 :
81 : //////////////////////////////////////////////////////////////////////////////
82 : // PolyPolygonMarkerPrimitive2D class
83 :
84 : namespace drawinglayer
85 : {
86 : namespace primitive2d
87 : {
88 : /** PolyPolygonMarkerPrimitive2D class
89 :
90 : This primitive defines a multi-PolygonMarkerPrimitive2D and is
91 : just for convenience. The definition is not different from the single
92 : defined PolygonMarkerPrimitive2Ds.
93 : */
94 0 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
95 : {
96 : private:
97 : /// the marker hairline geometry
98 : basegfx::B2DPolyPolygon maPolyPolygon;
99 :
100 : /// the two colors
101 : basegfx::BColor maRGBColorA;
102 : basegfx::BColor maRGBColorB;
103 :
104 : /// the dash distance in 'pixels'
105 : double mfDiscreteDashLength;
106 :
107 : protected:
108 : /// local decomposition.
109 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
110 :
111 : public:
112 : /// constructor
113 : PolyPolygonMarkerPrimitive2D(
114 : const basegfx::B2DPolyPolygon& rPolyPolygon,
115 : const basegfx::BColor& rRGBColorA,
116 : const basegfx::BColor& rRGBColorB,
117 : double fDiscreteDashLength);
118 :
119 : // data read access
120 0 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
121 0 : const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
122 0 : const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
123 0 : double getDiscreteDashLength() const { return mfDiscreteDashLength; }
124 :
125 : /// compare operator
126 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
127 :
128 : /// get range
129 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
130 :
131 : /// provide unique ID
132 : DeclPrimitrive2DIDBlock()
133 : };
134 : } // end of namespace primitive2d
135 : } // end of namespace drawinglayer
136 :
137 : //////////////////////////////////////////////////////////////////////////////
138 : // PolyPolygonStrokePrimitive2D class
139 :
140 : namespace drawinglayer
141 : {
142 : namespace primitive2d
143 : {
144 : /** PolyPolygonStrokePrimitive2D class
145 :
146 : This primitive defines a multi-PolygonStrokePrimitive2D and is
147 : just for convenience. The definition is not different from the single
148 : defined PolygonStrokePrimitive2Ds.
149 : */
150 16 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
151 : {
152 : private:
153 : /// the line geometry
154 : basegfx::B2DPolyPolygon maPolyPolygon;
155 :
156 : /// the line attributes like width, join and color
157 : attribute::LineAttribute maLineAttribute;
158 :
159 : /// the line stroking (if used)
160 : attribute::StrokeAttribute maStrokeAttribute;
161 :
162 : protected:
163 : /// local decomposition.
164 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
165 :
166 : public:
167 : /// constructor
168 : PolyPolygonStrokePrimitive2D(
169 : const basegfx::B2DPolyPolygon& rPolyPolygon,
170 : const attribute::LineAttribute& rLineAttribute,
171 : const attribute::StrokeAttribute& rStrokeAttribute);
172 :
173 : PolyPolygonStrokePrimitive2D(
174 : const basegfx::B2DPolyPolygon& rPolyPolygon,
175 : const attribute::LineAttribute& rLineAttribute);
176 :
177 : /// data read access
178 8 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
179 8 : const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
180 8 : const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
181 :
182 : /// compare operator
183 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
184 :
185 : /// get range
186 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
187 :
188 : /// provide unique ID
189 : DeclPrimitrive2DIDBlock()
190 : };
191 : } // end of namespace primitive2d
192 : } // end of namespace drawinglayer
193 :
194 : //////////////////////////////////////////////////////////////////////////////
195 : // PolyPolygonColorPrimitive2D class
196 :
197 : namespace drawinglayer
198 : {
199 : namespace primitive2d
200 : {
201 : /** PolyPolygonColorPrimitive2D class
202 :
203 : This primitive defines a PolyPolygon filled with a single color.
204 : This is one of the non-decomposable primitives, so a renderer
205 : should proccess it.
206 : */
207 814 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonColorPrimitive2D : public BasePrimitive2D
208 : {
209 : private:
210 : /// the PolyPolygon geometry
211 : basegfx::B2DPolyPolygon maPolyPolygon;
212 :
213 : /// the polygon fill color
214 : basegfx::BColor maBColor;
215 :
216 : public:
217 : /// constructor
218 : PolyPolygonColorPrimitive2D(
219 : const basegfx::B2DPolyPolygon& rPolyPolygon,
220 : const basegfx::BColor& rBColor);
221 :
222 : /// data read access
223 471 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
224 207 : const basegfx::BColor& getBColor() const { return maBColor; }
225 :
226 : /// compare operator
227 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
228 :
229 : /// get range
230 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
231 :
232 : /// provide unique ID
233 : DeclPrimitrive2DIDBlock()
234 : };
235 : } // end of namespace primitive2d
236 : } // end of namespace drawinglayer
237 :
238 : //////////////////////////////////////////////////////////////////////////////
239 : // PolyPolygonGradientPrimitive2D class
240 :
241 : namespace drawinglayer
242 : {
243 : namespace primitive2d
244 : {
245 : /** PolyPolygonColorPrimitive2D class
246 :
247 : This primitive defines a PolyPolygon filled with a gradient. The
248 : decomosition will create a MaskPrimitive2D containing a
249 : FillGradientPrimitive2D.
250 : */
251 0 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonGradientPrimitive2D : public BufferedDecompositionPrimitive2D
252 : {
253 : private:
254 : /// the PolyPolygon geometry
255 : basegfx::B2DPolyPolygon maPolyPolygon;
256 :
257 : /// the gradient definition
258 : attribute::FillGradientAttribute maFillGradient;
259 :
260 : protected:
261 : /// local decomposition.
262 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
263 :
264 : public:
265 : /// constructor
266 : PolyPolygonGradientPrimitive2D(
267 : const basegfx::B2DPolyPolygon& rPolyPolygon,
268 : const attribute::FillGradientAttribute& rFillGradient);
269 :
270 : /// data read access
271 0 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
272 0 : const attribute::FillGradientAttribute& getFillGradient() const { return maFillGradient; }
273 :
274 : /// compare operator
275 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
276 :
277 : /// provide unique ID
278 : DeclPrimitrive2DIDBlock()
279 : };
280 : } // end of namespace primitive2d
281 : } // end of namespace drawinglayer
282 :
283 : //////////////////////////////////////////////////////////////////////////////
284 : // PolyPolygonHatchPrimitive2D class
285 :
286 : namespace drawinglayer
287 : {
288 : namespace primitive2d
289 : {
290 : /** PolyPolygonHatchPrimitive2D class
291 :
292 : This primitive defines a PolyPolygon filled with a hatch. The
293 : decomosition will create a MaskPrimitive2D containing a
294 : FillHatchPrimitive2D.
295 : */
296 0 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonHatchPrimitive2D : public BufferedDecompositionPrimitive2D
297 : {
298 : private:
299 : /// the PolyPolygon geometry
300 : basegfx::B2DPolyPolygon maPolyPolygon;
301 :
302 : /// the hatch background color (if used)
303 : basegfx::BColor maBackgroundColor;
304 :
305 : /// the hatch definition
306 : attribute::FillHatchAttribute maFillHatch;
307 :
308 : protected:
309 : /// local decomposition.
310 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
311 :
312 : public:
313 : /// constructor
314 : PolyPolygonHatchPrimitive2D(
315 : const basegfx::B2DPolyPolygon& rPolyPolygon,
316 : const basegfx::BColor& rBackgroundColor,
317 : const attribute::FillHatchAttribute& rFillHatch);
318 :
319 : /// data read access
320 0 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
321 0 : const basegfx::BColor& getBackgroundColor() const { return maBackgroundColor; }
322 0 : const attribute::FillHatchAttribute& getFillHatch() const { return maFillHatch; }
323 :
324 : /// compare operator
325 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
326 :
327 : /// provide unique ID
328 : DeclPrimitrive2DIDBlock()
329 : };
330 : } // end of namespace primitive2d
331 : } // end of namespace drawinglayer
332 :
333 : //////////////////////////////////////////////////////////////////////////////
334 : // PolyPolygonBitmapPrimitive2D class
335 :
336 : namespace drawinglayer
337 : {
338 : namespace primitive2d
339 : {
340 : /** PolyPolygonBitmapPrimitive2D class
341 :
342 : This primitive defines a PolyPolygon filled with bitmap data
343 : (including transparence). The decomosition will create a MaskPrimitive2D
344 : containing a FillBitmapPrimitive2D.
345 : */
346 0 : class DRAWINGLAYER_DLLPUBLIC PolyPolygonBitmapPrimitive2D : public BufferedDecompositionPrimitive2D
347 : {
348 : private:
349 : /// the PolyPolygon geometry
350 : basegfx::B2DPolyPolygon maPolyPolygon;
351 :
352 : /// the bitmap fill definition (may include tiling)
353 : attribute::FillBitmapAttribute maFillBitmap;
354 :
355 : protected:
356 : /// local decomposition.
357 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
358 :
359 : public:
360 : /// constructor
361 : PolyPolygonBitmapPrimitive2D(
362 : const basegfx::B2DPolyPolygon& rPolyPolygon,
363 : const attribute::FillBitmapAttribute& rFillBitmap);
364 :
365 : /// data read access
366 0 : const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
367 0 : const attribute::FillBitmapAttribute& getFillBitmap() const { return maFillBitmap; }
368 :
369 : /// compare operator
370 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
371 :
372 : /// provide unique ID
373 : DeclPrimitrive2DIDBlock()
374 : };
375 : } // end of namespace primitive2d
376 : } // end of namespace drawinglayer
377 :
378 : //////////////////////////////////////////////////////////////////////////////
379 :
380 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX
381 :
382 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|