os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiellipse.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiellipse.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef SWDIRECTGDIELLIPSE_H_
1.20 +#define SWDIRECTGDIELLIPSE_H_
1.21 +
1.22 +/**
1.23 +@file
1.24 +@internalComponent
1.25 +*/
1.26 +
1.27 +#include <e32std.h>
1.28 +#include <gdi.h>
1.29 +
1.30 +/**
1.31 +A utility class to efficiently draw and fill ellipses
1.32 +*/
1.33 +class TSwDirectGdiEllipse
1.34 + {
1.35 +public:
1.36 + /**
1.37 + Enumeration for the ellipse production life cycle
1.38 + */
1.39 + enum TEllipseStatus
1.40 + {
1.41 + /**
1.42 + Ellipse has been initialised but has no area
1.43 + */
1.44 + EInitialised,
1.45 + /**
1.46 + The ellipse is drawn as two parabolas. These are in two sectors, the top and bottom
1.47 + half of the rectangle. The first sector means the top parabola has been produced.
1.48 + */
1.49 + EFirstSector,
1.50 + /**
1.51 + The parabola that occupies the bottom half of the rectangle has been produced.
1.52 + */
1.53 + ESecondSector,
1.54 + /**
1.55 + The ellipse is complete
1.56 + */
1.57 + EComplete,
1.58 + /**
1.59 + The ellipse has either a height or width of two units or less
1.60 + and so takes the appearance of a line
1.61 + */
1.62 + ELine
1.63 + };
1.64 +public:
1.65 + void Construct(const TRect& aRect);
1.66 + TBool SingleStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
1.67 + TBool NextStep(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
1.68 + TPoint Intersection(const TRect& aRect,const TPoint& aPoint);
1.69 +protected:
1.70 + TBool Output(TPoint& aTopLeft,TPoint& aTopRight,TPoint& aBottomLeft,TPoint& aBottomRight);
1.71 +protected:
1.72 + TEllipseStatus iStatus;
1.73 + TInt iA;
1.74 + TInt iB;
1.75 + TInt64 iASquared;
1.76 + TInt64 iBSquared;
1.77 + TInt64 iASquBSqu;
1.78 + TInt iX;
1.79 + TInt iY;
1.80 + TInt iXAdj;
1.81 + TInt iYAdj;
1.82 + TPoint iOffset;
1.83 + TInt64 iD1;
1.84 + TInt64 iD2;
1.85 + };
1.86 +
1.87 +#endif /*SWDIRECTGDIELLIPSE_H_*/