sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #ifndef SWDIRECTGDIELLIPSE_H_
sl@0: #define SWDIRECTGDIELLIPSE_H_
sl@0: 
sl@0: /**
sl@0: @file
sl@0: @internalComponent
sl@0: */
sl@0: 
sl@0: #include <e32std.h>
sl@0: #include <gdi.h>
sl@0: 
sl@0: /**
sl@0: A utility class to efficiently draw and fill ellipses
sl@0: */
sl@0: class TSwDirectGdiEllipse
sl@0: 	{
sl@0: public:
sl@0: 	/**	
sl@0: 	Enumeration for the ellipse production life cycle
sl@0: 	*/
sl@0: 	enum TEllipseStatus
sl@0: 		{
sl@0: 		/**
sl@0: 		Ellipse has been initialised but has no area
sl@0: 		*/
sl@0: 		EInitialised,
sl@0: 		/**
sl@0: 		The ellipse is drawn as two parabolas. These are in two sectors, the top and bottom
sl@0: 		half of the rectangle. The first sector means the top parabola has been produced.
sl@0: 		*/
sl@0: 		EFirstSector,
sl@0: 		/**
sl@0: 		The parabola that occupies the bottom half of the rectangle has been produced. 
sl@0: 		*/
sl@0: 		ESecondSector,
sl@0: 		/**
sl@0: 		The ellipse is complete
sl@0: 		*/
sl@0: 		EComplete,
sl@0: 		/**
sl@0: 		The ellipse has either a height or width of two units or less
sl@0: 		and so takes the appearance of a line
sl@0: 		*/
sl@0: 		ELine
sl@0: 		};
sl@0: public:
sl@0: 	void Construct(const TRect& aRect);
sl@0: 	TBool SingleStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
sl@0: 	TBool NextStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
sl@0: 	TPoint Intersection(const TRect& aRect,const TPoint& aPoint);
sl@0: protected:
sl@0: 	TBool Output(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
sl@0: protected:
sl@0: 	TEllipseStatus iStatus;
sl@0: 	TInt iA;
sl@0: 	TInt iB;
sl@0: 	TInt64 iASquared;
sl@0: 	TInt64 iBSquared;
sl@0: 	TInt64 iASquBSqu;
sl@0: 	TInt iX;
sl@0: 	TInt iY;
sl@0: 	TInt iXAdj;
sl@0: 	TInt iYAdj;
sl@0: 	TPoint iOffset;
sl@0: 	TInt64 iD1;
sl@0: 	TInt64 iD2;
sl@0: 	};
sl@0: 
sl@0: #endif /*SWDIRECTGDIELLIPSE_H_*/