Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/drawinglayer/primitive2d/PolyPolygonGraphicPrimitive2D.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/polygon/b2dpolypolygon.hxx>
26
#include <drawinglayer/attribute/fillgraphicattribute.hxx>
27
28
namespace drawinglayer::primitive2d
29
{
30
/** PolyPolygonGraphicPrimitive2D class
31
32
    This primitive defines a tools::PolyPolygon filled with bitmap data
33
    (including transparence). The decomosition will create a MaskPrimitive2D
34
    containing a FillGraphicPrimitive2D.
35
36
    SDPR: support alpha now directly: the decomposition creates
37
    FillGraphicPrimitive2D which also supports alpha directly
38
    now. All direct usages are covered
39
 */
40
class DRAWINGLAYER_DLLPUBLIC PolyPolygonGraphicPrimitive2D final
41
    : public BufferedDecompositionPrimitive2D
42
{
43
private:
44
    /// the tools::PolyPolygon geometry
45
    basegfx::B2DPolyPolygon maPolyPolygon;
46
47
    /// the definition range
48
    basegfx::B2DRange maDefinitionRange;
49
50
    /// the bitmap fill definition (may include tiling)
51
    attribute::FillGraphicAttribute maFillGraphic;
52
53
    /// the transparency in range [0.0 .. 1.0]
54
    double mfTransparency;
55
56
    /// local decomposition.
57
    virtual Primitive2DReference
58
    create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const override;
59
60
public:
61
    PolyPolygonGraphicPrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon,
62
                                  const basegfx::B2DRange& rDefinitionRange,
63
                                  const attribute::FillGraphicAttribute& rFillGraphic,
64
                                  double fTransparency = 0.0);
65
66
    /// data read access
67
0
    const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; }
68
0
    const basegfx::B2DRange& getDefinitionRange() const { return maDefinitionRange; }
69
0
    const attribute::FillGraphicAttribute& getFillGraphic() const { return maFillGraphic; }
70
0
    double getTransparency() const { return mfTransparency; }
71
0
    bool hasTransparency() const { return !basegfx::fTools::equalZero(mfTransparency); }
72
73
    /// compare operator
74
    virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
75
76
    /// provide unique ID
77
    virtual sal_uInt32 getPrimitive2DID() const override;
78
};
79
80
} // end of namespace primitive2d::drawinglayer
81
82
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */