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