Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/drawinglayer/primitive2d/PolygonMarkerPrimitive2D.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 <basegfx/matrix/b2dhommatrix.hxx>
26
#include <basegfx/polygon/b2dpolygon.hxx>
27
#include <basegfx/color/bcolor.hxx>
28
29
namespace drawinglayer::primitive2d
30
{
31
/** PolygonMarkerPrimitive2D class
32
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.
36
37
    It will be decomposed to the needed PolygonHairlinePrimitive2D if
38
    not handled directly by a renderer.
39
 */
40
class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D final
41
    : public BufferedDecompositionPrimitive2D
42
{
43
private:
44
    /// the marker hairline geometry
45
    basegfx::B2DPolygon maPolygon;
46
47
    /// the two colors
48
    basegfx::BColor maRGBColorA;
49
    basegfx::BColor maRGBColorB;
50
51
    /// the dash distance in 'pixels'
52
    double mfDiscreteDashLength;
53
54
    /// decomposition is view-dependent, remember last InverseObjectToViewTransformation
55
    basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation;
56
57
    /// local decomposition.
58
    virtual Primitive2DReference
59
    create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
60
61
public:
62
    /// constructor
63
    PolygonMarkerPrimitive2D(basegfx::B2DPolygon aPolygon, const basegfx::BColor& rRGBColorA,
64
                             const basegfx::BColor& rRGBColorB, double fDiscreteDashLength);
65
66
    /// data read access
67
0
    const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
68
0
    const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
69
0
    const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
70
0
    double getDiscreteDashLength() const { return mfDiscreteDashLength; }
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
    /// Override standard getDecomposition to be view-dependent here
80
    virtual void
81
    get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
82
                       const geometry::ViewInformation2D& rViewInformation) const override;
83
84
    /// provide unique ID
85
    virtual sal_uInt32 getPrimitive2DID() const override;
86
};
87
88
} // end of namespace primitive2d::drawinglayer
89
90
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */