os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiellipse.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef SWDIRECTGDIELLIPSE_H_
    17 #define SWDIRECTGDIELLIPSE_H_
    18 
    19 /**
    20 @file
    21 @internalComponent
    22 */
    23 
    24 #include <e32std.h>
    25 #include <gdi.h>
    26 
    27 /**
    28 A utility class to efficiently draw and fill ellipses
    29 */
    30 class TSwDirectGdiEllipse
    31 	{
    32 public:
    33 	/**	
    34 	Enumeration for the ellipse production life cycle
    35 	*/
    36 	enum TEllipseStatus
    37 		{
    38 		/**
    39 		Ellipse has been initialised but has no area
    40 		*/
    41 		EInitialised,
    42 		/**
    43 		The ellipse is drawn as two parabolas. These are in two sectors, the top and bottom
    44 		half of the rectangle. The first sector means the top parabola has been produced.
    45 		*/
    46 		EFirstSector,
    47 		/**
    48 		The parabola that occupies the bottom half of the rectangle has been produced. 
    49 		*/
    50 		ESecondSector,
    51 		/**
    52 		The ellipse is complete
    53 		*/
    54 		EComplete,
    55 		/**
    56 		The ellipse has either a height or width of two units or less
    57 		and so takes the appearance of a line
    58 		*/
    59 		ELine
    60 		};
    61 public:
    62 	void Construct(const TRect& aRect);
    63 	TBool SingleStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
    64 	TBool NextStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
    65 	TPoint Intersection(const TRect& aRect,const TPoint& aPoint);
    66 protected:
    67 	TBool Output(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
    68 protected:
    69 	TEllipseStatus iStatus;
    70 	TInt iA;
    71 	TInt iB;
    72 	TInt64 iASquared;
    73 	TInt64 iBSquared;
    74 	TInt64 iASquBSqu;
    75 	TInt iX;
    76 	TInt iY;
    77 	TInt iXAdj;
    78 	TInt iYAdj;
    79 	TPoint iOffset;
    80 	TInt64 iD1;
    81 	TInt64 iD2;
    82 	};
    83 
    84 #endif /*SWDIRECTGDIELLIPSE_H_*/