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_TEXTURE_TEXTURE3D_HXX 25 #define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <drawinglayer/texture/texture.hxx> 29 #include <vcl/bitmapex.hxx> 30 31 ////////////////////////////////////////////////////////////////////////////// 32 // predeclarations 33 34 namespace drawinglayer { namespace primitive3d { 35 class HatchTexturePrimitive3D; 36 }} 37 38 ////////////////////////////////////////////////////////////////////////////// 39 40 namespace drawinglayer 41 { 42 namespace texture 43 { 44 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMono : public GeoTexSvx 45 { 46 protected: 47 basegfx::BColor maSingleColor; 48 double mfOpacity; 49 50 public: 51 GeoTexSvxMono( 52 const basegfx::BColor& rSingleColor, 53 double fOpacity); 54 55 // compare operator 56 virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const; 57 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 58 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 59 }; 60 } // end of namespace texture 61 } // end of namespace drawinglayer 62 63 ////////////////////////////////////////////////////////////////////////////// 64 65 namespace drawinglayer 66 { 67 namespace texture 68 { 69 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapEx : public GeoTexSvx 70 { 71 protected: 72 BitmapEx maBitmapEx; 73 BitmapReadAccess* mpReadBitmap; 74 Bitmap maTransparence; 75 BitmapReadAccess* mpReadTransparence; 76 basegfx::B2DPoint maTopLeft; 77 basegfx::B2DVector maSize; 78 double mfMulX; 79 double mfMulY; 80 81 /// bitfield 82 bool mbIsAlpha : 1; 83 bool mbIsTransparent : 1; 84 85 // helpers 86 bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const; 87 sal_uInt8 impGetTransparence(sal_Int32& rX, sal_Int32& rY) const; 88 89 public: 90 GeoTexSvxBitmapEx( 91 const BitmapEx& rBitmapEx, 92 const basegfx::B2DRange& rRange); 93 virtual ~GeoTexSvxBitmapEx(); 94 95 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 96 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 97 }; 98 } // end of namespace texture 99 } // end of namespace drawinglayer 100 101 ////////////////////////////////////////////////////////////////////////////// 102 103 namespace drawinglayer 104 { 105 namespace texture 106 { 107 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapExTiled : public GeoTexSvxBitmapEx 108 { 109 protected: 110 double mfOffsetX; 111 double mfOffsetY; 112 113 /// bitfield 114 bool mbUseOffsetX : 1; 115 bool mbUseOffsetY : 1; 116 117 // helpers 118 basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const; 119 120 public: 121 GeoTexSvxBitmapExTiled( 122 const BitmapEx& rBitmapEx, 123 const basegfx::B2DRange& rRange, 124 double fOffsetX = 0.0, 125 double fOffsetY = 0.0); 126 127 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 128 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 129 }; 130 } // end of namespace texture 131 } // end of namespace drawinglayer 132 133 ////////////////////////////////////////////////////////////////////////////// 134 135 namespace drawinglayer 136 { 137 namespace texture 138 { 139 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx 140 { 141 protected: 142 basegfx::BColor maColor; 143 double mfLogicPixelSize; 144 GeoTexSvxHatch* mp0; 145 GeoTexSvxHatch* mp1; 146 GeoTexSvxHatch* mp2; 147 148 // bitfield 149 unsigned mbFillBackground : 1; 150 151 // helpers 152 bool impIsOnHatch(const basegfx::B2DPoint& rUV) const; 153 154 public: 155 GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize); 156 virtual ~GeoTexSvxMultiHatch(); 157 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 158 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 159 160 // dada access getFillBackground() const161 bool getFillBackground() const { return mbFillBackground; } 162 }; 163 } // end of namespace texture 164 } // end of namespace drawinglayer 165 166 ////////////////////////////////////////////////////////////////////////////// 167 168 #endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX 169 170 // eof 171