|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Graphics Extension Library header file |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef GFXRECTANGLE2D_H |
|
20 #define GFXRECTANGLE2D_H |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 |
|
25 #include "GfxFloatFixPt.h" |
|
26 #include "GfxRectangularShape.h" |
|
27 #include "GfxPoint2D.h" |
|
28 #include "GfxPathIterator.h" |
|
29 #include "GfxAffineTransform.h" |
|
30 |
|
31 |
|
32 /** |
|
33 * Implementation of a rectangle. |
|
34 * |
|
35 * @lib Gfx2D.lib |
|
36 * @since 1.0 |
|
37 */ |
|
38 class TGfxRectangle2D : public TGfxRectangularShape |
|
39 { |
|
40 public: |
|
41 |
|
42 /** |
|
43 * Construct a rectangle. |
|
44 * |
|
45 * @since 1.0 |
|
46 * @return |
|
47 */ |
|
48 TGfxRectangle2D(); |
|
49 |
|
50 /** |
|
51 * Construct a rectangle from another TGfxRectangle2D. |
|
52 * |
|
53 * @since 1.0 |
|
54 * @param aRect : rectangle to copy |
|
55 * @return |
|
56 */ |
|
57 TGfxRectangle2D( const TGfxRectangle2D& aRect ); |
|
58 |
|
59 |
|
60 /** |
|
61 * Construct a rectangle from top-left, width/height info. |
|
62 * |
|
63 * @since 1.0 |
|
64 * @param aX : x coordinate of top-left corner |
|
65 * @param aY : y coordinate of top-left corner |
|
66 * @param aWidth: width of rectangle |
|
67 * @param aHeight : height of rectangle |
|
68 * @return |
|
69 */ |
|
70 TGfxRectangle2D( const TFloatFixPt& aX, |
|
71 const TFloatFixPt& aY, |
|
72 const TFloatFixPt& aWidth, |
|
73 const TFloatFixPt& aHeight ); |
|
74 |
|
75 /** |
|
76 * Determine if the given rectangle intersects with this rectangle. |
|
77 * |
|
78 * @since 1.0 |
|
79 * @param aRect : rectangle to check for intersection. |
|
80 * @return true, if intersection occurs. |
|
81 */ |
|
82 TBool Intersects( const TGfxRectangle2D& aRect ); |
|
83 |
|
84 /** |
|
85 * Determine if the given point is contained within this rectangle. |
|
86 * |
|
87 * @since 1.0 |
|
88 * @param aRect : rectangle to check for intersection. |
|
89 * @return true, if points is contained within rectangle |
|
90 */ |
|
91 TBool Contains( TGfxPoint2D aPoint ); |
|
92 |
|
93 /** |
|
94 * Get the path iterator for this rectangle. |
|
95 * |
|
96 * @since 1.0 |
|
97 * @param aAt : transform to apply. |
|
98 * @param aPitr : path iterator holder. |
|
99 * @return |
|
100 */ |
|
101 void GetPathIteratorL( TGfxAffineTransform* aAt, |
|
102 CGfxPathIterator*& aPitr ); |
|
103 |
|
104 /** |
|
105 * Get the path iterator for this rectangle. |
|
106 * |
|
107 * @since 1.0 |
|
108 * @param aAt : transform to apply. |
|
109 * @param aLimit : maximum of points to define the iterator. |
|
110 * @param aPitr : path iterator holder. |
|
111 * @return |
|
112 */ |
|
113 void GetPathIteratorL( TGfxAffineTransform* aAt, |
|
114 TInt aLimit, |
|
115 CGfxPathIterator*& aPitr ); |
|
116 |
|
117 /* Return shape type */ |
|
118 inline virtual TInt ShapeType () { return ERect; }; |
|
119 |
|
120 TInt operator==( const TGfxRectangle2D& aRect ) const; |
|
121 |
|
122 TInt operator!=( const TGfxRectangle2D& aRect ) const; |
|
123 }; |
|
124 |
|
125 #endif // GFXRECTANGLE2D_H |
|
126 |