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