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 .
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
26 #include <basegfx/polygon/b2dpolygon.hxx>
27 #include <basegfx/color/bcolor.hxx>
29 namespace drawinglayer::primitive2d
31 /** PolygonMarkerPrimitive2D class
33 This primitive defines a two-colored marker hairline which is
34 dashed with the given dash length. Since hairlines are view-dependent,
35 this primitive is view-dependent, too.
37 It will be decomposed to the needed PolygonHairlinePrimitive2D if
38 not handled directly by a renderer.
40 class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final
41 : public BufferedDecompositionPrimitive2D
44 /// the marker hairline geometry
45 basegfx::B2DPolygon maPolygon
;
48 basegfx::BColor maRGBColorA
;
49 basegfx::BColor maRGBColorB
;
51 /// the dash distance in 'pixels'
52 double mfDiscreteDashLength
;
54 /// decomposition is view-dependent, remember last InverseObjectToViewTransformation
55 basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation
;
57 /// local decomposition.
59 create2DDecomposition(Primitive2DContainer
& rContainer
,
60 const geometry::ViewInformation2D
& rViewInformation
) const override
;
64 PolygonMarkerPrimitive2D(basegfx::B2DPolygon aPolygon
, const basegfx::BColor
& rRGBColorA
,
65 const basegfx::BColor
& rRGBColorB
, double fDiscreteDashLength
);
68 const basegfx::B2DPolygon
& getB2DPolygon() const { return maPolygon
; }
69 const basegfx::BColor
& getRGBColorA() const { return maRGBColorA
; }
70 const basegfx::BColor
& getRGBColorB() const { return maRGBColorB
; }
71 double getDiscreteDashLength() const { return mfDiscreteDashLength
; }
74 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const override
;
77 virtual basegfx::B2DRange
78 getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
80 /// Override standard getDecomposition to be view-dependent here
82 get2DDecomposition(Primitive2DDecompositionVisitor
& rVisitor
,
83 const geometry::ViewInformation2D
& rViewInformation
) const override
;
86 virtual sal_uInt32
getPrimitive2DID() const override
;
89 } // end of namespace primitive2d::drawinglayer
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */