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/primitive3d/groupprimitive3d.hxx>
23 #include <drawinglayer/attribute/fillgraphicattribute.hxx>
24 #include <basegfx/vector/b2dvector.hxx>
25 #include <drawinglayer/attribute/fillgradientattribute.hxx>
28 namespace drawinglayer::primitive3d
30 /** TexturePrimitive3D class
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
36 class TexturePrimitive3D
: public GroupPrimitive3D
39 /// texture geometry definition
40 basegfx::B2DVector maTextureSize
;
42 /// flag if texture shall be modulated with white interpolated color
45 /// flag if texture shall be filtered
51 const Primitive3DContainer
& rChildren
,
52 const basegfx::B2DVector
& rTextureSize
,
57 const basegfx::B2DVector
& getTextureSize() const { return maTextureSize
; }
58 bool getModulate() const { return mbModulate
; }
59 bool getFilter() const { return mbFilter
; }
62 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const override
;
65 } // end of namespace drawinglayer::primitive3d
68 namespace drawinglayer::primitive3d
70 /** UnifiedTransparenceTexturePrimitive3D class
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.
76 class UnifiedTransparenceTexturePrimitive3D final
: public TexturePrimitive3D
79 /// transparency definition
80 double mfTransparence
;
84 UnifiedTransparenceTexturePrimitive3D(
86 const Primitive3DContainer
& rChildren
);
89 double getTransparence() const { return mfTransparence
; }
92 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const override
;
94 /// own getB3DRange implementation to include transparent geometries to BoundRect calculations
95 virtual basegfx::B3DRange
getB3DRange(const geometry::ViewInformation3D
& rViewInformation
) const override
;
97 /// local decomposition.
98 virtual Primitive3DContainer
get3DDecomposition(const geometry::ViewInformation3D
& rViewInformation
) const override
;
100 /// provide unique ID
101 DeclPrimitive3DIDBlock()
104 } // end of namespace drawinglayer::primitive3d
107 namespace drawinglayer::primitive3d
109 /** GradientTexturePrimitive3D class
111 This 3D primitive expands TexturePrimitive3D to a gradient texture
112 definition. All 3D primitives embedded here will be shown with the
115 class GradientTexturePrimitive3D
: public TexturePrimitive3D
118 /// the gradient definition
119 attribute::FillGradientAttribute maGradient
;
123 GradientTexturePrimitive3D(
124 const attribute::FillGradientAttribute
& rGradient
,
125 const Primitive3DContainer
& rChildren
,
126 const basegfx::B2DVector
& rTextureSize
,
131 const attribute::FillGradientAttribute
& getGradient() const { return maGradient
; }
134 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const override
;
136 /// provide unique ID
137 DeclPrimitive3DIDBlock()
140 } // end of namespace drawinglayer::primitive3d
143 namespace drawinglayer::primitive3d
145 /** BitmapTexturePrimitive3D class
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).
151 class BitmapTexturePrimitive3D final
: public TexturePrimitive3D
154 /// bitmap fill attribute
155 attribute::FillGraphicAttribute maFillGraphicAttribute
;
159 BitmapTexturePrimitive3D(
160 const attribute::FillGraphicAttribute
& rFillGraphicAttribute
,
161 const Primitive3DContainer
& rChildren
,
162 const basegfx::B2DVector
& rTextureSize
,
167 const attribute::FillGraphicAttribute
& getFillGraphicAttribute() const { return maFillGraphicAttribute
; }
170 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const override
;
172 /// provide unique ID
173 DeclPrimitive3DIDBlock()
176 } // end of namespace drawinglayer::primitive3d
179 namespace drawinglayer::primitive3d
181 /** TransparenceTexturePrimitive3D class
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.
188 class TransparenceTexturePrimitive3D final
: public GradientTexturePrimitive3D
192 TransparenceTexturePrimitive3D(
193 const attribute::FillGradientAttribute
& rGradient
,
194 const Primitive3DContainer
& rChildren
,
195 const basegfx::B2DVector
& rTextureSize
);
198 virtual bool operator==(const BasePrimitive3D
& rPrimitive
) const override
;
200 /// provide unique ID
201 DeclPrimitive3DIDBlock()
204 } // end of namespace drawinglayer::primitive3d
207 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */