|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 %{C++ |
|
10 class nsIntRegion; |
|
11 %} |
|
12 |
|
13 native nsIntRegion(nsIntRegion); |
|
14 |
|
15 |
|
16 [scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)] |
|
17 interface nsIScriptableRegion : nsISupports |
|
18 { |
|
19 void init ( ) ; |
|
20 |
|
21 /** |
|
22 * copy operator equivalent that takes another region |
|
23 * |
|
24 * @param region to copy |
|
25 * @return void |
|
26 * |
|
27 **/ |
|
28 |
|
29 void setToRegion ( in nsIScriptableRegion aRegion ); |
|
30 |
|
31 /** |
|
32 * copy operator equivalent that takes a rect |
|
33 * |
|
34 * @param aX xoffset of rect to set region to |
|
35 * @param aY yoffset of rect to set region to |
|
36 * @param aWidth width of rect to set region to |
|
37 * @param aHeight height of rect to set region to |
|
38 * @return void |
|
39 * |
|
40 **/ |
|
41 |
|
42 void setToRect ( in long aX, in long aY, in long aWidth, in long aHeight ); |
|
43 |
|
44 /** |
|
45 * destructively intersect another region with this one |
|
46 * |
|
47 * @param region to intersect |
|
48 * @return void |
|
49 * |
|
50 **/ |
|
51 |
|
52 void intersectRegion ( in nsIScriptableRegion aRegion ) ; |
|
53 |
|
54 /** |
|
55 * destructively intersect a rect with this region |
|
56 * |
|
57 * @param aX xoffset of rect to intersect with region |
|
58 * @param aY yoffset of rect to intersect with region |
|
59 * @param aWidth width of rect to intersect with region |
|
60 * @param aHeight height of rect to intersect with region |
|
61 * @return void |
|
62 * |
|
63 **/ |
|
64 |
|
65 void intersectRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
|
66 |
|
67 /** |
|
68 * destructively union another region with this one |
|
69 * |
|
70 * @param region to union |
|
71 * @return void |
|
72 * |
|
73 **/ |
|
74 |
|
75 void unionRegion ( in nsIScriptableRegion aRegion ) ; |
|
76 |
|
77 /** |
|
78 * destructively union a rect with this region |
|
79 * |
|
80 * @param aX xoffset of rect to union with region |
|
81 * @param aY yoffset of rect to union with region |
|
82 * @param aWidth width of rect to union with region |
|
83 * @param aHeight height of rect to union with region |
|
84 * @return void |
|
85 * |
|
86 **/ |
|
87 |
|
88 void unionRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
|
89 |
|
90 /** |
|
91 * destructively subtract another region with this one |
|
92 * |
|
93 * @param region to subtract |
|
94 * @return void |
|
95 * |
|
96 **/ |
|
97 |
|
98 void subtractRegion ( in nsIScriptableRegion aRegion ) ; |
|
99 |
|
100 /** |
|
101 * destructively subtract a rect from this region |
|
102 * |
|
103 * @param aX xoffset of rect to subtract with region |
|
104 * @param aY yoffset of rect to subtract with region |
|
105 * @param aWidth width of rect to subtract with region |
|
106 * @param aHeight height of rect to subtract with region |
|
107 * @return void |
|
108 * |
|
109 **/ |
|
110 |
|
111 void subtractRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
|
112 |
|
113 /** |
|
114 * is this region empty? i.e. does it contain any pixels |
|
115 * |
|
116 * @param none |
|
117 * @return returns whether the region is empty |
|
118 * |
|
119 **/ |
|
120 |
|
121 boolean isEmpty ( ) ; |
|
122 |
|
123 /** |
|
124 * == operator equivalent i.e. do the regions contain exactly |
|
125 * the same pixels |
|
126 * |
|
127 * @param region to compare |
|
128 * @return whether the regions are identical |
|
129 * |
|
130 **/ |
|
131 |
|
132 boolean isEqualRegion ( in nsIScriptableRegion aRegion ) ; |
|
133 |
|
134 /** |
|
135 * returns the bounding box of the region i.e. the smallest |
|
136 * rectangle that completely contains the region. |
|
137 * |
|
138 * @param aX out parameter for xoffset of bounding rect for region |
|
139 * @param aY out parameter for yoffset of bounding rect for region |
|
140 * @param aWidth out parameter for width of bounding rect for region |
|
141 * @param aHeight out parameter for height of bounding rect for region |
|
142 * @return void |
|
143 * |
|
144 **/ |
|
145 void getBoundingBox ( out long aX, out long aY, out long aWidth, out long aHeight ) ; |
|
146 |
|
147 /** |
|
148 * offsets the region in x and y |
|
149 * |
|
150 * @param xoffset pixel offset in x |
|
151 * @param yoffset pixel offset in y |
|
152 * @return void |
|
153 * |
|
154 **/ |
|
155 void offset ( in long aXOffset, in long aYOffset ) ; |
|
156 |
|
157 /** |
|
158 * @return null if there are no rects, |
|
159 * @return flat array of rects,ie [x1,y1,width1,height1,x2...]. |
|
160 * The result will contain bogus data if values don't fit in 31 bit |
|
161 **/ |
|
162 [implicit_jscontext] jsval getRects(); |
|
163 |
|
164 /** |
|
165 * does the region intersect the rectangle? |
|
166 * |
|
167 * @param rect to check for containment |
|
168 * @return true if the region intersects the rect |
|
169 * |
|
170 **/ |
|
171 |
|
172 boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ; |
|
173 |
|
174 [noscript] readonly attribute nsIntRegion region; |
|
175 |
|
176 }; |