/src/libreoffice/include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <drawinglayer/drawinglayerdllapi.h> |
23 | | |
24 | | #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx> |
25 | | #include <drawinglayer/attribute/lineattribute.hxx> |
26 | | #include <drawinglayer/attribute/strokeattribute.hxx> |
27 | | #include <basegfx/polygon/b2dpolygon.hxx> |
28 | | |
29 | | namespace drawinglayer::primitive2d |
30 | | { |
31 | | /** PolygonStrokePrimitive2D class |
32 | | |
33 | | This primitive defines a line with line width, line join, line color |
34 | | and stroke attributes. It will be decomposed dependent on the definition |
35 | | to the needed primitives, e.g. filled PolyPolygons for fat lines. |
36 | | */ |
37 | | class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D |
38 | | { |
39 | | private: |
40 | | /// the line geometry |
41 | | basegfx::B2DPolygon maPolygon; |
42 | | |
43 | | /// the line attributes like width, join and color |
44 | | attribute::LineAttribute maLineAttribute; |
45 | | |
46 | | /// the line stroking (if used) |
47 | | attribute::StrokeAttribute maStrokeAttribute; |
48 | | |
49 | | /// the buffered result of PolygonStrokePrimitive2D::getB2DRange |
50 | | mutable basegfx::B2DRange maBufferedRange; |
51 | | |
52 | | protected: |
53 | | /// local decomposition. |
54 | | virtual Primitive2DReference |
55 | | create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override; |
56 | | |
57 | | public: |
58 | | /// constructor |
59 | | PolygonStrokePrimitive2D(basegfx::B2DPolygon aPolygon, |
60 | | const attribute::LineAttribute& rLineAttribute, |
61 | | attribute::StrokeAttribute aStrokeAttribute); |
62 | | |
63 | | /// constructor without stroking |
64 | | PolygonStrokePrimitive2D(basegfx::B2DPolygon aPolygon, |
65 | | const attribute::LineAttribute& rLineAttribute); |
66 | | |
67 | | /// data read access |
68 | 3.89k | const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } |
69 | 7.06k | const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } |
70 | 5.78k | const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } |
71 | | |
72 | | /// compare operator |
73 | | virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; |
74 | | |
75 | | /// get range |
76 | | virtual basegfx::B2DRange |
77 | | getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; |
78 | | |
79 | | /// provide unique ID |
80 | | virtual sal_uInt32 getPrimitive2DID() const override; |
81 | | }; |
82 | | |
83 | | } // end of namespace primitive2d::drawinglayer |
84 | | |
85 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |