xref: /aoo41x/main/vcl/source/gdi/bmpacc3.cxx (revision e6f63103)
19f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59f62ea84SAndrew Rist  * distributed with this work for additional information
69f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
99f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
109f62ea84SAndrew Rist  *
119f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129f62ea84SAndrew Rist  *
139f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149f62ea84SAndrew Rist  * software distributed under the License is distributed on an
159f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
179f62ea84SAndrew Rist  * specific language governing permissions and limitations
189f62ea84SAndrew Rist  * under the License.
199f62ea84SAndrew Rist  *
209f62ea84SAndrew Rist  *************************************************************/
219f62ea84SAndrew Rist 
229f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/poly.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <vcl/salbtype.hxx>
30cdf0e10cSrcweir #include <vcl/bitmap.hxx>
31cdf0e10cSrcweir #include <vcl/region.hxx>
32cdf0e10cSrcweir #include <vcl/bmpacc.hxx>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <bmpfast.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir // ---------------------
37cdf0e10cSrcweir // - BitmapWriteAccess -
38cdf0e10cSrcweir // ---------------------
39cdf0e10cSrcweir 
SetLineColor()40cdf0e10cSrcweir void BitmapWriteAccess::SetLineColor()
41cdf0e10cSrcweir {
42cdf0e10cSrcweir 	delete mpLineColor;
43cdf0e10cSrcweir 	mpLineColor = NULL;
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir // ------------------------------------------------------------------
47cdf0e10cSrcweir 
SetLineColor(const Color & rColor)48cdf0e10cSrcweir void BitmapWriteAccess::SetLineColor( const Color& rColor )
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	delete mpLineColor;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir 	if( rColor.GetTransparency() == 255 )
53cdf0e10cSrcweir 		mpLineColor = NULL;
54cdf0e10cSrcweir 	else
55cdf0e10cSrcweir 		mpLineColor = ( HasPalette() ? new BitmapColor(  (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) );
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir // ------------------------------------------------------------------
59cdf0e10cSrcweir 
GetLineColor() const60cdf0e10cSrcweir Color BitmapWriteAccess::GetLineColor() const
61cdf0e10cSrcweir {
62cdf0e10cSrcweir 	Color aRet;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 	if( mpLineColor )
65cdf0e10cSrcweir 		aRet = (const Color&) *mpLineColor;
66cdf0e10cSrcweir 	else
67cdf0e10cSrcweir 		aRet.SetTransparency( 255 );
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	return aRet;
70cdf0e10cSrcweir }
71cdf0e10cSrcweir 
72cdf0e10cSrcweir // ------------------------------------------------------------------
73cdf0e10cSrcweir 
SetFillColor()74cdf0e10cSrcweir void BitmapWriteAccess::SetFillColor()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	delete mpFillColor;
77cdf0e10cSrcweir 	mpFillColor = NULL;
78cdf0e10cSrcweir }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // ------------------------------------------------------------------
81cdf0e10cSrcweir 
SetFillColor(const Color & rColor)82cdf0e10cSrcweir void BitmapWriteAccess::SetFillColor( const Color& rColor )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir 	delete mpFillColor;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	if( rColor.GetTransparency() == 255 )
87cdf0e10cSrcweir 		mpFillColor = NULL;
88cdf0e10cSrcweir 	else
89cdf0e10cSrcweir 		mpFillColor = ( HasPalette() ? new BitmapColor(  (sal_uInt8) GetBestPaletteIndex( rColor ) ) : new BitmapColor( rColor ) );
90cdf0e10cSrcweir }
91cdf0e10cSrcweir 
92cdf0e10cSrcweir // ------------------------------------------------------------------
93cdf0e10cSrcweir 
GetFillColor() const94cdf0e10cSrcweir Color BitmapWriteAccess::GetFillColor() const
95cdf0e10cSrcweir {
96cdf0e10cSrcweir 	Color aRet;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	if( mpFillColor )
99cdf0e10cSrcweir 		aRet = (const Color&) *mpFillColor;
100cdf0e10cSrcweir 	else
101cdf0e10cSrcweir 		aRet.SetTransparency( 255 );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	return aRet;
104cdf0e10cSrcweir }
105cdf0e10cSrcweir 
106cdf0e10cSrcweir // ------------------------------------------------------------------
107cdf0e10cSrcweir 
Erase(const Color & rColor)108cdf0e10cSrcweir void BitmapWriteAccess::Erase( const Color& rColor )
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     // convert the color format from RGB to palette index if needed
111cdf0e10cSrcweir     // TODO: provide and use Erase( BitmapColor& method)
112cdf0e10cSrcweir     BitmapColor aColor = rColor;
113cdf0e10cSrcweir     if( HasPalette() )
114cdf0e10cSrcweir         aColor = BitmapColor( (sal_uInt8)GetBestPaletteIndex( rColor) );
115cdf0e10cSrcweir     // try fast bitmap method first
116cdf0e10cSrcweir     if( ImplFastEraseBitmap( *mpBuffer, aColor ) )
117cdf0e10cSrcweir         return;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir     // use the canonical method to clear the bitmap
120cdf0e10cSrcweir 	BitmapColor*	pOldFillColor = mpFillColor ? new BitmapColor( *mpFillColor ) : NULL;
121cdf0e10cSrcweir 	const Point		aPoint;
122cdf0e10cSrcweir 	const Rectangle	aRect( aPoint, maBitmap.GetSizePixel() );
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	SetFillColor( rColor );
125cdf0e10cSrcweir 	FillRect( aRect );
126cdf0e10cSrcweir 	delete mpFillColor;
127cdf0e10cSrcweir 	mpFillColor = pOldFillColor;
128cdf0e10cSrcweir }
129cdf0e10cSrcweir 
130cdf0e10cSrcweir // ------------------------------------------------------------------
131cdf0e10cSrcweir 
DrawLine(const Point & rStart,const Point & rEnd)132cdf0e10cSrcweir void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd )
133cdf0e10cSrcweir {
134cdf0e10cSrcweir 	if( mpLineColor )
135cdf0e10cSrcweir 	{
136cdf0e10cSrcweir 		const BitmapColor&	rLineColor = *mpLineColor;
137cdf0e10cSrcweir 		long 				nX, nY;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 		if ( rStart.X() == rEnd.X() )
140cdf0e10cSrcweir 		{
141cdf0e10cSrcweir 			// vertikale Line
142cdf0e10cSrcweir 			const long nEndY = rEnd.Y();
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 			nX = rStart.X();
145cdf0e10cSrcweir 			nY = rStart.Y();
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 			if ( nEndY > nY )
148cdf0e10cSrcweir 			{
149cdf0e10cSrcweir 				for (; nY <= nEndY; nY++ )
150cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
151cdf0e10cSrcweir 			}
152cdf0e10cSrcweir 			else
153cdf0e10cSrcweir 			{
154cdf0e10cSrcweir 				for (; nY >= nEndY; nY-- )
155cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
156cdf0e10cSrcweir 			}
157cdf0e10cSrcweir 		}
158cdf0e10cSrcweir 		else if ( rStart.Y() == rEnd.Y() )
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir 			// horizontale Line
161cdf0e10cSrcweir 			const long nEndX = rEnd.X();
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 			nX = rStart.X();
164cdf0e10cSrcweir 			nY = rStart.Y();
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 			if ( nEndX > nX )
167cdf0e10cSrcweir 			{
168cdf0e10cSrcweir 				for (; nX <= nEndX; nX++ )
169cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
170cdf0e10cSrcweir 			}
171cdf0e10cSrcweir 			else
172cdf0e10cSrcweir 			{
173cdf0e10cSrcweir 				for (; nX >= nEndX; nX-- )
174cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
175cdf0e10cSrcweir 			}
176cdf0e10cSrcweir 		}
177cdf0e10cSrcweir 		else
178cdf0e10cSrcweir 		{
179cdf0e10cSrcweir 			const long	nDX = labs( rEnd.X() - rStart.X() );
180cdf0e10cSrcweir 			const long	nDY = labs( rEnd.Y() - rStart.Y() );
181cdf0e10cSrcweir 			long		nX1;
182cdf0e10cSrcweir 			long		nY1;
183cdf0e10cSrcweir 			long		nX2;
184cdf0e10cSrcweir 			long		nY2;
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 			if ( nDX >= nDY )
187cdf0e10cSrcweir 			{
188cdf0e10cSrcweir 				if ( rStart.X() < rEnd.X() )
189cdf0e10cSrcweir 				{
190cdf0e10cSrcweir 					nX1 = rStart.X();
191cdf0e10cSrcweir 					nY1 = rStart.Y();
192cdf0e10cSrcweir 					nX2 = rEnd.X();
193cdf0e10cSrcweir 					nY2 = rEnd.Y();
194cdf0e10cSrcweir 				}
195cdf0e10cSrcweir 				else
196cdf0e10cSrcweir 				{
197cdf0e10cSrcweir 					nX1 = rEnd.X();
198cdf0e10cSrcweir 					nY1 = rEnd.Y();
199cdf0e10cSrcweir 					nX2 = rStart.X();
200cdf0e10cSrcweir 					nY2 = rStart.Y();
201cdf0e10cSrcweir 				}
202cdf0e10cSrcweir 
203cdf0e10cSrcweir 				const long	nDYX = ( nDY - nDX ) << 1;
204cdf0e10cSrcweir 				const long	nDY2 = nDY << 1;
205cdf0e10cSrcweir 				long		nD = nDY2 - nDX;
206cdf0e10cSrcweir 				sal_Bool		bPos = nY1 < nY2;
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 				for ( nX = nX1, nY = nY1; nX <= nX2; nX++ )
209cdf0e10cSrcweir 				{
210cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
211cdf0e10cSrcweir 
212cdf0e10cSrcweir 					if ( nD < 0 )
213cdf0e10cSrcweir 						nD += nDY2;
214cdf0e10cSrcweir 					else
215cdf0e10cSrcweir 					{
216cdf0e10cSrcweir 						nD += nDYX;
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 						if ( bPos )
219cdf0e10cSrcweir 							nY++;
220cdf0e10cSrcweir 						else
221cdf0e10cSrcweir 							nY--;
222cdf0e10cSrcweir 					}
223cdf0e10cSrcweir 				}
224cdf0e10cSrcweir 			}
225cdf0e10cSrcweir 			else
226cdf0e10cSrcweir 			{
227cdf0e10cSrcweir 				if ( rStart.Y() < rEnd.Y() )
228cdf0e10cSrcweir 				{
229cdf0e10cSrcweir 					nX1 = rStart.X();
230cdf0e10cSrcweir 					nY1 = rStart.Y();
231cdf0e10cSrcweir 					nX2 = rEnd.X();
232cdf0e10cSrcweir 					nY2 = rEnd.Y();
233cdf0e10cSrcweir 				}
234cdf0e10cSrcweir 				else
235cdf0e10cSrcweir 				{
236cdf0e10cSrcweir 					nX1 = rEnd.X();
237cdf0e10cSrcweir 					nY1 = rEnd.Y();
238cdf0e10cSrcweir 					nX2 = rStart.X();
239cdf0e10cSrcweir 					nY2 = rStart.Y();
240cdf0e10cSrcweir 				}
241cdf0e10cSrcweir 
242cdf0e10cSrcweir 				const long	nDYX = ( nDX - nDY ) << 1;
243cdf0e10cSrcweir 				const long	nDY2 = nDX << 1;
244cdf0e10cSrcweir 				long		nD = nDY2 - nDY;
245cdf0e10cSrcweir 				sal_Bool		bPos = nX1 < nX2;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir 				for ( nX = nX1, nY = nY1; nY <= nY2; nY++ )
248cdf0e10cSrcweir 				{
249cdf0e10cSrcweir 					SetPixel( nY, nX, rLineColor );
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 					if ( nD < 0 )
252cdf0e10cSrcweir 						nD += nDY2;
253cdf0e10cSrcweir 					else
254cdf0e10cSrcweir 					{
255cdf0e10cSrcweir 						nD += nDYX;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir 						if ( bPos )
258cdf0e10cSrcweir 							nX++;
259cdf0e10cSrcweir 						else
260cdf0e10cSrcweir 							nX--;
261cdf0e10cSrcweir 					}
262cdf0e10cSrcweir 				}
263cdf0e10cSrcweir 			}
264cdf0e10cSrcweir 		}
265cdf0e10cSrcweir 	}
266cdf0e10cSrcweir }
267cdf0e10cSrcweir 
268cdf0e10cSrcweir // ------------------------------------------------------------------
269cdf0e10cSrcweir 
FillRect(const Rectangle & rRect)270cdf0e10cSrcweir void BitmapWriteAccess::FillRect( const Rectangle& rRect )
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 	if( mpFillColor )
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
275cdf0e10cSrcweir 		Point 				aPoint;
276cdf0e10cSrcweir 		Rectangle			aRect( aPoint, maBitmap.GetSizePixel() );
277cdf0e10cSrcweir 
278cdf0e10cSrcweir 		aRect.Intersection( rRect );
279cdf0e10cSrcweir 
280cdf0e10cSrcweir 		if( !aRect.IsEmpty() )
281cdf0e10cSrcweir 		{
282cdf0e10cSrcweir 			const long	nStartX = rRect.Left();
283cdf0e10cSrcweir 			const long	nStartY = rRect.Top();
284cdf0e10cSrcweir 			const long	nEndX = rRect.Right();
285cdf0e10cSrcweir 			const long	nEndY = rRect.Bottom();
286cdf0e10cSrcweir 
287cdf0e10cSrcweir 			for( long nY = nStartY; nY <= nEndY; nY++ )
288cdf0e10cSrcweir 				for( long nX = nStartX; nX <= nEndX; nX++ )
289cdf0e10cSrcweir 					SetPixel( nY, nX, rFillColor );
290cdf0e10cSrcweir 		}
291cdf0e10cSrcweir 	}
292cdf0e10cSrcweir }
293cdf0e10cSrcweir 
294cdf0e10cSrcweir // ------------------------------------------------------------------
295cdf0e10cSrcweir 
DrawRect(const Rectangle & rRect)296cdf0e10cSrcweir void BitmapWriteAccess::DrawRect( const Rectangle& rRect )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir 	if( mpFillColor )
299cdf0e10cSrcweir 		FillRect( rRect );
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
302cdf0e10cSrcweir 	{
303cdf0e10cSrcweir 		DrawLine( rRect.TopLeft(), rRect.TopRight() );
304cdf0e10cSrcweir 		DrawLine( rRect.TopRight(), rRect.BottomRight() );
305cdf0e10cSrcweir 		DrawLine( rRect.BottomRight(), rRect.BottomLeft() );
306cdf0e10cSrcweir 		DrawLine( rRect.BottomLeft(), rRect.TopLeft() );
307cdf0e10cSrcweir 	}
308cdf0e10cSrcweir }
309cdf0e10cSrcweir 
310cdf0e10cSrcweir // ------------------------------------------------------------------
311cdf0e10cSrcweir 
FillPolygon(const Polygon & rPoly)312cdf0e10cSrcweir void BitmapWriteAccess::FillPolygon( const Polygon& rPoly )
313cdf0e10cSrcweir {
314cdf0e10cSrcweir 	const sal_uInt16 nSize = rPoly.GetSize();
315cdf0e10cSrcweir 
316cdf0e10cSrcweir 	if( nSize && mpFillColor )
317cdf0e10cSrcweir 	{
318cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
319cdf0e10cSrcweir 		Region				aRegion( rPoly );
320*e6f63103SArmin Le Grand //		Rectangle			aRect;
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 		aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
323cdf0e10cSrcweir 
324cdf0e10cSrcweir 		if( !aRegion.IsEmpty() )
325cdf0e10cSrcweir 		{
326*e6f63103SArmin Le Grand             RectangleVector aRectangles;
327*e6f63103SArmin Le Grand             aRegion.GetRegionRectangles(aRectangles);
328*e6f63103SArmin Le Grand 
329*e6f63103SArmin Le Grand             for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
330*e6f63103SArmin Le Grand             {
331*e6f63103SArmin Le Grand                 for(long nY = aRectIter->Top(), nEndY = aRectIter->Bottom(); nY <= nEndY; nY++)
332*e6f63103SArmin Le Grand                 {
333*e6f63103SArmin Le Grand                     for(long nX = aRectIter->Left(), nEndX = aRectIter->Right(); nX <= nEndX; nX++)
334*e6f63103SArmin Le Grand                     {
335*e6f63103SArmin Le Grand                         SetPixel(nY, nX, rFillColor);
336*e6f63103SArmin Le Grand                     }
337*e6f63103SArmin Le Grand                 }
338*e6f63103SArmin Le Grand             }
339*e6f63103SArmin Le Grand 
340*e6f63103SArmin Le Grand 			//RegionHandle aRegHandle( aRegion.BeginEnumRects() );
341*e6f63103SArmin Le Grand             //
342*e6f63103SArmin Le Grand 			//while( aRegion.GetEnumRects( aRegHandle, aRect ) )
343*e6f63103SArmin Le Grand 			//	for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
344*e6f63103SArmin Le Grand 			//		for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
345*e6f63103SArmin Le Grand 			//			SetPixel( nY, nX, rFillColor );
346*e6f63103SArmin Le Grand             //
347*e6f63103SArmin Le Grand 			//aRegion.EndEnumRects( aRegHandle );
348cdf0e10cSrcweir 		}
349cdf0e10cSrcweir 	}
350cdf0e10cSrcweir }
351cdf0e10cSrcweir 
352cdf0e10cSrcweir // ------------------------------------------------------------------
353cdf0e10cSrcweir 
DrawPolygon(const Polygon & rPoly)354cdf0e10cSrcweir void BitmapWriteAccess::DrawPolygon( const Polygon& rPoly )
355cdf0e10cSrcweir {
356cdf0e10cSrcweir 	if( mpFillColor )
357cdf0e10cSrcweir 		FillPolygon( rPoly );
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
360cdf0e10cSrcweir 	{
361cdf0e10cSrcweir 		const sal_uInt16 nSize = rPoly.GetSize();
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 		for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
364cdf0e10cSrcweir 			DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
365cdf0e10cSrcweir 
366cdf0e10cSrcweir 		if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
367cdf0e10cSrcweir 			DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
368cdf0e10cSrcweir 	}
369cdf0e10cSrcweir }
370cdf0e10cSrcweir 
371cdf0e10cSrcweir // ------------------------------------------------------------------
372cdf0e10cSrcweir 
FillPolyPolygon(const PolyPolygon & rPolyPoly)373cdf0e10cSrcweir void BitmapWriteAccess::FillPolyPolygon( const PolyPolygon& rPolyPoly )
374cdf0e10cSrcweir {
375cdf0e10cSrcweir 	const sal_uInt16 nCount = rPolyPoly.Count();
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 	if( nCount && mpFillColor )
378cdf0e10cSrcweir 	{
379cdf0e10cSrcweir 		const BitmapColor&	rFillColor = *mpFillColor;
380cdf0e10cSrcweir 		Region				aRegion( rPolyPoly );
381*e6f63103SArmin Le Grand 		//Rectangle			aRect;
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 		aRegion.Intersect( Rectangle( Point(), Size( Width(), Height() ) ) );
384cdf0e10cSrcweir 
385cdf0e10cSrcweir 		if( !aRegion.IsEmpty() )
386cdf0e10cSrcweir 		{
387*e6f63103SArmin Le Grand             RectangleVector aRectangles;
388*e6f63103SArmin Le Grand             aRegion.GetRegionRectangles(aRectangles);
389*e6f63103SArmin Le Grand 
390*e6f63103SArmin Le Grand             for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
391*e6f63103SArmin Le Grand             {
392*e6f63103SArmin Le Grand                 for(long nY = aRectIter->Top(), nEndY = aRectIter->Bottom(); nY <= nEndY; nY++)
393*e6f63103SArmin Le Grand                 {
394*e6f63103SArmin Le Grand                     for(long nX = aRectIter->Left(), nEndX = aRectIter->Right(); nX <= nEndX; nX++)
395*e6f63103SArmin Le Grand                     {
396*e6f63103SArmin Le Grand                         SetPixel(nY, nX, rFillColor);
397*e6f63103SArmin Le Grand                     }
398*e6f63103SArmin Le Grand                 }
399*e6f63103SArmin Le Grand             }
400*e6f63103SArmin Le Grand 
401*e6f63103SArmin Le Grand             //RegionHandle aRegHandle( aRegion.BeginEnumRects() );
402*e6f63103SArmin Le Grand 			//
403*e6f63103SArmin Le Grand 			//while( aRegion.GetEnumRects( aRegHandle, aRect ) )
404*e6f63103SArmin Le Grand 			//	for( long nY = aRect.Top(), nEndY = aRect.Bottom(); nY <= nEndY; nY++ )
405*e6f63103SArmin Le Grand 			//		for( long nX = aRect.Left(), nEndX = aRect.Right(); nX <= nEndX; nX++ )
406*e6f63103SArmin Le Grand 			//			SetPixel( nY, nX, rFillColor );
407*e6f63103SArmin Le Grand             //
408*e6f63103SArmin Le Grand 			//aRegion.EndEnumRects( aRegHandle );
409cdf0e10cSrcweir 		}
410cdf0e10cSrcweir 	}
411cdf0e10cSrcweir }
412cdf0e10cSrcweir 
413cdf0e10cSrcweir // ------------------------------------------------------------------
414cdf0e10cSrcweir 
DrawPolyPolygon(const PolyPolygon & rPolyPoly)415cdf0e10cSrcweir void BitmapWriteAccess::DrawPolyPolygon( const PolyPolygon& rPolyPoly )
416cdf0e10cSrcweir {
417cdf0e10cSrcweir 	if( mpFillColor )
418cdf0e10cSrcweir 		FillPolyPolygon( rPolyPoly );
419cdf0e10cSrcweir 
420cdf0e10cSrcweir 	if( mpLineColor && ( !mpFillColor || ( *mpFillColor != *mpLineColor ) ) )
421cdf0e10cSrcweir 	{
422cdf0e10cSrcweir 		for( sal_uInt16 n = 0, nCount = rPolyPoly.Count(); n < nCount; )
423cdf0e10cSrcweir 		{
424cdf0e10cSrcweir 			const Polygon&	rPoly = rPolyPoly[ n++ ];
425cdf0e10cSrcweir 			const sal_uInt16	nSize = rPoly.GetSize();
426cdf0e10cSrcweir 
427cdf0e10cSrcweir 			if( nSize )
428cdf0e10cSrcweir 			{
429cdf0e10cSrcweir 				for( sal_uInt16 i = 0, nSize1 = nSize - 1; i < nSize1; i++ )
430cdf0e10cSrcweir 					DrawLine( rPoly[ i ], rPoly[ i + 1 ] );
431cdf0e10cSrcweir 
432cdf0e10cSrcweir 				if( rPoly[ nSize - 1 ] != rPoly[ 0 ] )
433cdf0e10cSrcweir 					DrawLine( rPoly[ nSize - 1 ], rPoly[ 0 ] );
434cdf0e10cSrcweir 			}
435cdf0e10cSrcweir 		}
436cdf0e10cSrcweir 	}
437cdf0e10cSrcweir }
438