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