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/bitmap.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(const basegfx::BColor& rSingleColor, double fOpacity); 52 53 // compare operator 54 virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const; 55 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 56 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 57 }; 58 } // end of namespace texture 59 } // end of namespace drawinglayer 60 61 ////////////////////////////////////////////////////////////////////////////// 62 63 namespace drawinglayer 64 { 65 namespace texture 66 { 67 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmap : public GeoTexSvx 68 { 69 protected: 70 Bitmap maBitmap; 71 BitmapReadAccess* mpRead; 72 basegfx::B2DPoint maTopLeft; 73 basegfx::B2DVector maSize; 74 double mfMulX; 75 double mfMulY; 76 77 // helpers 78 bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const; 79 80 public: 81 GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); 82 virtual ~GeoTexSvxBitmap(); 83 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 84 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 85 }; 86 } // end of namespace texture 87 } // end of namespace drawinglayer 88 89 ////////////////////////////////////////////////////////////////////////////// 90 91 namespace drawinglayer 92 { 93 namespace texture 94 { 95 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxBitmapTiled : public GeoTexSvxBitmap 96 { 97 protected: 98 // helpers 99 basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const 100 { 101 double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX())); 102 double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY())); 103 104 if(fX < 0.0) 105 { 106 fX += maSize.getX(); 107 } 108 109 if(fY < 0.0) 110 { 111 fY += maSize.getY(); 112 } 113 114 return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY()); 115 } 116 117 public: 118 GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); 119 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 120 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 121 }; 122 } // end of namespace texture 123 } // end of namespace drawinglayer 124 125 ////////////////////////////////////////////////////////////////////////////// 126 127 namespace drawinglayer 128 { 129 namespace texture 130 { 131 class DRAWINGLAYER_DLLPUBLIC GeoTexSvxMultiHatch : public GeoTexSvx 132 { 133 protected: 134 basegfx::BColor maColor; 135 double mfLogicPixelSize; 136 GeoTexSvxHatch* mp0; 137 GeoTexSvxHatch* mp1; 138 GeoTexSvxHatch* mp2; 139 140 // bitfield 141 unsigned mbFillBackground : 1; 142 143 // helpers 144 bool impIsOnHatch(const basegfx::B2DPoint& rUV) const; 145 146 public: 147 GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize); 148 virtual ~GeoTexSvxMultiHatch(); 149 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 150 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 151 152 // dada access 153 bool getFillBackground() const { return mbFillBackground; } 154 }; 155 } // end of namespace texture 156 } // end of namespace drawinglayer 157 158 ////////////////////////////////////////////////////////////////////////////// 159 160 #endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX 161 162 // eof 163