xref: /AOO41X/main/drawinglayer/source/texture/texture3d.cxx (revision 035a2f44eca4e31ced924464e6584eacbf3e9114)
1464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5464702f4SAndrew Rist  * distributed with this work for additional information
6464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14464702f4SAndrew Rist  * software distributed under the License is distributed on an
15464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17464702f4SAndrew Rist  * specific language governing permissions and limitations
18464702f4SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20464702f4SAndrew Rist  *************************************************************/
21464702f4SAndrew Rist 
22464702f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/texture/texture3d.hxx>
28cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
29cdf0e10cSrcweir #include <drawinglayer/primitive3d/hatchtextureprimitive3d.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace drawinglayer
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	namespace texture
36cdf0e10cSrcweir 	{
37*035a2f44SArmin Le Grand 		GeoTexSvxMono::GeoTexSvxMono(
38*035a2f44SArmin Le Grand             const basegfx::BColor& rSingleColor,
39*035a2f44SArmin Le Grand             double fOpacity)
40cdf0e10cSrcweir 		:	maSingleColor(rSingleColor),
41cdf0e10cSrcweir 			mfOpacity(fOpacity)
42cdf0e10cSrcweir 		{
43cdf0e10cSrcweir 		}
44cdf0e10cSrcweir 
45cdf0e10cSrcweir 		bool GeoTexSvxMono::operator==(const GeoTexSvx& rGeoTexSvx) const
46cdf0e10cSrcweir 		{
47cdf0e10cSrcweir 			const GeoTexSvxMono* pCompare = dynamic_cast< const GeoTexSvxMono* >(&rGeoTexSvx);
48*035a2f44SArmin Le Grand 
49cdf0e10cSrcweir             return (pCompare
50cdf0e10cSrcweir 				&& maSingleColor == pCompare->maSingleColor
51cdf0e10cSrcweir 				&& mfOpacity == pCompare->mfOpacity);
52cdf0e10cSrcweir 		}
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 		void GeoTexSvxMono::modifyBColor(const basegfx::B2DPoint& /*rUV*/, basegfx::BColor& rBColor, double& /*rfOpacity*/) const
55cdf0e10cSrcweir 		{
56cdf0e10cSrcweir 			rBColor = maSingleColor;
57cdf0e10cSrcweir 		}
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		void GeoTexSvxMono::modifyOpacity(const basegfx::B2DPoint& /*rUV*/, double& rfOpacity) const
60cdf0e10cSrcweir 		{
61cdf0e10cSrcweir 			rfOpacity = mfOpacity;
62cdf0e10cSrcweir 		}
63cdf0e10cSrcweir 	} // end of namespace texture
64cdf0e10cSrcweir } // end of namespace drawinglayer
65cdf0e10cSrcweir 
66cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
67cdf0e10cSrcweir 
68cdf0e10cSrcweir namespace drawinglayer
69cdf0e10cSrcweir {
70cdf0e10cSrcweir 	namespace texture
71cdf0e10cSrcweir 	{
72*035a2f44SArmin Le Grand 		GeoTexSvxBitmapEx::GeoTexSvxBitmapEx(
73*035a2f44SArmin Le Grand             const BitmapEx& rBitmapEx,
74*035a2f44SArmin Le Grand             const basegfx::B2DRange& rRange)
75*035a2f44SArmin Le Grand 		:	maBitmapEx(rBitmapEx),
76*035a2f44SArmin Le Grand 			mpReadBitmap(0),
77*035a2f44SArmin Le Grand             maTransparence(),
78*035a2f44SArmin Le Grand             mpReadTransparence(0),
79*035a2f44SArmin Le Grand 			maTopLeft(rRange.getMinimum()),
80*035a2f44SArmin Le Grand 			maSize(rRange.getRange()),
81cdf0e10cSrcweir 			mfMulX(0.0),
82*035a2f44SArmin Le Grand 			mfMulY(0.0),
83*035a2f44SArmin Le Grand             mbIsAlpha(false),
84*035a2f44SArmin Le Grand             mbIsTransparent(maBitmapEx.IsTransparent())
85cdf0e10cSrcweir 		{
86*035a2f44SArmin Le Grand             // #121194# Todo: use alpha channel, too (for 3d)
87*035a2f44SArmin Le Grand 			mpReadBitmap = maBitmapEx.GetBitmap().AcquireReadAccess();
88*035a2f44SArmin Le Grand 			OSL_ENSURE(mpReadBitmap, "GeoTexSvxBitmapEx: Got no read access to Bitmap (!)");
89*035a2f44SArmin Le Grand 
90*035a2f44SArmin Le Grand             if(mbIsTransparent)
91*035a2f44SArmin Le Grand             {
92*035a2f44SArmin Le Grand                 if(maBitmapEx.IsAlpha())
93*035a2f44SArmin Le Grand                 {
94*035a2f44SArmin Le Grand                     mbIsAlpha = true;
95*035a2f44SArmin Le Grand                     maTransparence = rBitmapEx.GetAlpha().GetBitmap();
96*035a2f44SArmin Le Grand                 }
97*035a2f44SArmin Le Grand                 else
98*035a2f44SArmin Le Grand                 {
99*035a2f44SArmin Le Grand                     maTransparence = rBitmapEx.GetMask();
100cdf0e10cSrcweir                 }
101cdf0e10cSrcweir 
102*035a2f44SArmin Le Grand                 mpReadTransparence = maTransparence.AcquireReadAccess();
103cdf0e10cSrcweir             }
104cdf0e10cSrcweir 
105*035a2f44SArmin Le Grand             mfMulX = (double)mpReadBitmap->Width() / maSize.getX();
106*035a2f44SArmin Le Grand 			mfMulY = (double)mpReadBitmap->Height() / maSize.getY();
107*035a2f44SArmin Le Grand 
108*035a2f44SArmin Le Grand             if(maSize.getX() <= 1.0)
109cdf0e10cSrcweir             {
110*035a2f44SArmin Le Grand                 maSize.setX(1.0);
111*035a2f44SArmin Le Grand             }
112*035a2f44SArmin Le Grand 
113*035a2f44SArmin Le Grand             if(maSize.getY() <= 1.0)
114*035a2f44SArmin Le Grand             {
115*035a2f44SArmin Le Grand                 maSize.setY(1.0);
116*035a2f44SArmin Le Grand             }
117*035a2f44SArmin Le Grand 		}
118*035a2f44SArmin Le Grand 
119*035a2f44SArmin Le Grand 		GeoTexSvxBitmapEx::~GeoTexSvxBitmapEx()
120*035a2f44SArmin Le Grand 		{
121*035a2f44SArmin Le Grand             delete mpReadTransparence;
122*035a2f44SArmin Le Grand 			delete mpReadBitmap;
123*035a2f44SArmin Le Grand 		}
124*035a2f44SArmin Le Grand 
125*035a2f44SArmin Le Grand         sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32& rX, sal_Int32& rY) const
126*035a2f44SArmin Le Grand         {
127*035a2f44SArmin Le Grand             switch(maBitmapEx.GetTransparentType())
128*035a2f44SArmin Le Grand             {
129*035a2f44SArmin Le Grand                 case TRANSPARENT_NONE:
130*035a2f44SArmin Le Grand                 {
131*035a2f44SArmin Le Grand                     break;
132*035a2f44SArmin Le Grand                 }
133*035a2f44SArmin Le Grand                 case TRANSPARENT_COLOR:
134*035a2f44SArmin Le Grand                 {
135*035a2f44SArmin Le Grand                     const Color aColor(mpReadBitmap->GetColor(rY, rX));
136*035a2f44SArmin Le Grand 
137*035a2f44SArmin Le Grand                     if(maBitmapEx.GetTransparentColor() == aColor)
138*035a2f44SArmin Le Grand                     {
139*035a2f44SArmin Le Grand                         return 255;
140*035a2f44SArmin Le Grand                     }
141*035a2f44SArmin Le Grand 
142*035a2f44SArmin Le Grand                     break;
143*035a2f44SArmin Le Grand                 }
144*035a2f44SArmin Le Grand                 case TRANSPARENT_BITMAP:
145*035a2f44SArmin Le Grand                 {
146*035a2f44SArmin Le Grand                     OSL_ENSURE(mpReadTransparence, "OOps, transparence type Bitmap, but no read access created in the constructor (?)");
147*035a2f44SArmin Le Grand                     const BitmapColor aBitmapColor(mpReadTransparence->GetPixel(rY, rX));
148*035a2f44SArmin Le Grand 
149*035a2f44SArmin Le Grand                     if(mbIsAlpha)
150*035a2f44SArmin Le Grand                     {
151*035a2f44SArmin Le Grand                         return aBitmapColor.GetIndex();
152*035a2f44SArmin Le Grand                     }
153*035a2f44SArmin Le Grand                     else
154*035a2f44SArmin Le Grand                     {
155*035a2f44SArmin Le Grand                         if(0x00 != aBitmapColor.GetIndex())
156*035a2f44SArmin Le Grand                         {
157*035a2f44SArmin Le Grand                             return 255;
158*035a2f44SArmin Le Grand                         }
159*035a2f44SArmin Le Grand                     }
160*035a2f44SArmin Le Grand                     break;
161*035a2f44SArmin Le Grand                 }
162*035a2f44SArmin Le Grand             }
163*035a2f44SArmin Le Grand 
164*035a2f44SArmin Le Grand             return 0;
165*035a2f44SArmin Le Grand         }
166*035a2f44SArmin Le Grand 
167*035a2f44SArmin Le Grand 		bool GeoTexSvxBitmapEx::impIsValid(const basegfx::B2DPoint& rUV, sal_Int32& rX, sal_Int32& rY) const
168*035a2f44SArmin Le Grand 		{
169*035a2f44SArmin Le Grand 			if(mpReadBitmap)
170cdf0e10cSrcweir 			{
171cdf0e10cSrcweir 				rX = (sal_Int32)((rUV.getX() - maTopLeft.getX()) * mfMulX);
172cdf0e10cSrcweir 
173*035a2f44SArmin Le Grand 				if(rX >= 0L && rX < mpReadBitmap->Width())
174cdf0e10cSrcweir 				{
175cdf0e10cSrcweir 					rY = (sal_Int32)((rUV.getY() - maTopLeft.getY()) * mfMulY);
176cdf0e10cSrcweir 
177*035a2f44SArmin Le Grand 					return (rY >= 0L && rY < mpReadBitmap->Height());
178cdf0e10cSrcweir 				}
179cdf0e10cSrcweir 			}
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 			return false;
182cdf0e10cSrcweir 		}
183cdf0e10cSrcweir 
184*035a2f44SArmin Le Grand 		void GeoTexSvxBitmapEx::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const
185cdf0e10cSrcweir 		{
186cdf0e10cSrcweir 			sal_Int32 nX, nY;
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 			if(impIsValid(rUV, nX, nY))
189cdf0e10cSrcweir 			{
190cdf0e10cSrcweir 				const double fConvertColor(1.0 / 255.0);
191*035a2f44SArmin Le Grand 				const BitmapColor aBMCol(mpReadBitmap->GetColor(nY, nX));
192cdf0e10cSrcweir 				const basegfx::BColor aBSource(
193cdf0e10cSrcweir 					(double)aBMCol.GetRed() * fConvertColor,
194cdf0e10cSrcweir 					(double)aBMCol.GetGreen() * fConvertColor,
195cdf0e10cSrcweir 					(double)aBMCol.GetBlue() * fConvertColor);
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 				rBColor = aBSource;
198*035a2f44SArmin Le Grand 
199*035a2f44SArmin Le Grand                 if(mbIsTransparent)
200*035a2f44SArmin Le Grand                 {
201*035a2f44SArmin Le Grand                     // when we have a transparence, make use of it
202*035a2f44SArmin Le Grand                     const sal_uInt8 aLuminance(impGetTransparence(nX, nY));
203*035a2f44SArmin Le Grand 
204*035a2f44SArmin Le Grand                     rfOpacity = ((double)(0xff - aLuminance) * (1.0 / 255.0));
205*035a2f44SArmin Le Grand                 }
206*035a2f44SArmin Le Grand                 else
207*035a2f44SArmin Le Grand                 {
208*035a2f44SArmin Le Grand                     rfOpacity = 1.0;
209*035a2f44SArmin Le Grand                 }
210cdf0e10cSrcweir 			}
211cdf0e10cSrcweir 			else
212cdf0e10cSrcweir 			{
213cdf0e10cSrcweir 				rfOpacity = 0.0;
214cdf0e10cSrcweir 			}
215cdf0e10cSrcweir 		}
216cdf0e10cSrcweir 
217*035a2f44SArmin Le Grand 		void GeoTexSvxBitmapEx::modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const
218cdf0e10cSrcweir 		{
219cdf0e10cSrcweir 			sal_Int32 nX, nY;
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 			if(impIsValid(rUV, nX, nY))
222cdf0e10cSrcweir 			{
223*035a2f44SArmin Le Grand                 if(mbIsTransparent)
224*035a2f44SArmin Le Grand                 {
225*035a2f44SArmin Le Grand                     // this texture has an alpha part, use it
226*035a2f44SArmin Le Grand                     const sal_uInt8 aLuminance(impGetTransparence(nX, nY));
227*035a2f44SArmin Le Grand                     const double fNewOpacity((double)(0xff - aLuminance) * (1.0 / 255.0));
228*035a2f44SArmin Le Grand 
229*035a2f44SArmin Le Grand                     rfOpacity = 1.0 - ((1.0 - fNewOpacity) * (1.0 - rfOpacity));
230*035a2f44SArmin Le Grand                 }
231*035a2f44SArmin Le Grand                 else
232*035a2f44SArmin Le Grand                 {
233*035a2f44SArmin Le Grand                     // this texture is a color bitmap used as transparence map
234*035a2f44SArmin Le Grand 				    const BitmapColor aBMCol(mpReadBitmap->GetColor(nY, nX));
235cdf0e10cSrcweir 				    const Color aColor(aBMCol.GetRed(), aBMCol.GetGreen(), aBMCol.GetBlue());
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 				    rfOpacity = ((double)(0xff - aColor.GetLuminance()) * (1.0 / 255.0));
238cdf0e10cSrcweir                 }
239*035a2f44SArmin Le Grand 			}
240cdf0e10cSrcweir 			else
241cdf0e10cSrcweir 			{
242cdf0e10cSrcweir 				rfOpacity = 0.0;
243cdf0e10cSrcweir 			}
244cdf0e10cSrcweir 		}
245cdf0e10cSrcweir 	} // end of namespace texture
246cdf0e10cSrcweir } // end of namespace drawinglayer
247cdf0e10cSrcweir 
248cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
249cdf0e10cSrcweir 
250cdf0e10cSrcweir namespace drawinglayer
251cdf0e10cSrcweir {
252cdf0e10cSrcweir 	namespace texture
253cdf0e10cSrcweir 	{
254*035a2f44SArmin Le Grand 		basegfx::B2DPoint GeoTexSvxBitmapExTiled::impGetCorrected(const basegfx::B2DPoint& rUV) const
255cdf0e10cSrcweir 		{
256*035a2f44SArmin Le Grand             double fX(rUV.getX() - maTopLeft.getX());
257*035a2f44SArmin Le Grand             double fY(rUV.getY() - maTopLeft.getY());
258cdf0e10cSrcweir 
259*035a2f44SArmin Le Grand             if(mbUseOffsetX)
260cdf0e10cSrcweir             {
261*035a2f44SArmin Le Grand                 const sal_Int32 nCol(static_cast< sal_Int32 >((fY < 0.0 ? maSize.getY() -fY : fY) / maSize.getY()));
262*035a2f44SArmin Le Grand 
263*035a2f44SArmin Le Grand                 if(nCol % 2)
264cdf0e10cSrcweir                 {
265*035a2f44SArmin Le Grand                     fX += mfOffsetX * maSize.getX();
266*035a2f44SArmin Le Grand                 }
267*035a2f44SArmin Le Grand             }
268*035a2f44SArmin Le Grand             else if(mbUseOffsetY)
269*035a2f44SArmin Le Grand             {
270*035a2f44SArmin Le Grand                 const sal_Int32 nRow(static_cast< sal_Int32 >((fX < 0.0 ? maSize.getX() -fX : fX) / maSize.getX()));
271*035a2f44SArmin Le Grand 
272*035a2f44SArmin Le Grand                 if(nRow % 2)
273*035a2f44SArmin Le Grand                 {
274*035a2f44SArmin Le Grand                     fY += mfOffsetY * maSize.getY();
275cdf0e10cSrcweir                 }
276cdf0e10cSrcweir             }
277cdf0e10cSrcweir 
278*035a2f44SArmin Le Grand             fX = fmod(fX, maSize.getX());
279*035a2f44SArmin Le Grand             fY = fmod(fY, maSize.getY());
280*035a2f44SArmin Le Grand 
281*035a2f44SArmin Le Grand             if(fX < 0.0)
282cdf0e10cSrcweir             {
283*035a2f44SArmin Le Grand                 fX += maSize.getX();
284*035a2f44SArmin Le Grand             }
285*035a2f44SArmin Le Grand 
286*035a2f44SArmin Le Grand             if(fY < 0.0)
287cdf0e10cSrcweir             {
288*035a2f44SArmin Le Grand                 fY += maSize.getY();
289*035a2f44SArmin Le Grand             }
290*035a2f44SArmin Le Grand 
291*035a2f44SArmin Le Grand             return basegfx::B2DPoint(fX + maTopLeft.getX(), fY + maTopLeft.getY());
292*035a2f44SArmin Le Grand 		}
293*035a2f44SArmin Le Grand 
294*035a2f44SArmin Le Grand         GeoTexSvxBitmapExTiled::GeoTexSvxBitmapExTiled(
295*035a2f44SArmin Le Grand             const BitmapEx& rBitmapEx,
296*035a2f44SArmin Le Grand             const basegfx::B2DRange& rRange,
297*035a2f44SArmin Le Grand             double fOffsetX,
298*035a2f44SArmin Le Grand             double fOffsetY)
299*035a2f44SArmin Le Grand 		:	GeoTexSvxBitmapEx(rBitmapEx, rRange),
300*035a2f44SArmin Le Grand             mfOffsetX(basegfx::clamp(fOffsetX, 0.0, 1.0)),
301*035a2f44SArmin Le Grand             mfOffsetY(basegfx::clamp(fOffsetY, 0.0, 1.0)),
302*035a2f44SArmin Le Grand             mbUseOffsetX(!basegfx::fTools::equalZero(mfOffsetX)),
303*035a2f44SArmin Le Grand             mbUseOffsetY(!mbUseOffsetX && !basegfx::fTools::equalZero(mfOffsetY))
304*035a2f44SArmin Le Grand 		{
305*035a2f44SArmin Le Grand 		}
306*035a2f44SArmin Le Grand 
307*035a2f44SArmin Le Grand 		void GeoTexSvxBitmapExTiled::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const
308*035a2f44SArmin Le Grand 		{
309*035a2f44SArmin Le Grand 			if(mpReadBitmap)
310*035a2f44SArmin Le Grand 			{
311*035a2f44SArmin Le Grand 				GeoTexSvxBitmapEx::modifyBColor(impGetCorrected(rUV), rBColor, rfOpacity);
312*035a2f44SArmin Le Grand 			}
313*035a2f44SArmin Le Grand 		}
314*035a2f44SArmin Le Grand 
315*035a2f44SArmin Le Grand 		void GeoTexSvxBitmapExTiled::modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const
316*035a2f44SArmin Le Grand 		{
317*035a2f44SArmin Le Grand 			if(mpReadBitmap)
318*035a2f44SArmin Le Grand 			{
319*035a2f44SArmin Le Grand 				GeoTexSvxBitmapEx::modifyOpacity(impGetCorrected(rUV), rfOpacity);
320cdf0e10cSrcweir 			}
321cdf0e10cSrcweir 		}
322cdf0e10cSrcweir 	} // end of namespace texture
323cdf0e10cSrcweir } // end of namespace drawinglayer
324cdf0e10cSrcweir 
325cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
326cdf0e10cSrcweir 
327cdf0e10cSrcweir namespace drawinglayer
328cdf0e10cSrcweir {
329cdf0e10cSrcweir 	namespace texture
330cdf0e10cSrcweir 	{
331*035a2f44SArmin Le Grand 		GeoTexSvxMultiHatch::GeoTexSvxMultiHatch(
332*035a2f44SArmin Le Grand             const primitive3d::HatchTexturePrimitive3D& rPrimitive,
333*035a2f44SArmin Le Grand             double fLogicPixelSize)
334cdf0e10cSrcweir 		:	mfLogicPixelSize(fLogicPixelSize),
335cdf0e10cSrcweir 			mp0(0L),
336cdf0e10cSrcweir 			mp1(0L),
337cdf0e10cSrcweir 			mp2(0L)
338cdf0e10cSrcweir 		{
339cdf0e10cSrcweir 			const attribute::FillHatchAttribute& rHatch(rPrimitive.getHatch());
340cdf0e10cSrcweir 			const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
341cdf0e10cSrcweir 			const double fAngleA(rHatch.getAngle());
342cdf0e10cSrcweir 			maColor = rHatch.getColor();
343cdf0e10cSrcweir 			mbFillBackground = rHatch.isFillBackground();
344cdf0e10cSrcweir 			mp0 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA);
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 			if(attribute::HATCHSTYLE_DOUBLE == rHatch.getStyle() || attribute::HATCHSTYLE_TRIPLE == rHatch.getStyle())
347cdf0e10cSrcweir 			{
348cdf0e10cSrcweir 				mp1 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA + F_PI2);
349cdf0e10cSrcweir 			}
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 			if(attribute::HATCHSTYLE_TRIPLE == rHatch.getStyle())
352cdf0e10cSrcweir 			{
353cdf0e10cSrcweir 				mp2 = new GeoTexSvxHatch(aOutlineRange, rHatch.getDistance(), fAngleA + F_PI4);
354cdf0e10cSrcweir 			}
355cdf0e10cSrcweir 		}
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 		GeoTexSvxMultiHatch::~GeoTexSvxMultiHatch()
358cdf0e10cSrcweir 		{
359cdf0e10cSrcweir 			delete mp0;
360cdf0e10cSrcweir 			delete mp1;
361cdf0e10cSrcweir 			delete mp2;
362cdf0e10cSrcweir 		}
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 		bool GeoTexSvxMultiHatch::impIsOnHatch(const basegfx::B2DPoint& rUV) const
365cdf0e10cSrcweir 		{
366cdf0e10cSrcweir 			if(mp0->getDistanceToHatch(rUV) < mfLogicPixelSize)
367cdf0e10cSrcweir 			{
368cdf0e10cSrcweir 				return true;
369cdf0e10cSrcweir 			}
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 			if(mp1 && mp1->getDistanceToHatch(rUV) < mfLogicPixelSize)
372cdf0e10cSrcweir 			{
373cdf0e10cSrcweir 				return true;
374cdf0e10cSrcweir 			}
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 			if(mp2 && mp2->getDistanceToHatch(rUV) < mfLogicPixelSize)
377cdf0e10cSrcweir 			{
378cdf0e10cSrcweir 				return true;
379cdf0e10cSrcweir 			}
380cdf0e10cSrcweir 
381cdf0e10cSrcweir 			return false;
382cdf0e10cSrcweir 		}
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 		void GeoTexSvxMultiHatch::modifyBColor(const basegfx::B2DPoint& rUV, basegfx::BColor& rBColor, double& rfOpacity) const
385cdf0e10cSrcweir 		{
386cdf0e10cSrcweir 			if(impIsOnHatch(rUV))
387cdf0e10cSrcweir 			{
388cdf0e10cSrcweir 				rBColor = maColor;
389cdf0e10cSrcweir 			}
390cdf0e10cSrcweir 			else if(!mbFillBackground)
391cdf0e10cSrcweir 			{
392cdf0e10cSrcweir 				rfOpacity = 0.0;
393cdf0e10cSrcweir 			}
394cdf0e10cSrcweir 		}
395cdf0e10cSrcweir 
396cdf0e10cSrcweir 		void GeoTexSvxMultiHatch::modifyOpacity(const basegfx::B2DPoint& rUV, double& rfOpacity) const
397cdf0e10cSrcweir 		{
398cdf0e10cSrcweir 			if(mbFillBackground || impIsOnHatch(rUV))
399cdf0e10cSrcweir 			{
400cdf0e10cSrcweir 				rfOpacity = 1.0;
401cdf0e10cSrcweir 			}
402cdf0e10cSrcweir 			else
403cdf0e10cSrcweir 			{
404cdf0e10cSrcweir 				rfOpacity = 0.0;
405cdf0e10cSrcweir 			}
406cdf0e10cSrcweir 		}
407cdf0e10cSrcweir 	} // end of namespace texture
408cdf0e10cSrcweir } // end of namespace drawinglayer
409cdf0e10cSrcweir 
410cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
411cdf0e10cSrcweir // eof
412