xref: /AOO41X/main/drawinglayer/inc/drawinglayer/primitive3d/textureprimitive3d.hxx (revision 035a2f44eca4e31ced924464e6584eacbf3e9114)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive3d/groupprimitive3d.hxx>
29 #include <drawinglayer/attribute/fillgraphicattribute.hxx>
30 #include <basegfx/matrix/b2dhommatrix.hxx>
31 #include <basegfx/vector/b2dvector.hxx>
32 #include <drawinglayer/attribute/fillgradientattribute.hxx>
33 
34 //////////////////////////////////////////////////////////////////////////////
35 
36 namespace drawinglayer
37 {
38     namespace primitive3d
39     {
40         /** TexturePrimitive3D class
41 
42             This 3D grouping primitive is used to define a texture for
43             3d geometry by embedding it. It is used as bae class for
44             extended texture definitions
45          */
46         class DRAWINGLAYER_DLLPUBLIC TexturePrimitive3D : public GroupPrimitive3D
47         {
48         private:
49             /// texture geometry definition
50             basegfx::B2DVector                          maTextureSize;
51 
52             /// bitfield
53             /// flag if texture shall be modulated with white interpolated color
54             unsigned                                    mbModulate : 1;
55 
56             /// flag if texture shall be filtered
57             unsigned                                    mbFilter : 1;
58 
59         public:
60             /// constructor
61             TexturePrimitive3D(
62                 const Primitive3DSequence& rChildren,
63                 const basegfx::B2DVector& rTextureSize,
64                 bool bModulate,
65                 bool bFilter);
66 
67             /// data read access
getTextureSize() const68             const basegfx::B2DVector& getTextureSize() const { return maTextureSize; }
getModulate() const69             bool getModulate() const { return mbModulate; }
getFilter() const70             bool getFilter() const { return mbFilter; }
71 
72             /// compare operator
73             virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
74         };
75     } // end of namespace primitive3d
76 } // end of namespace drawinglayer
77 
78 //////////////////////////////////////////////////////////////////////////////
79 
80 namespace drawinglayer
81 {
82     namespace primitive3d
83     {
84         /** UnifiedTransparenceTexturePrimitive3D class
85 
86             This 3D primitive expands TexturePrimitive3D to a unified
87             transparence texture definition. All 3D primitives
88             embedded here will be shown with the given transparency.
89          */
90         class DRAWINGLAYER_DLLPUBLIC UnifiedTransparenceTexturePrimitive3D : public TexturePrimitive3D
91         {
92         private:
93             /// transparency definition
94             double                                      mfTransparence;
95 
96         public:
97             /// constructor
98             UnifiedTransparenceTexturePrimitive3D(
99                 double fTransparence,
100                 const Primitive3DSequence& rChildren);
101 
102             /// data read access
getTransparence() const103             double getTransparence() const { return mfTransparence; }
104 
105             /// compare operator
106             virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
107 
108             /// own getB3DRange implementation to include transparent geometries to BoundRect calculations
109             virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
110 
111             /// local decomposition.
112             virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
113 
114             /// provide unique ID
115             DeclPrimitrive3DIDBlock()
116         };
117     } // end of namespace primitive3d
118 } // end of namespace drawinglayer
119 
120 //////////////////////////////////////////////////////////////////////////////
121 
122 namespace drawinglayer
123 {
124     namespace primitive3d
125     {
126         /** GradientTexturePrimitive3D class
127 
128             This 3D primitive expands TexturePrimitive3D to a gradient texture
129             definition. All 3D primitives embedded here will be shown with the
130             defined gradient.
131          */
132         class DRAWINGLAYER_DLLPUBLIC GradientTexturePrimitive3D : public TexturePrimitive3D
133         {
134         private:
135             /// the gradient definition
136             attribute::FillGradientAttribute        maGradient;
137 
138         public:
139             /// constructor
140             GradientTexturePrimitive3D(
141                 const attribute::FillGradientAttribute& rGradient,
142                 const Primitive3DSequence& rChildren,
143                 const basegfx::B2DVector& rTextureSize,
144                 bool bModulate,
145                 bool bFilter);
146 
147             /// data read access
getGradient() const148             const attribute::FillGradientAttribute& getGradient() const { return maGradient; }
149 
150             /// compare operator
151             virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
152 
153             /// provide unique ID
154             DeclPrimitrive3DIDBlock()
155         };
156     } // end of namespace primitive3d
157 } // end of namespace drawinglayer
158 
159 //////////////////////////////////////////////////////////////////////////////
160 
161 namespace drawinglayer
162 {
163     namespace primitive3d
164     {
165         /** BitmapTexturePrimitive3D class
166 
167             This 3D primitive expands TexturePrimitive3D to a bitmap texture
168             definition. All 3D primitives embedded here will be shown with the
169             defined bitmap (maybe tiled if defined).
170          */
171         class DRAWINGLAYER_DLLPUBLIC BitmapTexturePrimitive3D : public TexturePrimitive3D
172         {
173         private:
174             /// bitmap fill attribute
175             attribute::FillGraphicAttribute     maFillGraphicAttribute;
176 
177         public:
178             /// constructor
179             BitmapTexturePrimitive3D(
180                 const attribute::FillGraphicAttribute& rFillGraphicAttribute,
181                 const Primitive3DSequence& rChildren,
182                 const basegfx::B2DVector& rTextureSize,
183                 bool bModulate,
184                 bool bFilter);
185 
186             /// data read access
getFillGraphicAttribute() const187             const attribute::FillGraphicAttribute& getFillGraphicAttribute() const { return maFillGraphicAttribute; }
188 
189             /// compare operator
190             virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
191 
192             /// provide unique ID
193             DeclPrimitrive3DIDBlock()
194         };
195     } // end of namespace primitive3d
196 } // end of namespace drawinglayer
197 
198 //////////////////////////////////////////////////////////////////////////////
199 
200 namespace drawinglayer
201 {
202     namespace primitive3d
203     {
204         /** TransparenceTexturePrimitive3D class
205 
206             This 3D primitive expands TexturePrimitive3D to a transparence texture
207             definition. For transparence definition, a gradient is used. The values in
208             that gradient will be interpreted as luminance Transparence-Values. All 3D
209             primitives embedded here will be shown with the defined transparence.
210          */
211         class DRAWINGLAYER_DLLPUBLIC TransparenceTexturePrimitive3D : public GradientTexturePrimitive3D
212         {
213         public:
214             /// constructor
215             TransparenceTexturePrimitive3D(
216                 const attribute::FillGradientAttribute& rGradient,
217                 const Primitive3DSequence& rChildren,
218                 const basegfx::B2DVector& rTextureSize);
219 
220             /// compare operator
221             virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
222 
223             /// provide unique ID
224             DeclPrimitrive3DIDBlock()
225         };
226     } // end of namespace primitive3d
227 } // end of namespace drawinglayer
228 
229 //////////////////////////////////////////////////////////////////////////////
230 
231 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_TEXTUREPRIMITIVE3D_HXX
232 
233 //////////////////////////////////////////////////////////////////////////////
234 // eof
235