1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX 29 #define INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX 30 31 #include <drawinglayer/texture/texture.hxx> 32 #include <vcl/bitmap.hxx> 33 34 ////////////////////////////////////////////////////////////////////////////// 35 // predeclarations 36 37 namespace drawinglayer { namespace primitive3d { 38 class HatchTexturePrimitive3D; 39 }} 40 41 ////////////////////////////////////////////////////////////////////////////// 42 43 namespace drawinglayer 44 { 45 namespace texture 46 { 47 class GeoTexSvxMono : public GeoTexSvx 48 { 49 protected: 50 basegfx::BColor maSingleColor; 51 double mfOpacity; 52 53 public: 54 GeoTexSvxMono(const basegfx::BColor& rSingleColor, double fOpacity); 55 56 // compare operator 57 virtual bool operator==(const GeoTexSvx& rGeoTexSvx) const; 58 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 59 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 60 }; 61 } // end of namespace texture 62 } // end of namespace drawinglayer 63 64 ////////////////////////////////////////////////////////////////////////////// 65 66 namespace drawinglayer 67 { 68 namespace texture 69 { 70 class GeoTexSvxBitmap : public GeoTexSvx 71 { 72 protected: 73 Bitmap maBitmap; 74 BitmapReadAccess* mpRead; 75 basegfx::B2DPoint maTopLeft; 76 basegfx::B2DVector maSize; 77 double mfMulX; 78 double mfMulY; 79 80 // helpers 81 bool impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const; 82 83 public: 84 GeoTexSvxBitmap(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); 85 virtual ~GeoTexSvxBitmap(); 86 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 87 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 88 }; 89 } // end of namespace texture 90 } // end of namespace drawinglayer 91 92 ////////////////////////////////////////////////////////////////////////////// 93 94 namespace drawinglayer 95 { 96 namespace texture 97 { 98 class GeoTexSvxBitmapTiled : public GeoTexSvxBitmap 99 { 100 protected: 101 // helpers 102 basegfx::B2DPoint impGetCorrected(const basegfx::B2DPoint& rUV) const 103 { 104 double fX(fmod(rUV.getX() - maTopLeft.getX(), maSize.getX())); 105 double fY(fmod(rUV.getY() - maTopLeft.getY(), maSize.getY())); 106 107 if(fX < 0.0) 108 { 109 fX += maSize.getX(); 110 } 111 112 if(fY < 0.0) 113 { 114 fY += maSize.getY(); 115 } 116 117 return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY()); 118 } 119 120 public: 121 GeoTexSvxBitmapTiled(const Bitmap& rBitmap, const basegfx::B2DPoint& rTopLeft, const basegfx::B2DVector& rSize); 122 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 123 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 124 }; 125 } // end of namespace texture 126 } // end of namespace drawinglayer 127 128 ////////////////////////////////////////////////////////////////////////////// 129 130 namespace drawinglayer 131 { 132 namespace texture 133 { 134 class GeoTexSvxMultiHatch : public GeoTexSvx 135 { 136 protected: 137 basegfx::BColor maColor; 138 double mfLogicPixelSize; 139 GeoTexSvxHatch* mp0; 140 GeoTexSvxHatch* mp1; 141 GeoTexSvxHatch* mp2; 142 143 // bitfield 144 unsigned mbFillBackground : 1; 145 146 // helpers 147 bool impIsOnHatch(const basegfx::B2DPoint& rUV) const; 148 149 public: 150 GeoTexSvxMultiHatch(const primitive3d::HatchTexturePrimitive3D& rPrimitive, double fLogicPixelSize); 151 virtual ~GeoTexSvxMultiHatch(); 152 virtual void modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const; 153 virtual void modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const; 154 155 // dada access 156 bool getFillBackground() const { return mbFillBackground; } 157 }; 158 } // end of namespace texture 159 } // end of namespace drawinglayer 160 161 ////////////////////////////////////////////////////////////////////////////// 162 163 #endif // INCLUDED_DRAWINGLAYER_TEXTURE_TEXTURE3D_HXX 164 165 // eof 166