|
1 // Copyright (c) 2008-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 TREGIONEXTEND_H_ |
|
17 #define TREGIONEXTEND_H_ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 class TRegionExtend : public TRegion |
|
22 { |
|
23 //Note that this class is generally only good for regions with dimensions less than 45000x45000 |
|
24 //as integers are used to hold the final total area, and would overflow. |
|
25 //In debug build, panic TRegionExtend x003 is raised, where x indicates a code-point |
|
26 // when any rectangle in the region exceeds 32k |
|
27 |
|
28 private: |
|
29 //Do not construct instances of this class, use the Cast() methods to convert existing region instances |
|
30 TRegionExtend(); |
|
31 TRegionExtend(const TRegionExtend&); |
|
32 public: |
|
33 //Please use TRegionExtend::Cast() calls to extend existing TRegion objects |
|
34 static TRegionExtend& Cast(TRegion& aSrc) { return (TRegionExtend&) aSrc; } |
|
35 static TRegionExtend* Cast(TRegion* aSrc) { return (TRegionExtend*) aSrc; } |
|
36 static const TRegionExtend& Cast(const TRegion& aSrc) { return (const TRegionExtend&) aSrc; } |
|
37 static const TRegionExtend* Cast(const TRegion* aSrc) { return (const TRegionExtend*) aSrc; } |
|
38 |
|
39 public: |
|
40 using TRegion::RectangleListW; |
|
41 enum TOverlapFlags |
|
42 { |
|
43 EExact= 0x0000, |
|
44 ESub= 0x0001, |
|
45 EAdd= 0x0002, |
|
46 EDiffers= 0x0003, //Added and/or subtracted |
|
47 ENoIntersect= 0x0004, |
|
48 EErrorRegion= 0x0008 //This code is returned if one of the input regions is flagged as invalid |
|
49 }; |
|
50 |
|
51 /** Avoids the use of a temp region by performing area calc on the fly. |
|
52 * If both regions are empty then EOverlapNoIntersect only is returned. |
|
53 * Limitation: this method is only good for regions with less than 2 billion units of area! |
|
54 * @param aTarget target region for difference |
|
55 **/ |
|
56 TOverlapFlags TestDifference(const TRegion& aTarget)const; |
|
57 |
|
58 /** Further avoids the use of a temp region by performing area calc on the fly. |
|
59 * If both regions are empty then EOverlapNoIntersect only is returned. |
|
60 * Limitation: this method is only good for regions with less than 2 billion units of area! |
|
61 * @param aTarget target region for difference |
|
62 * @param aOffset origin offset transformation from this to target region |
|
63 **/ |
|
64 TOverlapFlags TestDifference(const TRegion& aTarget,TPoint aOffset )const; |
|
65 |
|
66 /** Avoids the use of a temp region by performing area calc on the fly. |
|
67 * If region and rect both empty then EOverlapNoIntersect only is returned. |
|
68 * Limitation: this method is only good for regions and rects with less than 2 billion units of area! |
|
69 **/ |
|
70 TOverlapFlags TestDifference(const TRect&)const; |
|
71 |
|
72 /** Intended as an internal method to test for the overlap of two rectangles. |
|
73 * |
|
74 **/ |
|
75 static TOverlapFlags TestDifference(const TRect&,const TRect&); |
|
76 |
|
77 /** Returns total area of the region |
|
78 * Limitation: this method is only good for regions with less than 2 billion units of area! |
|
79 **/ |
|
80 TUint Area()const; |
|
81 |
|
82 |
|
83 protected: |
|
84 }; |
|
85 |
|
86 #endif /*TREGIONEXTEND_H_*/ |