xref: /aoo41x/main/vcl/source/gdi/bmpacc3.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_vcl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/poly.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <vcl/salbtype.hxx>
34*cdf0e10cSrcweir #include <vcl/bitmap.hxx>
35*cdf0e10cSrcweir #include <vcl/region.hxx>
36*cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include <bmpfast.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir // ---------------------
41*cdf0e10cSrcweir // - BitmapWriteAccess -
42*cdf0e10cSrcweir // ---------------------
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir void BitmapWriteAccess::SetLineColor()
45*cdf0e10cSrcweir {
46*cdf0e10cSrcweir 	delete mpLineColor;
47*cdf0e10cSrcweir 	mpLineColor = NULL;
48*cdf0e10cSrcweir }
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir // ------------------------------------------------------------------
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir void BitmapWriteAccess::SetLineColor( const Color& rColor )
53*cdf0e10cSrcweir {
54*cdf0e10cSrcweir 	delete mpLineColor;
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir 	if( rColor.GetTransparency() == 255 )
57*cdf0e10cSrcweir 		mpLineColor = NULL;
58*cdf0e10cSrcweir 	else
59*cdf0e10cSrcweir 		mpLineColor = ( HasPalette() ? new BitmapColor(  (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) );
60*cdf0e10cSrcweir }
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir // ------------------------------------------------------------------
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir Color BitmapWriteAccess::GetLineColor() const
65*cdf0e10cSrcweir {
66*cdf0e10cSrcweir 	Color aRet;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 	if( mpLineColor )
69*cdf0e10cSrcweir 		aRet = (const Color&) *mpLineColor;
70*cdf0e10cSrcweir 	else
71*cdf0e10cSrcweir 		aRet.SetTransparency( 255 );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir 	return aRet;
74*cdf0e10cSrcweir }
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir // ------------------------------------------------------------------
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir void BitmapWriteAccess::SetFillColor()
79*cdf0e10cSrcweir {
80*cdf0e10cSrcweir 	delete mpFillColor;
81*cdf0e10cSrcweir 	mpFillColor = NULL;
82*cdf0e10cSrcweir }
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir // ------------------------------------------------------------------
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir void BitmapWriteAccess::SetFillColor( const Color& rColor )
87*cdf0e10cSrcweir {
88*cdf0e10cSrcweir 	delete mpFillColor;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	if( rColor.GetTransparency() == 255 )
91*cdf0e10cSrcweir 		mpFillColor = NULL;
92*cdf0e10cSrcweir 	else
93*cdf0e10cSrcweir 		mpFillColor = ( HasPalette() ? new BitmapColor(  (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) );
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir // ------------------------------------------------------------------
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir Color BitmapWriteAccess::GetFillColor() const
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir 	Color aRet;
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	if( mpFillColor )
103*cdf0e10cSrcweir 		aRet = (const Color&) *mpFillColor;
104*cdf0e10cSrcweir 	else
105*cdf0e10cSrcweir 		aRet.SetTransparency( 255 );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	return aRet;
108*cdf0e10cSrcweir }
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir // ------------------------------------------------------------------
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir void BitmapWriteAccess::Erase( const Color& rColor )
113*cdf0e10cSrcweir {
114*cdf0e10cSrcweir     // convert the color format from RGB to palette index if needed
115*cdf0e10cSrcweir     // TODO: provide and use Erase( BitmapColor& method)
116*cdf0e10cSrcweir     BitmapColor aColor = rColor;
117*cdf0e10cSrcweir     if( HasPalette() )
118*cdf0e10cSrcweir         aColor = BitmapColor( (sal_uInt8)GetBestPaletteIndex( rColor) );
119*cdf0e10cSrcweir     // try fast bitmap method first
120*cdf0e10cSrcweir     if( ImplFastEraseBitmap( *mpBuffer, aColor ) )
121*cdf0e10cSrcweir         return;
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     // use the canonical method to clear the bitmap
124*cdf0e10cSrcweir 	BitmapColor*	pOldFillColor = mpFillColor ? new BitmapColor( *mpFillColor ) : NULL;
125*cdf0e10cSrcweir 	const Point		aPoint;
126*cdf0e10cSrcweir 	const Rectangle	aRect( aPoint, maBitmap.GetSizePixel() );
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	SetFillColor( rColor );
129*cdf0e10cSrcweir 	FillRect( aRect );
130*cdf0e10cSrcweir 	delete mpFillColor;
131*cdf0e10cSrcweir 	mpFillColor = pOldFillColor;
132*cdf0e10cSrcweir }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir // ------------------------------------------------------------------
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd )
137*cdf0e10cSrcweir {
138*cdf0e10cSrcweir 	if( mpLineColor )
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir 		const BitmapColor&	rLineColor = *mpLineColor;
141*cdf0e10cSrcweir 		long 				nX, nY;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 		if ( rStart.X() == rEnd.X() )
144*cdf0e10cSrcweir 		{
145*cdf0e10cSrcweir 			// vertikale Line
146*cdf0e10cSrcweir 			const long nEndY = rEnd.Y();
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 			nX = rStart.X();
149*cdf0e10cSrcweir 			nY = rStart.Y();
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 			if ( nEndY > nY )
152*cdf0e10cSrcweir 			{
153*cdf0e10cSrcweir 				for (; nY <= nEndY; nY++ )
154*cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
155*cdf0e10cSrcweir 			}
156*cdf0e10cSrcweir 			else
157*cdf0e10cSrcweir 			{
158*cdf0e10cSrcweir 				for (; nY >= nEndY; nY-- )
159*cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
160*cdf0e10cSrcweir 			}
161*cdf0e10cSrcweir 		}
162*cdf0e10cSrcweir 		else if ( rStart.Y() == rEnd.Y() )
163*cdf0e10cSrcweir 		{
164*cdf0e10cSrcweir 			// horizontale Line
165*cdf0e10cSrcweir 			const long nEndX = rEnd.X();
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 			nX = rStart.X();
168*cdf0e10cSrcweir 			nY = rStart.Y();
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir 			if ( nEndX > nX )
171*cdf0e10cSrcweir 			{
172*cdf0e10cSrcweir 				for (; nX <= nEndX; nX++ )
173*cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
174*cdf0e10cSrcweir 			}
175*cdf0e10cSrcweir 			else
176*cdf0e10cSrcweir 			{
177*cdf0e10cSrcweir 				for (; nX >= nEndX; nX-- )
178*cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
179*cdf0e10cSrcweir 			}
180*cdf0e10cSrcweir 		}
181*cdf0e10cSrcweir 		else
182*cdf0e10cSrcweir 		{
183*cdf0e10cSrcweir 			const long	nDX = labs( rEnd.X() - rStart.X() );
184*cdf0e10cSrcweir 			const long	nDY = labs( rEnd.Y() - rStart.Y() );
185*cdf0e10cSrcweir 			long		nX1;
186*cdf0e10cSrcweir 			long		nY1;
187*cdf0e10cSrcweir 			long		nX2;
188*cdf0e10cSrcweir 			long		nY2;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 			if ( nDX >= nDY )
191*cdf0e10cSrcweir 			{
192*cdf0e10cSrcweir 				if ( rStart.X() < rEnd.X() )
193*cdf0e10cSrcweir 				{
194*cdf0e10cSrcweir 					nX1 = rStart.X();
195*cdf0e10cSrcweir 					nY1 = rStart.Y();
196*cdf0e10cSrcweir 					nX2 = rEnd.X();
197*cdf0e10cSrcweir 					nY2 = rEnd.Y();
198*cdf0e10cSrcweir 				}
199*cdf0e10cSrcweir 				else
200*cdf0e10cSrcweir 				{
201*cdf0e10cSrcweir 					nX1 = rEnd.X();
202*cdf0e10cSrcweir 					nY1 = rEnd.Y();
203*cdf0e10cSrcweir 					nX2 = rStart.X();
204*cdf0e10cSrcweir 					nY2 = rStart.Y();
205*cdf0e10cSrcweir 				}
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 				const long	nDYX = ( nDY - nDX ) << 1;
208*cdf0e10cSrcweir 				const long	nDY2 = nDY << 1;
209*cdf0e10cSrcweir 				long		nD = nDY2 - nDX;
210*cdf0e10cSrcweir 				sal_Bool		bPos = nY1 < nY2;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 				for ( nX = nX1, nY = nY1; nX <= nX2; nX++ )
213*cdf0e10cSrcweir 				{
214*cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 					if ( nD < 0 )
217*cdf0e10cSrcweir 						nD += nDY2;
218*cdf0e10cSrcweir 					else
219*cdf0e10cSrcweir 					{
220*cdf0e10cSrcweir 						nD += nDYX;
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 						if ( bPos )
223*cdf0e10cSrcweir 							nY++;
224*cdf0e10cSrcweir 						else
225*cdf0e10cSrcweir 							nY--;
226*cdf0e10cSrcweir 					}
227*cdf0e10cSrcweir 				}
228*cdf0e10cSrcweir 			}
229*cdf0e10cSrcweir 			else
230*cdf0e10cSrcweir 			{
231*cdf0e10cSrcweir 				if ( rStart.Y() < rEnd.Y() )
232*cdf0e10cSrcweir 				{
233*cdf0e10cSrcweir 					nX1 = rStart.X();
234*cdf0e10cSrcweir 					nY1 = rStart.Y();
235*cdf0e10cSrcweir 					nX2 = rEnd.X();
236*cdf0e10cSrcweir 					nY2 = rEnd.Y();
237*cdf0e10cSrcweir 				}
238*cdf0e10cSrcweir 				else
239*cdf0e10cSrcweir 				{
240*cdf0e10cSrcweir 					nX1 = rEnd.X();
241*cdf0e10cSrcweir 					nY1 = rEnd.Y();
242*cdf0e10cSrcweir 					nX2 = rStart.X();
243*cdf0e10cSrcweir 					nY2 = rStart.Y();
244*cdf0e10cSrcweir 				}
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 				const long	nDYX = ( nDX - nDY ) << 1;
247*cdf0e10cSrcweir 				const long	nDY2 = nDX << 1;
248*cdf0e10cSrcweir 				long		nD = nDY2 - nDY;
249*cdf0e10cSrcweir 				sal_Bool		bPos = nX1 < nX2;
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 				for ( nX = nX1, nY = nY1; nY <= nY2; nY++ )
252*cdf0e10cSrcweir 				{
253*cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 					if ( nD < 0 )
256*cdf0e10cSrcweir 						nD += nDY2;
257*cdf0e10cSrcweir 					else
258*cdf0e10cSrcweir 					{
259*cdf0e10cSrcweir 						nD += nDYX;
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir 						if ( bPos )
262*cdf0e10cSrcweir 							nX++;
263*cdf0e10cSrcweir 						else
264*cdf0e10cSrcweir 							nX--;
265*cdf0e10cSrcweir 					}
266*cdf0e10cSrcweir 				}
267*cdf0e10cSrcweir 			}
268*cdf0e10cSrcweir 		}
269*cdf0e10cSrcweir 	}
270*cdf0e10cSrcweir }
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir // ------------------------------------------------------------------
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir void BitmapWriteAccess::FillRect( const Rectangle& rRect )
275*cdf0e10cSrcweir {
276*cdf0e10cSrcweir 	if( mpFillColor )
277*cdf0e10cSrcweir 	{
278*cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
279*cdf0e10cSrcweir 		Point 				aPoint;
280*cdf0e10cSrcweir 		Rectangle			aRect( aPoint, maBitmap.GetSizePixel() );
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir 		aRect.Intersection( rRect );
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 		if( !aRect.IsEmpty() )
285*cdf0e10cSrcweir 		{
286*cdf0e10cSrcweir 			const long	nStartX = rRect.Left();
287*cdf0e10cSrcweir 			const long	nStartY = rRect.Top();
288*cdf0e10cSrcweir 			const long	nEndX = rRect.Right();
289*cdf0e10cSrcweir 			const long	nEndY = rRect.Bottom();
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir 			for( long nY = nStartY; nY <= nEndY; nY++ )
292*cdf0e10cSrcweir 				for( long nX = nStartX; nX <= nEndX; nX++ )
293*cdf0e10cSrcweir 					SetPixel( nY, nX, rFillColor );
294*cdf0e10cSrcweir 		}
295*cdf0e10cSrcweir 	}
296*cdf0e10cSrcweir }
297*cdf0e10cSrcweir 
298*cdf0e10cSrcweir // ------------------------------------------------------------------
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir void BitmapWriteAccess::DrawRect( const Rectangle& rRect )
301*cdf0e10cSrcweir {
302*cdf0e10cSrcweir 	if( mpFillColor )
303*cdf0e10cSrcweir 		FillRect( rRect );
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
306*cdf0e10cSrcweir 	{
307*cdf0e10cSrcweir 		DrawLine( rRect.TopLeft(), rRect.TopRight() );
308*cdf0e10cSrcweir 		DrawLine( rRect.TopRight(), rRect.BottomRight() );
309*cdf0e10cSrcweir 		DrawLine( rRect.BottomRight(), rRect.BottomLeft() );
310*cdf0e10cSrcweir 		DrawLine( rRect.BottomLeft(), rRect.TopLeft() );
311*cdf0e10cSrcweir 	}
312*cdf0e10cSrcweir }
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir // ------------------------------------------------------------------
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir void BitmapWriteAccess::FillPolygon( const Polygon& rPoly )
317*cdf0e10cSrcweir {
318*cdf0e10cSrcweir 	const sal_uInt16 nSize = rPoly.GetSize();
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir 	if( nSize && mpFillColor )
321*cdf0e10cSrcweir 	{
322*cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
323*cdf0e10cSrcweir 		Region				aRegion( rPoly );
324*cdf0e10cSrcweir 		Rectangle			aRect;
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir 		aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 		if( !aRegion.IsEmpty() )
329*cdf0e10cSrcweir 		{
330*cdf0e10cSrcweir 			RegionHandle aRegHandle( aRegion.BeginEnumRects() );
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 			while( aRegion.GetNextEnumRect( aRegHandle, aRect ) )
333*cdf0e10cSrcweir 				for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
334*cdf0e10cSrcweir 					for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
335*cdf0e10cSrcweir 						SetPixel( nY, nX, rFillColor );
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 			aRegion.EndEnumRects( aRegHandle );
338*cdf0e10cSrcweir 		}
339*cdf0e10cSrcweir 	}
340*cdf0e10cSrcweir }
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir // ------------------------------------------------------------------
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir void BitmapWriteAccess::DrawPolygon( const Polygon& rPoly )
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir 	if( mpFillColor )
347*cdf0e10cSrcweir 		FillPolygon( rPoly );
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
350*cdf0e10cSrcweir 	{
351*cdf0e10cSrcweir 		const sal_uInt16 nSize = rPoly.GetSize();
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 		for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
354*cdf0e10cSrcweir 			DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 		if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
357*cdf0e10cSrcweir 			DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
358*cdf0e10cSrcweir 	}
359*cdf0e10cSrcweir }
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir // ------------------------------------------------------------------
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir void BitmapWriteAccess::FillPolyPolygon( const PolyPolygon& rPolyPoly )
364*cdf0e10cSrcweir {
365*cdf0e10cSrcweir 	const sal_uInt16 nCount = rPolyPoly.Count();
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 	if( nCount && mpFillColor )
368*cdf0e10cSrcweir 	{
369*cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
370*cdf0e10cSrcweir 		Region				aRegion( rPolyPoly );
371*cdf0e10cSrcweir 		Rectangle			aRect;
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 		aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
374*cdf0e10cSrcweir 
375*cdf0e10cSrcweir 		if( !aRegion.IsEmpty() )
376*cdf0e10cSrcweir 		{
377*cdf0e10cSrcweir 			RegionHandle aRegHandle( aRegion.BeginEnumRects() );
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 			while( aRegion.GetNextEnumRect( aRegHandle, aRect ) )
380*cdf0e10cSrcweir 				for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
381*cdf0e10cSrcweir 					for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
382*cdf0e10cSrcweir 						SetPixel( nY, nX, rFillColor );
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 			aRegion.EndEnumRects( aRegHandle );
385*cdf0e10cSrcweir 		}
386*cdf0e10cSrcweir 	}
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir // ------------------------------------------------------------------
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
392*cdf0e10cSrcweir {
393*cdf0e10cSrcweir 	if( mpFillColor )
394*cdf0e10cSrcweir 		FillPolyPolygon( rPolyPoly );
395*cdf0e10cSrcweir 
396*cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
397*cdf0e10cSrcweir 	{
398*cdf0e10cSrcweir 		for( sal_uInt16 n = 0, nCount = rPolyPoly.Count(); n < nCount; )
399*cdf0e10cSrcweir 		{
400*cdf0e10cSrcweir 			const Polygon&	rPoly = rPolyPoly[ n++ ];
401*cdf0e10cSrcweir 			const sal_uInt16	nSize = rPoly.GetSize();
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 			if( nSize )
404*cdf0e10cSrcweir 			{
405*cdf0e10cSrcweir 				for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
406*cdf0e10cSrcweir 					DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir 				if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
409*cdf0e10cSrcweir 					DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
410*cdf0e10cSrcweir 			}
411*cdf0e10cSrcweir 		}
412*cdf0e10cSrcweir 	}
413*cdf0e10cSrcweir }
414