1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is Mozilla Communicator.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corp.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Mike Pinkerton
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41
42 %{C++
43 class nsIRegion;
44 %}
45
46 [ptr] native nsIRegion(nsIRegion);
47
48
49 [scriptable, uuid(82d8f400-5bde-11d3-b033-b27a62766bbc)]
50 interface nsIScriptableRegion : nsISupports
51 {
52 void init ( ) ;
53
54 /**
55 * copy operator equivalent that takes another region
56 *
57 * @param region to copy
58 * @return void
59 *
60 **/
61
62 void setToRegion ( in nsIScriptableRegion aRegion );
63
64 /**
65 * copy operator equivalent that takes a rect
66 *
67 * @param aX xoffset of rect to set region to
68 * @param aY yoffset of rect to set region to
69 * @param aWidth width of rect to set region to
70 * @param aHeight height of rect to set region to
71 * @return void
72 *
73 **/
74
75 void setToRect ( in long aX, in long aY, in long aWidth, in long aHeight );
76
77 /**
78 * destructively intersect another region with this one
79 *
80 * @param region to intersect
81 * @return void
82 *
83 **/
84
85 void intersectRegion ( in nsIScriptableRegion aRegion ) ;
86
87 /**
88 * destructively intersect a rect with this region
89 *
90 * @param aX xoffset of rect to intersect with region
91 * @param aY yoffset of rect to intersect with region
92 * @param aWidth width of rect to intersect with region
93 * @param aHeight height of rect to intersect with region
94 * @return void
95 *
96 **/
97
98 void intersectRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
99
100 /**
101 * destructively union another region with this one
102 *
103 * @param region to union
104 * @return void
105 *
106 **/
107
108 void unionRegion ( in nsIScriptableRegion aRegion ) ;
109
110 /**
111 * destructively union a rect with this region
112 *
113 * @param aX xoffset of rect to union with region
114 * @param aY yoffset of rect to union with region
115 * @param aWidth width of rect to union with region
116 * @param aHeight height of rect to union with region
117 * @return void
118 *
119 **/
120
121 void unionRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
122
123 /**
124 * destructively subtract another region with this one
125 *
126 * @param region to subtract
127 * @return void
128 *
129 **/
130
131 void subtractRegion ( in nsIScriptableRegion aRegion ) ;
132
133 /**
134 * destructively subtract a rect from this region
135 *
136 * @param aX xoffset of rect to subtract with region
137 * @param aY yoffset of rect to subtract with region
138 * @param aWidth width of rect to subtract with region
139 * @param aHeight height of rect to subtract with region
140 * @return void
141 *
142 **/
143
144 void subtractRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
145
146 /**
147 * is this region empty? i.e. does it contain any pixels
148 *
149 * @param none
150 * @return returns whether the region is empty
151 *
152 **/
153
154 boolean isEmpty ( ) ;
155
156 /**
157 * == operator equivalent i.e. do the regions contain exactly
158 * the same pixels
159 *
160 * @param region to compare
161 * @return whether the regions are identical
162 *
163 **/
164
165 boolean isEqualRegion ( in nsIScriptableRegion aRegion ) ;
166
167 /**
168 * returns the bounding box of the region i.e. the smallest
169 * rectangle that completely contains the region.
170 *
171 * @param aX out parameter for xoffset of bounding rect for region
172 * @param aY out parameter for yoffset of bounding rect for region
173 * @param aWidth out parameter for width of bounding rect for region
174 * @param aHeight out parameter for height of bounding rect for region
175 * @return void
176 *
177 **/
178 void getBoundingBox ( out long aX, out long aY, out long aWidth, out long aHeight ) ;
179
180 /**
181 * offsets the region in x and y
182 *
183 * @param xoffset pixel offset in x
184 * @param yoffset pixel offset in y
185 * @return void
186 *
187 **/
188 void offset ( in long aXOffset, in long aYOffset ) ;
189
190 /**
191 * does the region intersect the rectangle?
192 *
193 * @param rect to check for containment
194 * @return true if the region intersects the rect
195 *
196 **/
197
198 boolean containsRect ( in long aX, in long aY, in long aWidth, in long aHeight ) ;
199
200 [noscript] readonly attribute nsIRegion region;
201
202 };
203
204
205 %{ C++
206
207 %}