Coverage Report

Created: 2026-09-28 10:59

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/drawinglayer/inc/primitive3d/textureprimitive3d.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/primitive3d/groupprimitive3d.hxx>
23
#include <drawinglayer/attribute/fillgraphicattribute.hxx>
24
#include <basegfx/vector/b2dvector.hxx>
25
#include <drawinglayer/attribute/fillgradientattribute.hxx>
26
27
28
namespace drawinglayer::primitive3d
29
    {
30
        /** TexturePrimitive3D class
31
32
            This 3D grouping primitive is used to define a texture for
33
            3d geometry by embedding it. It is used as base class for
34
            extended texture definitions
35
         */
36
        class TexturePrimitive3D : public GroupPrimitive3D
37
        {
38
        private:
39
            /// texture geometry definition
40
            basegfx::B2DVector                          maTextureSize;
41
42
            /// flag if texture shall be modulated with white interpolated color
43
            bool                                        mbModulate : 1;
44
45
            /// flag if texture shall be filtered
46
            bool                                        mbFilter : 1;
47
48
        public:
49
            /// constructor
50
            TexturePrimitive3D(
51
                const Primitive3DContainer& rChildren,
52
                const basegfx::B2DVector& rTextureSize,
53
                bool bModulate,
54
                bool bFilter);
55
56
            /// data read access
57
0
            const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
58
0
            bool getModulate() const { return mbModulate; }
59
0
            bool getFilter() const { return mbFilter; }
60
61
            /// compare operator
62
            virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
63
        };
64
65
} // end of namespace drawinglayer::primitive3d
66
67
68
namespace drawinglayer::primitive3d
69
    {
70
        /** UnifiedTransparenceTexturePrimitive3D class
71
72
            This 3D primitive expands TexturePrimitive3D to a unified
73
            transparence texture definition. All 3D primitives
74
            embedded here will be shown with the given transparency.
75
         */
76
        class UnifiedTransparenceTexturePrimitive3D final : public TexturePrimitive3D
77
        {
78
        private:
79
            /// transparency definition
80
            double                                      mfTransparence;
81
82
        public:
83
            /// constructor
84
            UnifiedTransparenceTexturePrimitive3D(
85
                double fTransparence,
86
                const Primitive3DContainer& rChildren);
87
88
            /// data read access
89
0
            double getTransparence() const { return mfTransparence; }
90
91
            /// compare operator
92
            virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
93
94
            /// own getB3DRange implementation to include transparent geometries to BoundRect calculations
95
            virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const override;
96
97
            /// local decomposition.
98
            virtual Primitive3DContainer get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const override;
99
100
            /// provide unique ID
101
            DeclPrimitive3DIDBlock()
102
        };
103
104
} // end of namespace drawinglayer::primitive3d
105
106
107
namespace drawinglayer::primitive3d
108
    {
109
        /** GradientTexturePrimitive3D class
110
111
            This 3D primitive expands TexturePrimitive3D to a gradient texture
112
            definition. All 3D primitives embedded here will be shown with the
113
            defined gradient.
114
         */
115
        class GradientTexturePrimitive3D : public TexturePrimitive3D
116
        {
117
        private:
118
            /// the gradient definition
119
            attribute::FillGradientAttribute        maGradient;
120
121
        public:
122
            /// constructor
123
            GradientTexturePrimitive3D(
124
                attribute::FillGradientAttribute aGradient,
125
                const Primitive3DContainer& rChildren,
126
                const basegfx::B2DVector& rTextureSize,
127
                bool bModulate,
128
                bool bFilter);
129
130
            /// data read access
131
0
            const attribute::FillGradientAttribute& getGradient() const { return maGradient; }
132
133
            /// compare operator
134
            virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
135
136
            /// provide unique ID
137
            DeclPrimitive3DIDBlock()
138
        };
139
140
} // end of namespace drawinglayer::primitive3d
141
142
143
namespace drawinglayer::primitive3d
144
    {
145
        /** BitmapTexturePrimitive3D class
146
147
            This 3D primitive expands TexturePrimitive3D to a bitmap texture
148
            definition. All 3D primitives embedded here will be shown with the
149
            defined bitmap (maybe tiled if defined).
150
         */
151
        class BitmapTexturePrimitive3D final : public TexturePrimitive3D
152
        {
153
        private:
154
            /// bitmap fill attribute
155
            attribute::FillGraphicAttribute     maFillGraphicAttribute;
156
157
        public:
158
            /// constructor
159
            BitmapTexturePrimitive3D(
160
                const attribute::FillGraphicAttribute& rFillGraphicAttribute,
161
                const Primitive3DContainer& rChildren,
162
                const basegfx::B2DVector& rTextureSize,
163
                bool bModulate,
164
                bool bFilter);
165
166
            /// data read access
167
0
            const attribute::FillGraphicAttribute& getFillGraphicAttribute() const { return maFillGraphicAttribute; }
168
169
            /// compare operator
170
            virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
171
172
            /// provide unique ID
173
            DeclPrimitive3DIDBlock()
174
        };
175
176
} // end of namespace drawinglayer::primitive3d
177
178
179
namespace drawinglayer::primitive3d
180
    {
181
        /** TransparenceTexturePrimitive3D class
182
183
            This 3D primitive expands TexturePrimitive3D to a transparence texture
184
            definition. For transparence definition, a gradient is used. The values in
185
            that gradient will be interpreted as luminance Transparence-Values. All 3D
186
            primitives embedded here will be shown with the defined transparence.
187
         */
188
        class TransparenceTexturePrimitive3D final : public GradientTexturePrimitive3D
189
        {
190
        public:
191
            /// constructor
192
            TransparenceTexturePrimitive3D(
193
                const attribute::FillGradientAttribute& rGradient,
194
                const Primitive3DContainer& rChildren,
195
                const basegfx::B2DVector& rTextureSize);
196
197
            /// compare operator
198
            virtual bool operator==(const BasePrimitive3D& rPrimitive) const override;
199
200
            /// provide unique ID
201
            DeclPrimitive3DIDBlock()
202
        };
203
204
} // end of namespace drawinglayer::primitive3d
205
206
207
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */