• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1SkIRect Reference
2===
3
4# <a name="IRect"></a> IRect
5
6## <a name="Overview"></a> Overview
7
8## <a name="Overview_Subtopic"></a> Overview Subtopic
9
10| name | description |
11| --- | --- |
12| <a href="#Constructor">Constructor</a> | functions that construct <a href="#SkIRect">SkIRect</a> |
13| <a href="#Member_Function">Member Function</a> | static functions and member methods |
14| <a href="#Member">Member</a> | member values |
15| <a href="#Operator">Operator</a> | operator overloading methods |
16| <a href="#Related_Function">Related Function</a> | similar methods grouped together |
17
18# <a name="SkIRect"></a> Struct SkIRect
19<a href="#SkIRect">SkIRect</a> holds four 32 bit integer coordinates describing the upper and
20lower bounds of a rectangle. <a href="#SkIRect">SkIRect</a> may be created from outer bounds or
21from position, width, and height. <a href="#SkIRect">SkIRect</a> describes an area; if its right
22is less than or equal to its left, or if its bottom is less than or equal to
23its top, it is considered empty.
24
25## <a name="Related_Function"></a> Related Function
26
27| name | description |
28| --- | --- |
29| <a href="#Inset_Outset_Offset">Inset Outset Offset</a> | moves sides |
30| <a href="#Intersection">Intersection</a> | set to shared bounds |
31| <a href="#Join">Join</a> | set to union of bounds |
32| <a href="#Property">Property</a> | member values, center, validity |
33| <a href="#Set">Set</a> | replaces all values |
34| <a href="#Sorting">Sorting</a> | orders sides |
35
36## <a name="Member_Function"></a> Member Function
37
38| name | description |
39| --- | --- |
40| <a href="#SkIRect_EmptyIRect">EmptyIRect</a> | returns immutable bounds of (0, 0, 0, 0) |
41| <a href="#SkIRect_Intersects">Intersects</a> | returns true if areas overlap |
42| <a href="#SkIRect_IntersectsNoEmptyCheck">IntersectsNoEmptyCheck</a> | returns true if areas overlap skips empty check |
43| <a href="#SkIRect_MakeEmpty">MakeEmpty</a> | returns bounds of (0, 0, 0, 0) |
44| <a href="#SkIRect_MakeLTRB">MakeLTRB</a> | constructs from int left, top, right, bottom |
45| <a href="#SkIRect_MakeSize">MakeSize</a> | constructs from <a href="undocumented#ISize">ISize</a> returning (0, 0, width, height) |
46| <a href="#SkIRect_MakeWH">MakeWH</a> | constructs from int input returning (0, 0, width, height) |
47| <a href="#SkIRect_MakeXYWH">MakeXYWH</a> | constructs from int input returning (x, y, width, height) |
48| <a href="#SkIRect_bottom">bottom</a> | returns larger bounds in y, if sorted |
49| <a href="#SkIRect_centerX">centerX</a> | returns midpoint in x |
50| <a href="#SkIRect_centerY">centerY</a> | returns midpoint in y |
51| <a href="#SkIRect_contains">contains</a> | returns true if <a href="SkIPoint_Reference#IPoint">IPoint</a> (x, y) is equal or inside |
52| <a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a> | returns true if contains unsorted <a href="#IRect">IRect</a> |
53| <a href="#SkIRect_height">height</a> | returns span in y |
54| <a href="#SkIRect_height64">height64</a> | returns span in y as int64_t |
55| <a href="#SkIRect_inset">inset</a> | moves the sides symmetrically about the center |
56| <a href="#SkIRect_intersect">intersect</a> | sets to shared area; returns true if not empty |
57| <a href="#SkIRect_intersectNoEmptyCheck">intersectNoEmptyCheck</a> | sets to shared area; returns true if not empty skips empty check |
58| <a href="#SkIRect_is16Bit">is16Bit</a> | returns true if members fit in 16-bit word |
59| <a href="#SkIRect_isEmpty">isEmpty</a> | returns true if width or height are zero or negative or they exceed int32_t |
60| <a href="#SkIRect_isEmpty64">isEmpty64</a> | returns true if width or height are zero or negative |
61| <a href="#SkIRect_join">join</a> | sets to union of bounds |
62| <a href="#SkIRect_left">left</a> | returns smaller bounds in x, if sorted |
63| <a href="#SkIRect_makeInset">makeInset</a> | constructs from sides moved symmetrically about the center |
64| <a href="#SkIRect_makeOffset">makeOffset</a> | constructs from translated sides |
65| <a href="#SkIRect_makeOutset">makeOutset</a> | constructs from sides moved symmetrically about the center |
66| <a href="#SkIRect_makeSorted">makeSorted</a> | constructs, ordering sides from smaller to larger |
67| <a href="#SkIRect_offset">offset</a> | translates sides without changing width and height |
68| <a href="#SkIRect_offsetTo">offsetTo</a> | translates to (x, y) without changing width and height |
69| <a href="#SkIRect_outset">outset</a> | moves the sides symmetrically about the center |
70| <a href="#SkIRect_quickReject">quickReject</a> | returns true if rectangles do not intersect |
71| <a href="#SkIRect_right">right</a> | returns larger bounds in x, if sorted |
72| <a href="#SkIRect_set">set</a> | sets to (left, top, right, bottom) |
73| <a href="#SkIRect_setEmpty">setEmpty</a> | sets to (0, 0, 0, 0) |
74| <a href="#SkIRect_setLTRB">setLTRB</a> | sets to <a href="undocumented#SkScalar">SkScalar</a> input (left, top, right, bottom) |
75| <a href="#SkIRect_setXYWH">setXYWH</a> | sets to (x, y, width, height) |
76| <a href="#SkIRect_size">size</a> | returns <a href="undocumented#ISize">ISize</a> (width, height) |
77| <a href="#SkIRect_sort">sort</a> | orders sides from smaller to larger |
78| <a href="#SkIRect_top">top</a> | returns smaller bounds in y, if sorted |
79| <a href="#SkIRect_width">width</a> | returns span in x |
80| <a href="#SkIRect_width64">width64</a> | returns span in y as int64_t |
81| <a href="#SkIRect_x">x</a> | returns bounds left |
82| <a href="#SkIRect_y">y</a> | returns bounds top |
83
84## <a name="Member"></a> Member
85
86| name | description |
87| --- | --- |
88| <a href="#SkIRect_fBottom">fBottom</a> | larger y-axis bounds |
89| <a href="#SkIRect_fLeft">fLeft</a> | smaller x-axis bounds |
90| <a href="#SkIRect_fRight">fRight</a> | larger x-axis bounds |
91| <a href="#SkIRect_fTop">fTop</a> | smaller y-axis bounds |
92
93<a name="SkIRect_fLeft"> <code><strong>int32_t  fLeft</strong></code> </a>
94
95May contain any value. The smaller of the horizontal values when sorted.
96When equal to or greater than <a href="#SkIRect_fRight">fRight</a>, <a href="#IRect">IRect</a> is empty.
97
98<a name="SkIRect_fTop"> <code><strong>int32_t  fTop</strong></code> </a>
99
100May contain any value. The smaller of the horizontal values when sorted.
101When equal to or greater than <a href="#SkIRect_fBottom">fBottom</a>, <a href="#IRect">IRect</a> is empty.
102
103<a name="SkIRect_fRight"> <code><strong>int32_t  fRight</strong></code> </a>
104
105May contain any value. The larger of the vertical values when sorted.
106When equal to or less than <a href="#SkIRect_fLeft">fLeft</a>, <a href="#IRect">IRect</a> is empty.
107
108<a name="SkIRect_fBottom"> <code><strong>int32_t  fBottom</strong></code> </a>
109
110May contain any value. The larger of the vertical values when sorted.
111When equal to or less than <a href="#SkIRect_fTop">fTop</a>, <a href="#IRect">IRect</a> is empty.
112
113## <a name="Constructor"></a> Constructor
114
115| name | description |
116| --- | --- |
117| <a href="#SkIRect_EmptyIRect">EmptyIRect</a> | returns immutable bounds of (0, 0, 0, 0) |
118| <a href="#SkIRect_MakeEmpty">MakeEmpty</a> | returns bounds of (0, 0, 0, 0) |
119| <a href="#SkIRect_MakeLTRB">MakeLTRB</a> | constructs from int left, top, right, bottom |
120| <a href="#SkIRect_MakeSize">MakeSize</a> | constructs from <a href="undocumented#ISize">ISize</a> returning (0, 0, width, height) |
121| <a href="#SkIRect_MakeWH">MakeWH</a> | constructs from int input returning (0, 0, width, height) |
122| <a href="#SkIRect_MakeXYWH">MakeXYWH</a> | constructs from int input returning (x, y, width, height) |
123| <a href="#SkIRect_makeInset">makeInset</a> | constructs from sides moved symmetrically about the center |
124| <a href="#SkIRect_makeOffset">makeOffset</a> | constructs from translated sides |
125| <a href="#SkIRect_makeOutset">makeOutset</a> | constructs from sides moved symmetrically about the center |
126| <a href="#SkIRect_makeSorted">makeSorted</a> | constructs, ordering sides from smaller to larger |
127
128<a name="SkIRect_MakeEmpty"></a>
129## MakeEmpty
130
131<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
132static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeEmpty()
133</pre>
134
135Returns constructed <a href="#IRect">IRect</a> set to (0, 0, 0, 0).
136Many other rectangles are empty; if left is equal to or greater than right,
137or if top is equal to or greater than bottom. Setting all members to zero
138is a convenience, but does not designate a special empty rectangle.
139
140### Return Value
141
142bounds (0, 0, 0, 0)
143
144### Example
145
146<div><fiddle-embed name="0ade3971c1d2616564992e286966ec8a">
147
148#### Example Output
149
150~~~~
151MakeEmpty isEmpty: true
152offset rect isEmpty: true
153inset rect isEmpty: true
154outset rect isEmpty: false
155~~~~
156
157</fiddle-embed></div>
158
159### See Also
160
161<a href="#SkIRect_EmptyIRect">EmptyIRect</a> <a href="#SkIRect_isEmpty">isEmpty</a> <a href="#SkIRect_setEmpty">setEmpty</a> <a href="SkRect_Reference#SkRect_MakeEmpty">SkRect::MakeEmpty</a>
162
163---
164
165<a name="SkIRect_MakeWH"></a>
166## MakeWH
167
168<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
169static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h)
170</pre>
171
172Returns constructed <a href="#IRect">IRect</a> set to (0, 0, <a href="#SkIRect_MakeWH_w">w</a>, <a href="#SkIRect_MakeWH_h">h</a>). Does not validate input; <a href="#SkIRect_MakeWH_w">w</a> or <a href="#SkIRect_MakeWH_h">h</a>
173may be negative.
174
175### Parameters
176
177<table>  <tr>    <td><a name="SkIRect_MakeWH_w"> <code><strong>w </strong></code> </a></td> <td>
178width of constructed <a href="#IRect">IRect</a></td>
179  </tr>  <tr>    <td><a name="SkIRect_MakeWH_h"> <code><strong>h </strong></code> </a></td> <td>
180height of constructed <a href="#IRect">IRect</a></td>
181  </tr>
182</table>
183
184### Return Value
185
186bounds (0, 0, <a href="#SkIRect_MakeWH_w">w</a>, <a href="#SkIRect_MakeWH_h">h</a>)
187
188### Example
189
190<div><fiddle-embed name="e36827a1a6ae2b1c26e7a8a08f325a07">
191
192#### Example Output
193
194~~~~
195all equal
196~~~~
197
198</fiddle-embed></div>
199
200### See Also
201
202<a href="#SkIRect_MakeSize">MakeSize</a> <a href="#SkIRect_MakeXYWH">MakeXYWH</a> <a href="SkRect_Reference#SkRect_MakeWH">SkRect::MakeWH</a> <a href="SkRect_Reference#SkRect_MakeIWH">SkRect::MakeIWH</a>
203
204---
205
206<a name="SkIRect_MakeSize"></a>
207## MakeSize
208
209<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
210static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size)
211</pre>
212
213Returns constructed <a href="#IRect">IRect</a> set to (0, 0, size.<a href="#SkIRect_width">width</a>, size.<a href="#SkIRect_height">height</a>).
214Does not validate input; size.<a href="#SkIRect_width">width</a> or size.<a href="#SkIRect_height">height</a> may be negative.
215
216### Parameters
217
218<table>  <tr>    <td><a name="SkIRect_MakeSize_size"> <code><strong>size </strong></code> </a></td> <td>
219values for <a href="#IRect">IRect</a> width and height</td>
220  </tr>
221</table>
222
223### Return Value
224
225bounds (0, 0, size.<a href="#SkIRect_width">width</a>, size.<a href="#SkIRect_height">height</a>)
226
227### Example
228
229<div><fiddle-embed name="c6586ff8d24869c780169b0d19c75df6">
230
231#### Example Output
232
233~~~~
234round width: 26  height: 36
235floor width: 25  height: 35
236~~~~
237
238</fiddle-embed></div>
239
240### See Also
241
242<a href="#SkIRect_MakeWH">MakeWH</a> <a href="#SkIRect_MakeXYWH">MakeXYWH</a> <a href="SkRect_Reference#SkRect_Make">SkRect::Make</a><sup><a href="SkRect_Reference#SkRect_Make_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_MakeIWH">SkRect::MakeIWH</a>
243
244---
245
246<a name="SkIRect_MakeLTRB"></a>
247## MakeLTRB
248
249<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
250static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t, int32_t r, int32_t b)
251</pre>
252
253Returns constructed <a href="#IRect">IRect</a> set to (<a href="#SkIRect_MakeLTRB_l">l</a>, <a href="#SkIRect_MakeLTRB_t">t</a>, <a href="#SkIRect_MakeLTRB_r">r</a>, <a href="#SkIRect_MakeLTRB_b">b</a>). Does not sort input; <a href="#IRect">IRect</a> may
254result in <a href="#SkIRect_fLeft">fLeft</a> greater than <a href="#SkIRect_fRight">fRight</a>, or <a href="#SkIRect_fTop">fTop</a> greater than <a href="#SkIRect_fBottom">fBottom</a>.
255
256### Parameters
257
258<table>  <tr>    <td><a name="SkIRect_MakeLTRB_l"> <code><strong>l </strong></code> </a></td> <td>
259integer stored in <a href="#SkIRect_fLeft">fLeft</a></td>
260  </tr>  <tr>    <td><a name="SkIRect_MakeLTRB_t"> <code><strong>t </strong></code> </a></td> <td>
261integer stored in <a href="#SkIRect_fTop">fTop</a></td>
262  </tr>  <tr>    <td><a name="SkIRect_MakeLTRB_r"> <code><strong>r </strong></code> </a></td> <td>
263integer stored in <a href="#SkIRect_fRight">fRight</a></td>
264  </tr>  <tr>    <td><a name="SkIRect_MakeLTRB_b"> <code><strong>b </strong></code> </a></td> <td>
265integer stored in <a href="#SkIRect_fBottom">fBottom</a></td>
266  </tr>
267</table>
268
269### Return Value
270
271bounds (<a href="#SkIRect_MakeLTRB_l">l</a>, <a href="#SkIRect_MakeLTRB_t">t</a>, <a href="#SkIRect_MakeLTRB_r">r</a>, <a href="#SkIRect_MakeLTRB_b">b</a>)
272
273### Example
274
275<div><fiddle-embed name="ec1473b700c594f2df9749a12a06b89b">
276
277#### Example Output
278
279~~~~
280rect: 5, 35, 15, 25  isEmpty: true
281rect: 5, 25, 15, 35  isEmpty: false
282~~~~
283
284</fiddle-embed></div>
285
286### See Also
287
288<a href="#SkIRect_MakeXYWH">MakeXYWH</a> <a href="SkRect_Reference#SkRect_MakeLTRB">SkRect::MakeLTRB</a>
289
290---
291
292<a name="SkIRect_MakeXYWH"></a>
293## MakeXYWH
294
295<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
296static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
297</pre>
298
299Returns constructed <a href="#IRect">IRect</a> set to:
300(x, y, x + <a href="#SkIRect_MakeXYWH_w">w</a>, y + <a href="#SkIRect_MakeXYWH_h">h</a>).
301Does not validate input;
302<a href="#SkIRect_MakeXYWH_w">w</a> or <a href="#SkIRect_MakeXYWH_h">h</a> may be negative.
303
304### Parameters
305
306<table>  <tr>    <td><a name="SkIRect_MakeXYWH_x"> <code><strong>x </strong></code> </a></td> <td>
307stored in <a href="#SkIRect_fLeft">fLeft</a></td>
308  </tr>  <tr>    <td><a name="SkIRect_MakeXYWH_y"> <code><strong>y </strong></code> </a></td> <td>
309stored in <a href="#SkIRect_fTop">fTop</a></td>
310  </tr>  <tr>    <td><a name="SkIRect_MakeXYWH_w"> <code><strong>w </strong></code> </a></td> <td>
311added to x and stored in <a href="#SkIRect_fRight">fRight</a></td>
312  </tr>  <tr>    <td><a name="SkIRect_MakeXYWH_h"> <code><strong>h </strong></code> </a></td> <td>
313added to y and stored in <a href="#SkIRect_fBottom">fBottom</a></td>
314  </tr>
315</table>
316
317### Return Value
318
319bounds at (x, y) with width <a href="#SkIRect_MakeXYWH_w">w</a> and height <a href="#SkIRect_MakeXYWH_h">h</a>
320
321### Example
322
323<div><fiddle-embed name="598ee14350bd1d961cae6b36fa3df17e">
324
325#### Example Output
326
327~~~~
328rect: 5, 35, -10, 60  isEmpty: true
329rect: -10, 35, 5, 60  isEmpty: false
330~~~~
331
332</fiddle-embed></div>
333
334### See Also
335
336<a href="#SkIRect_MakeLTRB">MakeLTRB</a> <a href="SkRect_Reference#SkRect_MakeXYWH">SkRect::MakeXYWH</a>
337
338---
339
340## <a name="Property"></a> Property
341
342| name | description |
343| --- | --- |
344| <a href="#SkIRect_bottom">bottom</a> | returns larger bounds in y, if sorted |
345| <a href="#SkIRect_centerX">centerX</a> | returns midpoint in x |
346| <a href="#SkIRect_centerY">centerY</a> | returns midpoint in y |
347| <a href="#SkIRect_height">height</a> | returns span in y |
348| <a href="#SkIRect_height64">height64</a> | returns span in y as int64_t |
349| <a href="#SkIRect_is16Bit">is16Bit</a> | returns true if members fit in 16-bit word |
350| <a href="#SkIRect_isEmpty">isEmpty</a> | returns true if width or height are zero or negative or they exceed int32_t |
351| <a href="#SkIRect_isEmpty64">isEmpty64</a> | returns true if width or height are zero or negative |
352| <a href="#SkIRect_left">left</a> | returns smaller bounds in x, if sorted |
353| <a href="#SkIRect_right">right</a> | returns larger bounds in x, if sorted |
354| <a href="#SkIRect_size">size</a> | returns <a href="undocumented#ISize">ISize</a> (width, height) |
355| <a href="#SkIRect_top">top</a> | returns smaller bounds in y, if sorted |
356| <a href="#SkIRect_width">width</a> | returns span in x |
357| <a href="#SkIRect_width64">width64</a> | returns span in y as int64_t |
358| <a href="#SkIRect_x">x</a> | returns bounds left |
359| <a href="#SkIRect_y">y</a> | returns bounds top |
360
361<a name="SkIRect_left"></a>
362## left
363
364<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
365int32_t left() const
366</pre>
367
368Returns left edge of <a href="#IRect">IRect</a>, if sorted.
369Call <a href="#SkIRect_sort">sort</a> to reverse <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a> if needed.
370
371### Return Value
372
373<a href="#SkIRect_fLeft">fLeft</a>
374
375### Example
376
377<div><fiddle-embed name="caf38ea4431bc246ba198f6a8c2b0f01">
378
379#### Example Output
380
381~~~~
382unsorted.fLeft: 15 unsorted.left(): 15
383sorted.fLeft: 10 sorted.left(): 10
384~~~~
385
386</fiddle-embed></div>
387
388### See Also
389
390<a href="#SkIRect_fLeft">fLeft</a> <a href="#SkIRect_x">x</a> <a href="SkRect_Reference#SkRect_left">SkRect::left()</a>
391
392---
393
394<a name="SkIRect_top"></a>
395## top
396
397<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
398int32_t top() const
399</pre>
400
401Returns top edge of <a href="#IRect">IRect</a>, if sorted. Call <a href="#SkIRect_isEmpty">isEmpty</a> to see if <a href="#IRect">IRect</a> may be invalid,
402and <a href="#SkIRect_sort">sort</a> to reverse <a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a> if needed.
403
404### Return Value
405
406<a href="#SkIRect_fTop">fTop</a>
407
408### Example
409
410<div><fiddle-embed name="cbec1ae6530e95943775450b1d11f19e">
411
412#### Example Output
413
414~~~~
415unsorted.fTop: 25 unsorted.top(): 25
416sorted.fTop: 5 sorted.top(): 5
417~~~~
418
419</fiddle-embed></div>
420
421### See Also
422
423<a href="#SkIRect_fTop">fTop</a> <a href="#SkIRect_y">y</a> <a href="SkRect_Reference#SkRect_top">SkRect::top()</a>
424
425---
426
427<a name="SkIRect_right"></a>
428## right
429
430<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
431int32_t right() const
432</pre>
433
434Returns right edge of <a href="#IRect">IRect</a>, if sorted.
435Call <a href="#SkIRect_sort">sort</a> to reverse <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a> if needed.
436
437### Return Value
438
439<a href="#SkIRect_fRight">fRight</a>
440
441### Example
442
443<div><fiddle-embed name="97e210976f1ee0387b30c70635cf114f">
444
445#### Example Output
446
447~~~~
448unsorted.fRight: 10 unsorted.right(): 10
449sorted.fRight: 15 sorted.right(): 15
450~~~~
451
452</fiddle-embed></div>
453
454### See Also
455
456<a href="#SkIRect_fRight">fRight</a> <a href="SkRect_Reference#SkRect_right">SkRect::right()</a>
457
458---
459
460<a name="SkIRect_bottom"></a>
461## bottom
462
463<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
464int32_t bottom() const
465</pre>
466
467Returns bottom edge of <a href="#IRect">IRect</a>, if sorted. Call <a href="#SkIRect_isEmpty">isEmpty</a> to see if <a href="#IRect">IRect</a> may be invalid,
468and <a href="#SkIRect_sort">sort</a> to reverse <a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a> if needed.
469
470### Return Value
471
472<a href="#SkIRect_fBottom">fBottom</a>
473
474### Example
475
476<div><fiddle-embed name="c32afebc296054a181621648a184b8e3">
477
478#### Example Output
479
480~~~~
481unsorted.fBottom: 5 unsorted.bottom(): 5
482sorted.fBottom: 25 sorted.bottom(): 25
483~~~~
484
485</fiddle-embed></div>
486
487### See Also
488
489<a href="#SkIRect_fBottom">fBottom</a> <a href="SkRect_Reference#SkRect_bottom">SkRect::bottom()</a>
490
491---
492
493<a name="SkIRect_x"></a>
494## x
495
496<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
497int32_t x() const
498</pre>
499
500Returns left edge of <a href="#IRect">IRect</a>, if sorted. Call <a href="#SkIRect_isEmpty">isEmpty</a> to see if <a href="#IRect">IRect</a> may be invalid,
501and <a href="#SkIRect_sort">sort</a> to reverse <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a> if needed.
502
503### Return Value
504
505<a href="#SkIRect_fLeft">fLeft</a>
506
507### Example
508
509<div><fiddle-embed name="2a59cbfd1330a0db520d6ebb2b7c68c7">
510
511#### Example Output
512
513~~~~
514unsorted.fLeft: 15 unsorted.x(): 15
515sorted.fLeft: 10 sorted.x(): 10
516~~~~
517
518</fiddle-embed></div>
519
520### See Also
521
522<a href="#SkIRect_fLeft">fLeft</a> <a href="#SkIRect_left">left</a> <a href="#SkIRect_y">y</a> <a href="SkRect_Reference#SkRect_x">SkRect::x()</a>
523
524---
525
526<a name="SkIRect_y"></a>
527## y
528
529<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
530int32_t y() const
531</pre>
532
533Returns top edge of <a href="#IRect">IRect</a>, if sorted. Call <a href="#SkIRect_isEmpty">isEmpty</a> to see if <a href="#IRect">IRect</a> may be invalid,
534and <a href="#SkIRect_sort">sort</a> to reverse <a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a> if needed.
535
536### Return Value
537
538<a href="#SkIRect_fTop">fTop</a>
539
540### Example
541
542<div><fiddle-embed name="6ea461e71f7fc80605818fbf493caa63">
543
544#### Example Output
545
546~~~~
547unsorted.fTop: 25 unsorted.y(): 25
548sorted.fTop: 5 sorted.y(): 5
549~~~~
550
551</fiddle-embed></div>
552
553### See Also
554
555<a href="#SkIRect_fTop">fTop</a> <a href="#SkIRect_top">top</a> <a href="#SkIRect_x">x</a> <a href="SkRect_Reference#SkRect_y">SkRect::y()</a>
556
557---
558
559<a name="SkIRect_width"></a>
560## width
561
562<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
563int32_t width() const
564</pre>
565
566Returns span on the x-axis. This does not check if <a href="#IRect">IRect</a> is sorted, or if
567result fits in 32-bit signed integer; result may be negative.
568
569### Return Value
570
571<a href="#SkIRect_fRight">fRight</a> minus <a href="#SkIRect_fLeft">fLeft</a>
572
573### Example
574
575<div><fiddle-embed name="4acfbe051805940210c8916a94794142">
576
577#### Example Output
578
579~~~~
580unsorted width: -5
581large width: -5
582~~~~
583
584</fiddle-embed></div>
585
586### See Also
587
588<a href="#SkIRect_height">height</a> <a href="#SkIRect_width64">width64</a> <a href="#SkIRect_height64">height64</a> <a href="SkRect_Reference#SkRect_width">SkRect::width()</a>
589
590---
591
592<a name="SkIRect_width64"></a>
593## width64
594
595<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
596int64_t width64() const
597</pre>
598
599Returns span on the x-axis. This does not check if <a href="#IRect">IRect</a> is sorted, so the
600result may be negative. This is safer than calling <a href="#SkIRect_width">width</a> since <a href="#SkIRect_width">width</a> might
601overflow in its calculation.
602
603### Return Value
604
605<a href="#SkIRect_fRight">fRight</a> minus <a href="#SkIRect_fLeft">fLeft</a> cast to int64_t
606
607<a href="#SkIRect">SkIRect</a> large = { -2147483647, 1, 2147483644, 2 };
608
609#### Example Output
610
611~~~~
612width: -5 width64: 4294967291
613~~~~
614
615### See Also
616
617<a href="#SkIRect_width">width</a> <a href="#SkIRect_height">height</a> <a href="#SkIRect_height64">height64</a> <a href="SkRect_Reference#SkRect_width">SkRect::width()</a>
618
619---
620
621<a name="SkIRect_height"></a>
622## height
623
624<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
625int32_t height() const
626</pre>
627
628Returns span on the y-axis. This does not check if <a href="#IRect">IRect</a> is sorted, or if
629result fits in 32-bit signed integer; result may be negative.
630
631### Return Value
632
633<a href="#SkIRect_fBottom">fBottom</a> minus <a href="#SkIRect_fTop">fTop</a>
634
635### Example
636
637<div><fiddle-embed name="0175bae87fafcd9433ae661574695586">
638
639#### Example Output
640
641~~~~
642unsorted height: -5
643large height: -5
644~~~~
645
646</fiddle-embed></div>
647
648### See Also
649
650<a href="#SkIRect_width">width</a> <a href="SkRect_Reference#SkRect_height">SkRect::height()</a>
651
652---
653
654<a name="SkIRect_height64"></a>
655## height64
656
657<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
658int64_t height64() const
659</pre>
660
661Returns span on the y-axis. This does not check if <a href="#IRect">IRect</a> is sorted, so the
662result may be negative. This is safer than calling <a href="#SkIRect_height">height</a> since <a href="#SkIRect_height">height</a> might
663overflow in its calculation.
664
665### Return Value
666
667<a href="#SkIRect_fBottom">fBottom</a> minus <a href="#SkIRect_fTop">fTop</a> cast to int64_t
668
669<a href="#SkIRect">SkIRect</a> large = { 1, -2147483647, 2, 2147483644 };
670
671#### Example Output
672
673~~~~
674height: -5 height64: 4294967291
675~~~~
676
677### See Also
678
679<a href="#SkIRect_width">width</a> <a href="#SkIRect_height">height</a> <a href="#SkIRect_width64">width64</a> <a href="SkRect_Reference#SkRect_height">SkRect::height()</a>
680
681---
682
683<a name="SkIRect_size"></a>
684## size
685
686<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
687SkISize size() const
688</pre>
689
690Returns spans on the x-axis and y-axis. This does not check if <a href="#IRect">IRect</a> is sorted,
691or if result fits in 32-bit signed integer; result may be negative.
692
693### Return Value
694
695<a href="undocumented#ISize">ISize</a> (width, height)
696
697### Example
698
699<div><fiddle-embed name="8b3224641cb3053a7b8a5798b6cd1cf6">
700
701#### Example Output
702
703~~~~
704original rect: 20, 30, 40, 50  size: 20, 20
705offset rect: 40, 50, 60, 70  size: 20, 20
706outset rect: 20, 30, 80, 90  size: 60, 60
707~~~~
708
709</fiddle-embed></div>
710
711### See Also
712
713<a href="#SkIRect_height">height</a> <a href="#SkIRect_width">width</a> <a href="#SkIRect_MakeSize">MakeSize</a>
714
715---
716
717<a name="SkIRect_centerX"></a>
718## centerX
719
720<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
721int32_t centerX() const
722</pre>
723
724Returns average of left edge and right edge. Result does not change if <a href="#IRect">IRect</a>
725is sorted. Result may be incorrect if <a href="#IRect">IRect</a> is far from the origin.
726
727Result is rounded down.
728
729### Return Value
730
731midpoint in x
732
733### Example
734
735<div><fiddle-embed name="549b840a9ceaaf7cb4e604f9f3d7108d"><div>Dividing by two rounds towards zero. <a href="#SkIRect_centerX">centerX</a> uses a bit shift and rounds down.</div>
736
737#### Example Output
738
739~~~~
740left:  20 right:  41 centerX:  30 div2:  30
741left: -20 right: -41 centerX: -31 div2: -30
742left: -10 right:  11 centerX:   0 div2:   0
743~~~~
744
745</fiddle-embed></div>
746
747### See Also
748
749<a href="#SkIRect_centerY">centerY</a> <a href="SkRect_Reference#SkRect_centerX">SkRect::centerX</a>
750
751---
752
753<a name="SkIRect_centerY"></a>
754## centerY
755
756<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
757int32_t centerY() const
758</pre>
759
760Returns average of top edge and bottom edge. Result does not change if <a href="#IRect">IRect</a>
761is sorted. Result may be incorrect if <a href="#IRect">IRect</a> is far from the origin.
762
763Result is rounded down.
764
765### Return Value
766
767midpoint in y
768
769### Example
770
771<div><fiddle-embed name="687d833b042fb018f8948764e73a37b1">
772
773#### Example Output
774
775~~~~
776left: 1073741824 right: 1073741826 centerX: -1073741823 safe mid x: 1073741825
777~~~~
778
779</fiddle-embed></div>
780
781### See Also
782
783<a href="#SkIRect_centerX">centerX</a> <a href="SkRect_Reference#SkRect_centerY">SkRect::centerY</a>
784
785---
786
787<a name="SkIRect_isEmpty"></a>
788## isEmpty
789
790<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
791bool isEmpty() const
792</pre>
793
794Returns true if <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> .
795
796### Return Value
797
798true if <a href="#SkIRect_width">width</a> or <a href="#SkIRect_height">height</a> are zero or negative
799
800### Example
801
802<div><fiddle-embed name="edaad064b6de249b7a7c768dfa000adc">
803
804#### Example Output
805
806~~~~
807rect: {20, 40, 10, 50} is empty
808sorted: {10, 40, 20, 50} is not empty
809rect: {20, 40, 20, 50} is empty
810sorted: {20, 40, 20, 50} is empty
811~~~~
812
813</fiddle-embed></div>
814
815### See Also
816
817<a href="#SkIRect_EmptyIRect">EmptyIRect</a> <a href="#SkIRect_MakeEmpty">MakeEmpty</a> <a href="#SkIRect_sort">sort</a> <a href="SkRect_Reference#SkRect_isEmpty">SkRect::isEmpty</a>
818
819---
820
821<a name="SkIRect_isEmpty64"></a>
822## isEmpty64
823
824<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
825bool isEmpty64() const
826</pre>
827
828Returns true if <a href="#SkIRect_fLeft">fLeft</a> is equal to or greater than <a href="#SkIRect_fRight">fRight</a>, or if <a href="#SkIRect_fTop">fTop</a> is equal
829to or greater than <a href="#SkIRect_fBottom">fBottom</a>. Call <a href="#SkIRect_sort">sort</a> to reverse rectangles with negative
830<a href="#SkIRect_width64">width64</a> or <a href="#SkIRect_height64">height64</a>.
831
832### Return Value
833
834true if <a href="#SkIRect_width64">width64</a> or <a href="#SkIRect_height64">height64</a> are zero or negative
835
836<a href="#SkIRect">SkIRect</a> tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
837for (auto rect : tests) {
838
839#### Example Output
840
841~~~~
842rect: {20, 40, 10, 50} is empty
843sorted: {10, 40, 20, 50} is not empty
844rect: {20, 40, 20, 50} is empty
845sorted: {20, 40, 20, 50} is empty
846~~~~
847
848### See Also
849
850<a href="#SkIRect_EmptyIRect">EmptyIRect</a> <a href="#SkIRect_MakeEmpty">MakeEmpty</a> <a href="#SkIRect_sort">sort</a> <a href="SkRect_Reference#SkRect_isEmpty">SkRect::isEmpty</a>
851
852---
853
854## <a name="Operator"></a> Operator
855
856| name | description |
857| --- | --- |
858| <a href="#SkIRect_notequal_operator">operator!=(const SkIRect& a, const SkIRect& b)</a> | returns true if members are unequal |
859| <a href="#SkIRect_equal_operator">operator==(const SkIRect& a, const SkIRect& b)</a> | returns true if members are equal |
860
861<a name="SkIRect_equal_operator"></a>
862## operator==
863
864<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
865bool operator==(const SkIRect& a, const SkIRect& b)
866</pre>
867
868Returns true if all members in <a href="#SkIRect_equal_operator_a">a</a>: <a href="#SkIRect_fLeft">fLeft</a>, <a href="#SkIRect_fTop">fTop</a>, <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fBottom">fBottom</a>; are
869identical to corresponding members in <a href="#SkIRect_equal_operator_b">b</a>.
870
871### Parameters
872
873<table>  <tr>    <td><a name="SkIRect_equal_operator_a"> <code><strong>a </strong></code> </a></td> <td>
874<a href="#IRect">IRect</a> to compare</td>
875  </tr>  <tr>    <td><a name="SkIRect_equal_operator_b"> <code><strong>b </strong></code> </a></td> <td>
876<a href="#IRect">IRect</a> to compare</td>
877  </tr>
878</table>
879
880### Return Value
881
882true if members are equal
883
884### Example
885
886<div><fiddle-embed name="bd8f028d9051062816c9116fea4237b2">
887
888#### Example Output
889
890~~~~
891test == sorted
892~~~~
893
894</fiddle-embed></div>
895
896### See Also
897
898<a href="#SkIRect_notequal_operator">operator!=(const SkIRect& a, const SkIRect& b)</a>
899
900---
901
902<a name="SkIRect_notequal_operator"></a>
903## operator!=
904
905<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
906bool operator!=(const SkIRect& a, const SkIRect& b)
907</pre>
908
909Returns true if any member in <a href="#SkIRect_notequal_operator_a">a</a>: <a href="#SkIRect_fLeft">fLeft</a>, <a href="#SkIRect_fTop">fTop</a>, <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fBottom">fBottom</a>; is not
910identical to the corresponding member in <a href="#SkIRect_notequal_operator_b">b</a>.
911
912### Parameters
913
914<table>  <tr>    <td><a name="SkIRect_notequal_operator_a"> <code><strong>a </strong></code> </a></td> <td>
915<a href="#IRect">IRect</a> to compare</td>
916  </tr>  <tr>    <td><a name="SkIRect_notequal_operator_b"> <code><strong>b </strong></code> </a></td> <td>
917<a href="#IRect">IRect</a> to compare</td>
918  </tr>
919</table>
920
921### Return Value
922
923true if members are not equal
924
925### Example
926
927<div><fiddle-embed name="6c4acd8aa203f632b7d85cae672abf4d">
928
929#### Example Output
930
931~~~~
932test != sorted
933~~~~
934
935</fiddle-embed></div>
936
937### See Also
938
939<a href="#SkIRect_equal_operator">operator==(const SkIRect& a, const SkIRect& b)</a>
940
941---
942
943<a name="SkIRect_is16Bit"></a>
944## is16Bit
945
946<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
947bool is16Bit() const
948</pre>
949
950Returns true if all members: <a href="#SkIRect_fLeft">fLeft</a>, <a href="#SkIRect_fTop">fTop</a>, <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fBottom">fBottom</a>; values are
951equal to or larger than -32768 and equal to or smaller than 32767.
952
953### Return Value
954
955true if members fit in 16-bit word
956
957### Example
958
959<div><fiddle-embed name="103e8d463e68e87e0f8f9454a7d3441c">
960
961#### Example Output
962
963~~~~
964{-32768, -32768, 32767, 32767} fits in 16 bits
965{-32768, -32768, 32768, 32768} does not fit in 16 bits
966~~~~
967
968</fiddle-embed></div>
969
970### See Also
971
972<a href="undocumented#SkTFitsIn">SkTFitsIn</a>
973
974---
975
976## <a name="Set"></a> Set
977
978| name | description |
979| --- | --- |
980| <a href="#SkIRect_set">set</a> | sets to (left, top, right, bottom) |
981| <a href="#SkIRect_setEmpty">setEmpty</a> | sets to (0, 0, 0, 0) |
982| <a href="#SkIRect_setLTRB">setLTRB</a> | sets to <a href="undocumented#SkScalar">SkScalar</a> input (left, top, right, bottom) |
983| <a href="#SkIRect_setXYWH">setXYWH</a> | sets to (x, y, width, height) |
984
985<a name="SkIRect_setEmpty"></a>
986## setEmpty
987
988<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
989void setEmpty()
990</pre>
991
992Sets <a href="#IRect">IRect</a> to (0, 0, 0, 0).
993
994Many other rectangles are empty; if left is equal to or greater than right,
995or if top is equal to or greater than bottom. Setting all members to zero
996is a convenience, but does not designate a special empty rectangle.
997
998### Example
999
1000<div><fiddle-embed name="94039c3cc9e911c8ab2993d56fd06210">
1001
1002#### Example Output
1003
1004~~~~
1005rect: {3, 4, 1, 2} is empty
1006rect: {0, 0, 0, 0} is empty
1007~~~~
1008
1009</fiddle-embed></div>
1010
1011### See Also
1012
1013<a href="#SkIRect_MakeEmpty">MakeEmpty</a> <a href="SkRect_Reference#SkRect_setEmpty">SkRect::setEmpty</a>
1014
1015---
1016
1017<a name="SkIRect_set"></a>
1018## set
1019
1020<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1021void set(int32_t left, int32_t top, int32_t right, int32_t bottom)
1022</pre>
1023
1024Sets <a href="#IRect">IRect</a> to (left, top, right, bottom).
1025left and right are not sorted; left is not necessarily less than right.
1026top and bottom are not sorted; top is not necessarily less than bottom.
1027
1028### Parameters
1029
1030<table>  <tr>    <td><a name="SkIRect_set_left"> <code><strong>left </strong></code> </a></td> <td>
1031assigned to <a href="#SkIRect_fLeft">fLeft</a></td>
1032  </tr>  <tr>    <td><a name="SkIRect_set_top"> <code><strong>top </strong></code> </a></td> <td>
1033assigned to <a href="#SkIRect_fTop">fTop</a></td>
1034  </tr>  <tr>    <td><a name="SkIRect_set_right"> <code><strong>right </strong></code> </a></td> <td>
1035assigned to <a href="#SkIRect_fRight">fRight</a></td>
1036  </tr>  <tr>    <td><a name="SkIRect_set_bottom"> <code><strong>bottom </strong></code> </a></td> <td>
1037assigned to <a href="#SkIRect_fBottom">fBottom</a></td>
1038  </tr>
1039</table>
1040
1041### Example
1042
1043<div><fiddle-embed name="1912c37076b7f3bf6aebfa167e971bec">
1044
1045#### Example Output
1046
1047~~~~
1048rect1: {3, 4, 1, 2}
1049rect2: {3, 4, 1, 2}
1050~~~~
1051
1052</fiddle-embed></div>
1053
1054### See Also
1055
1056<a href="#SkIRect_setLTRB">setLTRB</a> <a href="#SkIRect_setXYWH">setXYWH</a> <a href="SkRect_Reference#SkRect_set">SkRect::set</a><sup><a href="SkRect_Reference#SkRect_set_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_set_3">[3]</a></sup><sup><a href="SkRect_Reference#SkRect_set_4">[4]</a></sup>
1057
1058---
1059
1060<a name="SkIRect_setLTRB"></a>
1061## setLTRB
1062
1063<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1064void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
1065</pre>
1066
1067Sets <a href="#IRect">IRect</a> to (left, top, right, bottom).
1068left and right are not sorted; left is not necessarily less than right.
1069top and bottom are not sorted; top is not necessarily less than bottom.
1070
1071### Parameters
1072
1073<table>  <tr>    <td><a name="SkIRect_setLTRB_left"> <code><strong>left </strong></code> </a></td> <td>
1074stored in <a href="#SkIRect_fLeft">fLeft</a></td>
1075  </tr>  <tr>    <td><a name="SkIRect_setLTRB_top"> <code><strong>top </strong></code> </a></td> <td>
1076stored in <a href="#SkIRect_fTop">fTop</a></td>
1077  </tr>  <tr>    <td><a name="SkIRect_setLTRB_right"> <code><strong>right </strong></code> </a></td> <td>
1078stored in <a href="#SkIRect_fRight">fRight</a></td>
1079  </tr>  <tr>    <td><a name="SkIRect_setLTRB_bottom"> <code><strong>bottom </strong></code> </a></td> <td>
1080stored in <a href="#SkIRect_fBottom">fBottom</a></td>
1081  </tr>
1082</table>
1083
1084### Example
1085
1086<div><fiddle-embed name="ead6bdcf2ae77ec19a1c5a96f5b31af8">
1087
1088#### Example Output
1089
1090~~~~
1091rect1: {3, 4, 1, 2}
1092rect2: {3, 4, 1, 2}
1093~~~~
1094
1095</fiddle-embed></div>
1096
1097### See Also
1098
1099<a href="#SkIRect_set">set</a> <a href="#SkIRect_setXYWH">setXYWH</a> <a href="SkRect_Reference#SkRect_setLTRB">SkRect::setLTRB</a>
1100
1101---
1102
1103<a name="SkIRect_setXYWH"></a>
1104## setXYWH
1105
1106<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1107void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height)
1108</pre>
1109
1110Sets <a href="#IRect">IRect</a> to:
1111(x, y, x + width, y + height).
1112Does not validate input;
1113width or height may be negative.
1114
1115### Parameters
1116
1117<table>  <tr>    <td><a name="SkIRect_setXYWH_x"> <code><strong>x </strong></code> </a></td> <td>
1118stored in <a href="#SkIRect_fLeft">fLeft</a></td>
1119  </tr>  <tr>    <td><a name="SkIRect_setXYWH_y"> <code><strong>y </strong></code> </a></td> <td>
1120stored in <a href="#SkIRect_fTop">fTop</a></td>
1121  </tr>  <tr>    <td><a name="SkIRect_setXYWH_width"> <code><strong>width </strong></code> </a></td> <td>
1122added to x and stored in <a href="#SkIRect_fRight">fRight</a></td>
1123  </tr>  <tr>    <td><a name="SkIRect_setXYWH_height"> <code><strong>height </strong></code> </a></td> <td>
1124added to y and stored in <a href="#SkIRect_fBottom">fBottom</a></td>
1125  </tr>
1126</table>
1127
1128### Example
1129
1130<div><fiddle-embed name="0e1db8c86678c004e504f47641b44b17">
1131
1132#### Example Output
1133
1134~~~~
1135rect: 5, 35, -10, 60  isEmpty: true
1136rect: -10, 35, 5, 60  isEmpty: false
1137~~~~
1138
1139</fiddle-embed></div>
1140
1141### See Also
1142
1143<a href="#SkIRect_MakeXYWH">MakeXYWH</a> <a href="#SkIRect_setLTRB">setLTRB</a> <a href="#SkIRect_set">set</a> <a href="SkRect_Reference#SkRect_setXYWH">SkRect::setXYWH</a>
1144
1145---
1146
1147## <a name="Inset_Outset_Offset"></a> Inset Outset Offset
1148
1149| name | description |
1150| --- | --- |
1151| <a href="#SkIRect_inset">inset</a> | moves the sides symmetrically about the center |
1152| <a href="#SkIRect_offset">offset</a> | translates sides without changing width and height |
1153|  | <a href="#SkIRect_offset">offset(int32 t dx, int32 t dy)</a> |
1154| <a href="#SkIRect_offsetTo">offsetTo</a> | translates to (x, y) without changing width and height |
1155| <a href="#SkIRect_outset">outset</a> | moves the sides symmetrically about the center |
1156
1157<a name="SkIRect_makeOffset"></a>
1158## makeOffset
1159
1160<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1161SkIRect makeOffset(int32_t dx, int32_t dy) const
1162</pre>
1163
1164Returns <a href="#IRect">IRect</a> offset by (<a href="#SkIRect_makeOffset_dx">dx</a>, <a href="#SkIRect_makeOffset_dy">dy</a>).
1165
1166If <a href="#SkIRect_makeOffset_dx">dx</a> is negative, <a href="#IRect">IRect</a> returned is moved to the left.
1167If <a href="#SkIRect_makeOffset_dx">dx</a> is positive, <a href="#IRect">IRect</a> returned is moved to the right.
1168If <a href="#SkIRect_makeOffset_dy">dy</a> is negative, <a href="#IRect">IRect</a> returned is moved upward.
1169If <a href="#SkIRect_makeOffset_dy">dy</a> is positive, <a href="#IRect">IRect</a> returned is moved downward.
1170
1171### Parameters
1172
1173<table>  <tr>    <td><a name="SkIRect_makeOffset_dx"> <code><strong>dx </strong></code> </a></td> <td>
1174offset added to <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a></td>
1175  </tr>  <tr>    <td><a name="SkIRect_makeOffset_dy"> <code><strong>dy </strong></code> </a></td> <td>
1176offset added to <a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a></td>
1177  </tr>
1178</table>
1179
1180### Return Value
1181
1182<a href="#IRect">IRect</a> offset in x or y, with original width and height
1183
1184### Example
1185
1186<div><fiddle-embed name="737c747df07ddf392c05970440de0927">
1187
1188#### Example Output
1189
1190~~~~
1191rect: 10, 50, 20, 60  isEmpty: false
1192rect: 25, 82, 35, 92  isEmpty: false
1193~~~~
1194
1195</fiddle-embed></div>
1196
1197### See Also
1198
1199<a href="#SkIRect_offset">offset</a><sup><a href="#SkIRect_offset_2">[2]</a></sup> <a href="#SkIRect_makeInset">makeInset</a> <a href="#SkIRect_makeOutset">makeOutset</a> <a href="SkRect_Reference#SkRect_makeOffset">SkRect::makeOffset</a>
1200
1201---
1202
1203<a name="SkIRect_makeInset"></a>
1204## makeInset
1205
1206<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1207SkIRect makeInset(int32_t dx, int32_t dy) const
1208</pre>
1209
1210Returns <a href="#IRect">IRect</a>, inset by (<a href="#SkIRect_makeInset_dx">dx</a>, <a href="#SkIRect_makeInset_dy">dy</a>).
1211
1212If <a href="#SkIRect_makeInset_dx">dx</a> is negative, <a href="#IRect">IRect</a> returned is wider.
1213If <a href="#SkIRect_makeInset_dx">dx</a> is positive, <a href="#IRect">IRect</a> returned is narrower.
1214If <a href="#SkIRect_makeInset_dy">dy</a> is negative, <a href="#IRect">IRect</a> returned is taller.
1215If <a href="#SkIRect_makeInset_dy">dy</a> is positive, <a href="#IRect">IRect</a> returned is shorter.
1216
1217### Parameters
1218
1219<table>  <tr>    <td><a name="SkIRect_makeInset_dx"> <code><strong>dx </strong></code> </a></td> <td>
1220offset added to <a href="#SkIRect_fLeft">fLeft</a> and subtracted from <a href="#SkIRect_fRight">fRight</a></td>
1221  </tr>  <tr>    <td><a name="SkIRect_makeInset_dy"> <code><strong>dy </strong></code> </a></td> <td>
1222offset added to <a href="#SkIRect_fTop">fTop</a> and subtracted from <a href="#SkIRect_fBottom">fBottom</a></td>
1223  </tr>
1224</table>
1225
1226### Return Value
1227
1228<a href="#IRect">IRect</a> inset symmetrically left and right, top and bottom
1229
1230### Example
1231
1232<div><fiddle-embed name="1db94b2c76e0a7a71856532335fa56b6">
1233
1234#### Example Output
1235
1236~~~~
1237rect: 10, 50, 20, 60  isEmpty: false
1238rect: 25, 82, 5, 28  isEmpty: true
1239~~~~
1240
1241</fiddle-embed></div>
1242
1243### See Also
1244
1245<a href="#SkIRect_inset">inset</a> <a href="#SkIRect_makeOffset">makeOffset</a> <a href="#SkIRect_makeOutset">makeOutset</a> <a href="SkRect_Reference#SkRect_makeInset">SkRect::makeInset</a>
1246
1247---
1248
1249<a name="SkIRect_makeOutset"></a>
1250## makeOutset
1251
1252<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1253SkIRect makeOutset(int32_t dx, int32_t dy) const
1254</pre>
1255
1256Returns <a href="#IRect">IRect</a>, outset by (<a href="#SkIRect_makeOutset_dx">dx</a>, <a href="#SkIRect_makeOutset_dy">dy</a>).
1257
1258If <a href="#SkIRect_makeOutset_dx">dx</a> is negative, <a href="#IRect">IRect</a> returned is narrower.
1259If <a href="#SkIRect_makeOutset_dx">dx</a> is positive, <a href="#IRect">IRect</a> returned is wider.
1260If <a href="#SkIRect_makeOutset_dy">dy</a> is negative, <a href="#IRect">IRect</a> returned is shorter.
1261If <a href="#SkIRect_makeOutset_dy">dy</a> is positive, <a href="#IRect">IRect</a> returned is taller.
1262
1263### Parameters
1264
1265<table>  <tr>    <td><a name="SkIRect_makeOutset_dx"> <code><strong>dx </strong></code> </a></td> <td>
1266offset subtracted to <a href="#SkIRect_fLeft">fLeft</a> and added from <a href="#SkIRect_fRight">fRight</a></td>
1267  </tr>  <tr>    <td><a name="SkIRect_makeOutset_dy"> <code><strong>dy </strong></code> </a></td> <td>
1268offset subtracted to <a href="#SkIRect_fTop">fTop</a> and added from <a href="#SkIRect_fBottom">fBottom</a></td>
1269  </tr>
1270</table>
1271
1272### Return Value
1273
1274<a href="#IRect">IRect</a> outset symmetrically left and right, top and bottom
1275
1276### Example
1277
1278<div><fiddle-embed name="240e2953e3455c08f6d89255feff8416">
1279
1280#### Example Output
1281
1282~~~~
1283rect: 10, 50, 20, 60  isEmpty: false
1284rect: -5, 18, 35, 92  isEmpty: false
1285~~~~
1286
1287</fiddle-embed></div>
1288
1289### See Also
1290
1291<a href="#SkIRect_outset">outset</a> <a href="#SkIRect_makeOffset">makeOffset</a> <a href="#SkIRect_makeInset">makeInset</a> <a href="SkRect_Reference#SkRect_makeOutset">SkRect::makeOutset</a>
1292
1293---
1294
1295<a name="SkIRect_offset"></a>
1296## offset
1297
1298<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1299void offset(int32_t dx, int32_t dy)
1300</pre>
1301
1302Offsets <a href="#IRect">IRect</a> by adding <a href="#SkIRect_offset_dx">dx</a> to <a href="#SkIRect_fLeft">fLeft</a>, <a href="#SkIRect_fRight">fRight</a>; and by adding <a href="#SkIRect_offset_dy">dy</a> to <a href="#SkIRect_fTop">fTop</a>, <a href="#SkIRect_fBottom">fBottom</a>.
1303
1304If <a href="#SkIRect_offset_dx">dx</a> is negative, moves <a href="#IRect">IRect</a> returned to the left.
1305If <a href="#SkIRect_offset_dx">dx</a> is positive, moves <a href="#IRect">IRect</a> returned to the right.
1306If <a href="#SkIRect_offset_dy">dy</a> is negative, moves <a href="#IRect">IRect</a> returned upward.
1307If <a href="#SkIRect_offset_dy">dy</a> is positive, moves <a href="#IRect">IRect</a> returned downward.
1308
1309### Parameters
1310
1311<table>  <tr>    <td><a name="SkIRect_offset_dx"> <code><strong>dx </strong></code> </a></td> <td>
1312offset added to <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a></td>
1313  </tr>  <tr>    <td><a name="SkIRect_offset_dy"> <code><strong>dy </strong></code> </a></td> <td>
1314offset added to <a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a></td>
1315  </tr>
1316</table>
1317
1318### Example
1319
1320<div><fiddle-embed name="77e633b2174ffae923c038b303418b50">
1321
1322#### Example Output
1323
1324~~~~
1325rect: 15, 27, 55, 86
1326~~~~
1327
1328</fiddle-embed></div>
1329
1330### See Also
1331
1332<a href="#SkIRect_offsetTo">offsetTo</a> <a href="#SkIRect_makeOffset">makeOffset</a> <a href="SkRect_Reference#SkRect_offset">SkRect::offset</a><sup><a href="SkRect_Reference#SkRect_offset_2">[2]</a></sup>
1333
1334---
1335
1336<a name="SkIRect_offset_2"></a>
1337
1338<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1339void offset(const SkIPoint& delta)
1340</pre>
1341
1342Offsets <a href="#IRect">IRect</a> by adding <a href="#SkIRect_offset_2_delta">delta</a>.fX to <a href="#SkIRect_fLeft">fLeft</a>, <a href="#SkIRect_fRight">fRight</a>; and by adding <a href="#SkIRect_offset_2_delta">delta</a>.fY to
1343<a href="#SkIRect_fTop">fTop</a>, <a href="#SkIRect_fBottom">fBottom</a>.
1344
1345If <a href="#SkIRect_offset_2_delta">delta</a>.fX is negative, moves <a href="#IRect">IRect</a> returned to the left.
1346If <a href="#SkIRect_offset_2_delta">delta</a>.fX is positive, moves <a href="#IRect">IRect</a> returned to the right.
1347If <a href="#SkIRect_offset_2_delta">delta</a>.fY is negative, moves <a href="#IRect">IRect</a> returned upward.
1348If <a href="#SkIRect_offset_2_delta">delta</a>.fY is positive, moves <a href="#IRect">IRect</a> returned downward.
1349
1350### Parameters
1351
1352<table>  <tr>    <td><a name="SkIRect_offset_2_delta"> <code><strong>delta </strong></code> </a></td> <td>
1353offset added to <a href="#IRect">IRect</a></td>
1354  </tr>
1355</table>
1356
1357### Example
1358
1359<div><fiddle-embed name="31a4c575499e76def651eb65994876f0">
1360
1361#### Example Output
1362
1363~~~~
1364rect: 15, 27, 55, 86
1365~~~~
1366
1367</fiddle-embed></div>
1368
1369### See Also
1370
1371<a href="#SkIRect_offsetTo">offsetTo</a> <a href="#SkIRect_makeOffset">makeOffset</a> <a href="SkRect_Reference#SkRect_offset">SkRect::offset</a><sup><a href="SkRect_Reference#SkRect_offset_2">[2]</a></sup>
1372
1373---
1374
1375<a name="SkIRect_offsetTo"></a>
1376## offsetTo
1377
1378<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1379void offsetTo(int32_t newX, int32_t newY)
1380</pre>
1381
1382Offsets <a href="#IRect">IRect</a> so that <a href="#SkIRect_fLeft">fLeft</a> equals <a href="#SkIRect_offsetTo_newX">newX</a>, and <a href="#SkIRect_fTop">fTop</a> equals <a href="#SkIRect_offsetTo_newY">newY</a>. width and height
1383are unchanged.
1384
1385### Parameters
1386
1387<table>  <tr>    <td><a name="SkIRect_offsetTo_newX"> <code><strong>newX </strong></code> </a></td> <td>
1388stored in <a href="#SkIRect_fLeft">fLeft</a>, preserving <a href="#SkIRect_width">width</a></td>
1389  </tr>  <tr>    <td><a name="SkIRect_offsetTo_newY"> <code><strong>newY </strong></code> </a></td> <td>
1390stored in <a href="#SkIRect_fTop">fTop</a>, preserving <a href="#SkIRect_height">height</a></td>
1391  </tr>
1392</table>
1393
1394### Example
1395
1396<div><fiddle-embed name="a2734ff23b35653956a3002e5c29ff91">
1397
1398#### Example Output
1399
1400~~~~
1401rect: 15, 27, 55, 86
1402~~~~
1403
1404</fiddle-embed></div>
1405
1406### See Also
1407
1408<a href="#SkIRect_offset">offset</a><sup><a href="#SkIRect_offset_2">[2]</a></sup> <a href="#SkIRect_makeOffset">makeOffset</a> <a href="#SkIRect_setXYWH">setXYWH</a> <a href="SkRect_Reference#SkRect_offsetTo">SkRect::offsetTo</a>
1409
1410---
1411
1412<a name="SkIRect_inset"></a>
1413## inset
1414
1415<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1416void inset(int32_t dx, int32_t dy)
1417</pre>
1418
1419Insets <a href="#IRect">IRect</a> by (<a href="#SkIRect_inset_dx">dx</a>,<a href="#SkIRect_inset_dy">dy</a>).
1420
1421If <a href="#SkIRect_inset_dx">dx</a> is positive, makes <a href="#IRect">IRect</a> narrower.
1422If <a href="#SkIRect_inset_dx">dx</a> is negative, makes <a href="#IRect">IRect</a> wider.
1423If <a href="#SkIRect_inset_dy">dy</a> is positive, makes <a href="#IRect">IRect</a> shorter.
1424If <a href="#SkIRect_inset_dy">dy</a> is negative, makes <a href="#IRect">IRect</a> taller.
1425
1426### Parameters
1427
1428<table>  <tr>    <td><a name="SkIRect_inset_dx"> <code><strong>dx </strong></code> </a></td> <td>
1429offset added to <a href="#SkIRect_fLeft">fLeft</a> and subtracted from <a href="#SkIRect_fRight">fRight</a></td>
1430  </tr>  <tr>    <td><a name="SkIRect_inset_dy"> <code><strong>dy </strong></code> </a></td> <td>
1431offset added to <a href="#SkIRect_fTop">fTop</a> and subtracted from <a href="#SkIRect_fBottom">fBottom</a></td>
1432  </tr>
1433</table>
1434
1435### Example
1436
1437<div><fiddle-embed name="9debaded1aa8bdf5077a4de0b3015b8f">
1438
1439#### Example Output
1440
1441~~~~
1442rect: 15, 27, 45, 60
1443~~~~
1444
1445</fiddle-embed></div>
1446
1447### See Also
1448
1449<a href="#SkIRect_outset">outset</a> <a href="#SkIRect_makeInset">makeInset</a> <a href="SkRect_Reference#SkRect_inset">SkRect::inset</a>
1450
1451---
1452
1453<a name="SkIRect_outset"></a>
1454## outset
1455
1456<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1457void outset(int32_t dx, int32_t dy)
1458</pre>
1459
1460Outsets <a href="#IRect">IRect</a> by (<a href="#SkIRect_outset_dx">dx</a>, <a href="#SkIRect_outset_dy">dy</a>).
1461
1462If <a href="#SkIRect_outset_dx">dx</a> is positive, makes <a href="#IRect">IRect</a> wider.
1463If <a href="#SkIRect_outset_dx">dx</a> is negative, makes <a href="#IRect">IRect</a> narrower.
1464If <a href="#SkIRect_outset_dy">dy</a> is positive, makes <a href="#IRect">IRect</a> taller.
1465If <a href="#SkIRect_outset_dy">dy</a> is negative, makes <a href="#IRect">IRect</a> shorter.
1466
1467### Parameters
1468
1469<table>  <tr>    <td><a name="SkIRect_outset_dx"> <code><strong>dx </strong></code> </a></td> <td>
1470subtracted to <a href="#SkIRect_fLeft">fLeft</a> and added from <a href="#SkIRect_fRight">fRight</a></td>
1471  </tr>  <tr>    <td><a name="SkIRect_outset_dy"> <code><strong>dy </strong></code> </a></td> <td>
1472subtracted to <a href="#SkIRect_fTop">fTop</a> and added from <a href="#SkIRect_fBottom">fBottom</a></td>
1473  </tr>
1474</table>
1475
1476### Example
1477
1478<div><fiddle-embed name="3fc62ca29428195f33a3a02b3eb74e4f">
1479
1480#### Example Output
1481
1482~~~~
1483rect: 5, 1, 55, 86
1484~~~~
1485
1486</fiddle-embed></div>
1487
1488### See Also
1489
1490<a href="#SkIRect_inset">inset</a> <a href="#SkIRect_makeOutset">makeOutset</a> <a href="SkRect_Reference#SkRect_outset">SkRect::outset</a>
1491
1492---
1493
1494## <a name="Intersection"></a> Intersection
1495
1496<a href="#IRect">IRects</a> intersect when they enclose a common area. To intersect, each of the pair
1497must describe area; <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>;
1498empty() returns false. The intersection of <a href="#IRect">IRect</a> pair can be described by:
1499
1500(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
1501min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)).
1502
1503The intersection is only meaningful if the resulting <a href="#IRect">IRect</a> is not empty and
1504describes an area: <a href="#SkIRect_fLeft">fLeft</a> is less than <a href="#SkIRect_fRight">fRight</a>, and <a href="#SkIRect_fTop">fTop</a> is less than <a href="#SkIRect_fBottom">fBottom</a>.
1505
1506| name | description |
1507| --- | --- |
1508| <a href="#SkIRect_Intersects">Intersects</a> | returns true if areas overlap |
1509| <a href="#SkIRect_IntersectsNoEmptyCheck">IntersectsNoEmptyCheck</a> | returns true if areas overlap skips empty check |
1510| <a href="#SkIRect_contains">contains</a> | returns true if <a href="SkIPoint_Reference#IPoint">IPoint</a> (x, y) is equal or inside |
1511|  | <a href="#SkIRect_contains">contains(int32 t x, int32 t y)</a> const |
1512| <a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a> | returns true if contains unsorted <a href="#IRect">IRect</a> |
1513|  | <a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck(int32 t left, int32 t top, int32 t right, int32 t bottom)</a> const |
1514| <a href="#SkIRect_intersect">intersect</a> | sets to shared area; returns true if not empty |
1515|  | <a href="#SkIRect_intersect">intersect(const SkIRect& r)</a> |
1516| <a href="#SkIRect_intersectNoEmptyCheck">intersectNoEmptyCheck</a> | sets to shared area; returns true if not empty skips empty check |
1517| <a href="#SkIRect_quickReject">quickReject</a> | returns true if rectangles do not intersect |
1518
1519<a name="SkIRect_quickReject"></a>
1520## quickReject
1521
1522<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1523bool quickReject(int l, int t, int r, int b) const
1524</pre>
1525
1526Constructs <a href="#IRect">IRect</a> (<a href="#SkIRect_quickReject_l">l</a>, <a href="#SkIRect_quickReject_t">t</a>, <a href="#SkIRect_quickReject_r">r</a>, <a href="#SkIRect_quickReject_b">b</a>) and returns true if constructed <a href="#IRect">IRect</a> does not
1527intersect <a href="#IRect">IRect</a>. Does not check to see if construction or <a href="#IRect">IRect</a> is empty.
1528
1529Is implemented with short circuit logic so that true can be returned after
1530a single compare.
1531
1532### Parameters
1533
1534<table>  <tr>    <td><a name="SkIRect_quickReject_l"> <code><strong>l </strong></code> </a></td> <td>
1535x minimum of constructed <a href="#IRect">IRect</a></td>
1536  </tr>  <tr>    <td><a name="SkIRect_quickReject_t"> <code><strong>t </strong></code> </a></td> <td>
1537y minimum of constructed <a href="#IRect">IRect</a></td>
1538  </tr>  <tr>    <td><a name="SkIRect_quickReject_r"> <code><strong>r </strong></code> </a></td> <td>
1539x maximum of constructed <a href="#IRect">IRect</a></td>
1540  </tr>  <tr>    <td><a name="SkIRect_quickReject_b"> <code><strong>b </strong></code> </a></td> <td>
1541y maximum of constructed <a href="#IRect">IRect</a></td>
1542  </tr>
1543</table>
1544
1545### Return Value
1546
1547true if construction and <a href="#IRect">IRect</a> have no area in common
1548
1549### Example
1550
1551<div><fiddle-embed name="f07146508efc516559d73853e6dadc78"><div><a href="#SkIRect_quickReject">quickReject</a> is the complement of <a href="#SkIRect_Intersects">Intersects</a>.</div>
1552
1553#### Example Output
1554
1555~~~~
1556rect (7, 11, 13, 17) test(13, 11, 15, 17) quickReject true; intersects false
1557rect (7, 11, 13, 17) test(7, 7, 13, 11) quickReject true; intersects false
1558rect (7, 11, 13, 17) test(12, 16, 14, 18) quickReject false; intersects true
1559~~~~
1560
1561</fiddle-embed></div>
1562
1563### See Also
1564
1565<a href="#SkIRect_Intersects">Intersects</a>
1566
1567---
1568
1569<a name="SkIRect_contains"></a>
1570## contains
1571
1572<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1573bool contains(int32_t x, int32_t y) const
1574</pre>
1575
1576Returns true if:
1577<a href="#SkIRect_fLeft">fLeft</a> <= x < <a href="#SkIRect_fRight">fRight</a> && <a href="#SkIRect_fTop">fTop</a> <= y < <a href="#SkIRect_fBottom">fBottom</a>.
1578
1579Returns false if <a href="#IRect">IRect</a> is empty.
1580
1581Considers input to describe constructed <a href="#IRect">IRect</a>:
1582(x, y, x + 1, y + 1)and
1583returns true if constructed area is completely enclosed by <a href="#IRect">IRect</a> area.
1584
1585### Parameters
1586
1587<table>  <tr>    <td><a name="SkIRect_contains_x"> <code><strong>x </strong></code> </a></td> <td>
1588test <a href="SkIPoint_Reference#IPoint">IPoint</a> x-coordinate</td>
1589  </tr>  <tr>    <td><a name="SkIRect_contains_y"> <code><strong>y </strong></code> </a></td> <td>
1590test <a href="SkIPoint_Reference#IPoint">IPoint</a> y-coordinate</td>
1591  </tr>
1592</table>
1593
1594### Return Value
1595
1596true if (x, y) is inside <a href="#IRect">IRect</a>
1597
1598### Example
1599
1600<div><fiddle-embed name="a7958a4e0668f5cf805a8e78eb57f51d">
1601
1602#### Example Output
1603
1604~~~~
1605rect: (30, 50, 40, 60) contains (30, 50)
1606rect: (30, 50, 40, 60) does not contain (40, 50)
1607rect: (30, 50, 40, 60) does not contain (30, 60)
1608~~~~
1609
1610</fiddle-embed></div>
1611
1612### See Also
1613
1614<a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a><sup><a href="#SkIRect_containsNoEmptyCheck_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_contains">SkRect::contains</a><sup><a href="SkRect_Reference#SkRect_contains_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_contains_3">[3]</a></sup>
1615
1616---
1617
1618<a name="SkIRect_contains_2"></a>
1619
1620<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1621bool contains(int32_t left, int32_t top, int32_t right, int32_t bottom) const
1622</pre>
1623
1624Constructs <a href="#IRect">IRect</a> to intersect from (left, top, right, bottom). Does not sort
1625construction.
1626
1627Returns true if <a href="#IRect">IRect</a> contains construction.
1628Returns false if <a href="#IRect">IRect</a> is empty or construction is empty.
1629
1630### Parameters
1631
1632<table>  <tr>    <td><a name="SkIRect_contains_2_left"> <code><strong>left </strong></code> </a></td> <td>
1633x minimum of constructed <a href="#IRect">IRect</a></td>
1634  </tr>  <tr>    <td><a name="SkIRect_contains_2_top"> <code><strong>top </strong></code> </a></td> <td>
1635y minimum of constructed <a href="#IRect">IRect</a></td>
1636  </tr>  <tr>    <td><a name="SkIRect_contains_2_right"> <code><strong>right </strong></code> </a></td> <td>
1637x maximum of constructed <a href="#IRect">IRect</a></td>
1638  </tr>  <tr>    <td><a name="SkIRect_contains_2_bottom"> <code><strong>bottom </strong></code> </a></td> <td>
1639y maximum of constructed <a href="#IRect">IRect</a></td>
1640  </tr>
1641</table>
1642
1643### Return Value
1644
1645true if all sides of <a href="#IRect">IRect</a> are outside construction
1646
1647### Example
1648
1649<div><fiddle-embed name="eae55f284818d9965ec5834747d14a48">
1650
1651#### Example Output
1652
1653~~~~
1654rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
1655rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
1656rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
1657~~~~
1658
1659</fiddle-embed></div>
1660
1661### See Also
1662
1663<a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a><sup><a href="#SkIRect_containsNoEmptyCheck_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_contains">SkRect::contains</a><sup><a href="SkRect_Reference#SkRect_contains_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_contains_3">[3]</a></sup>
1664
1665---
1666
1667<a name="SkIRect_contains_3"></a>
1668
1669<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1670bool contains(const SkIRect& r) const
1671</pre>
1672
1673Returns true if <a href="#IRect">IRect</a> contains <a href="#SkIRect_contains_3_r">r</a>.
1674Returns false if <a href="#IRect">IRect</a> is empty or <a href="#SkIRect_contains_3_r">r</a> is empty.
1675
1676<a href="#IRect">IRect</a> contains <a href="#SkIRect_contains_3_r">r</a> when <a href="#IRect">IRect</a> area completely includes <a href="#SkIRect_contains_3_r">r</a> area.
1677
1678### Parameters
1679
1680<table>  <tr>    <td><a name="SkIRect_contains_3_r"> <code><strong>r </strong></code> </a></td> <td>
1681<a href="#IRect">IRect</a> contained</td>
1682  </tr>
1683</table>
1684
1685### Return Value
1686
1687true if all sides of <a href="#IRect">IRect</a> are outside <a href="#SkIRect_contains_3_r">r</a>
1688
1689### Example
1690
1691<div><fiddle-embed name="ee0185db622602b4eb19583c2f42c734">
1692
1693#### Example Output
1694
1695~~~~
1696rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
1697rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
1698rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
1699~~~~
1700
1701</fiddle-embed></div>
1702
1703### See Also
1704
1705<a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a><sup><a href="#SkIRect_containsNoEmptyCheck_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_contains">SkRect::contains</a><sup><a href="SkRect_Reference#SkRect_contains_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_contains_3">[3]</a></sup>
1706
1707---
1708
1709<a name="SkIRect_contains_4"></a>
1710
1711<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1712bool contains(const SkRect& r) const
1713</pre>
1714
1715Returns true if <a href="#IRect">IRect</a> contains <a href="#SkIRect_contains_4_r">r</a>.
1716Returns false if <a href="#IRect">IRect</a> is empty or <a href="#SkIRect_contains_4_r">r</a> is empty.
1717
1718<a href="#IRect">IRect</a> contains <a href="#SkIRect_contains_4_r">r</a> when <a href="#IRect">IRect</a> area completely includes <a href="#SkIRect_contains_4_r">r</a> area.
1719
1720### Parameters
1721
1722<table>  <tr>    <td><a name="SkIRect_contains_4_r"> <code><strong>r </strong></code> </a></td> <td>
1723<a href="SkRect_Reference#Rect">Rect</a> contained</td>
1724  </tr>
1725</table>
1726
1727### Return Value
1728
1729true if all sides of <a href="#IRect">IRect</a> are outside <a href="#SkIRect_contains_4_r">r</a>
1730
1731### Example
1732
1733<div><fiddle-embed name="acbd79ffb304f332e4b38ef18e19663e">
1734
1735#### Example Output
1736
1737~~~~
1738rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
1739rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
1740rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
1741~~~~
1742
1743</fiddle-embed></div>
1744
1745### See Also
1746
1747<a href="#SkIRect_containsNoEmptyCheck">containsNoEmptyCheck</a><sup><a href="#SkIRect_containsNoEmptyCheck_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_contains">SkRect::contains</a><sup><a href="SkRect_Reference#SkRect_contains_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_contains_3">[3]</a></sup>
1748
1749---
1750
1751<a name="SkIRect_containsNoEmptyCheck"></a>
1752## containsNoEmptyCheck
1753
1754<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1755bool containsNoEmptyCheck(int32_t left, int32_t top, int32_t right, int32_t bottom) const
1756</pre>
1757
1758Constructs <a href="#IRect">IRect</a> from (left, top, right, bottom). Does not sort
1759construction.
1760
1761Returns true if <a href="#IRect">IRect</a> contains construction.
1762Asserts if <a href="#IRect">IRect</a> is empty or construction is empty, and if SK_DEBUG is defined.
1763
1764Return is undefined if <a href="#IRect">IRect</a> is empty or construction is empty.
1765
1766### Parameters
1767
1768<table>  <tr>    <td><a name="SkIRect_containsNoEmptyCheck_left"> <code><strong>left </strong></code> </a></td> <td>
1769x minimum of constructed <a href="#IRect">IRect</a></td>
1770  </tr>  <tr>    <td><a name="SkIRect_containsNoEmptyCheck_top"> <code><strong>top </strong></code> </a></td> <td>
1771y minimum of constructed <a href="#IRect">IRect</a></td>
1772  </tr>  <tr>    <td><a name="SkIRect_containsNoEmptyCheck_right"> <code><strong>right </strong></code> </a></td> <td>
1773x maximum of constructed <a href="#IRect">IRect</a></td>
1774  </tr>  <tr>    <td><a name="SkIRect_containsNoEmptyCheck_bottom"> <code><strong>bottom </strong></code> </a></td> <td>
1775y maximum of constructed <a href="#IRect">IRect</a></td>
1776  </tr>
1777</table>
1778
1779### Return Value
1780
1781true if all sides of <a href="#IRect">IRect</a> are outside construction
1782
1783### Example
1784
1785<div><fiddle-embed name="fef2a36bee224e92500199fa9d3cbb8b">
1786
1787#### Example Output
1788
1789~~~~
1790rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
1791rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
1792rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
1793~~~~
1794
1795</fiddle-embed></div>
1796
1797### See Also
1798
1799<a href="#SkIRect_contains">contains</a><sup><a href="#SkIRect_contains_2">[2]</a></sup><sup><a href="#SkIRect_contains_3">[3]</a></sup><sup><a href="#SkIRect_contains_4">[4]</a></sup> <a href="SkRect_Reference#SkRect_contains">SkRect::contains</a><sup><a href="SkRect_Reference#SkRect_contains_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_contains_3">[3]</a></sup>
1800
1801---
1802
1803<a name="SkIRect_containsNoEmptyCheck_2"></a>
1804
1805<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1806bool containsNoEmptyCheck(const SkIRect& r) const
1807</pre>
1808
1809Returns true if <a href="#IRect">IRect</a> contains construction.
1810Asserts if <a href="#IRect">IRect</a> is empty or construction is empty, and if SK_DEBUG is defined.
1811
1812Return is undefined if <a href="#IRect">IRect</a> is empty or construction is empty.
1813
1814### Parameters
1815
1816<table>  <tr>    <td><a name="SkIRect_containsNoEmptyCheck_2_r"> <code><strong>r </strong></code> </a></td> <td>
1817<a href="#IRect">IRect</a> contained</td>
1818  </tr>
1819</table>
1820
1821### Return Value
1822
1823true if all sides of <a href="#IRect">IRect</a> are outside <a href="#SkIRect_containsNoEmptyCheck_2_r">r</a>
1824
1825### Example
1826
1827<div><fiddle-embed name="8f91f58001d9c10420eb146fbc169af4">
1828
1829#### Example Output
1830
1831~~~~
1832rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
1833rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
1834rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
1835~~~~
1836
1837</fiddle-embed></div>
1838
1839### See Also
1840
1841<a href="#SkIRect_contains">contains</a><sup><a href="#SkIRect_contains_2">[2]</a></sup><sup><a href="#SkIRect_contains_3">[3]</a></sup><sup><a href="#SkIRect_contains_4">[4]</a></sup> <a href="SkRect_Reference#SkRect_contains">SkRect::contains</a><sup><a href="SkRect_Reference#SkRect_contains_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_contains_3">[3]</a></sup>
1842
1843---
1844
1845<a name="SkIRect_intersect"></a>
1846## intersect
1847
1848<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1849bool intersect(const SkIRect& r)
1850</pre>
1851
1852Returns true if <a href="#IRect">IRect</a> intersects <a href="#SkIRect_intersect_r">r</a>, and sets <a href="#IRect">IRect</a> to intersection.
1853Returns false if <a href="#IRect">IRect</a> does not intersect <a href="#SkIRect_intersect_r">r</a>, and leaves <a href="#IRect">IRect</a> unchanged.
1854
1855Returns false if either <a href="#SkIRect_intersect_r">r</a> or <a href="#IRect">IRect</a> is empty, leaving <a href="#IRect">IRect</a> unchanged.
1856
1857### Parameters
1858
1859<table>  <tr>    <td><a name="SkIRect_intersect_r"> <code><strong>r </strong></code> </a></td> <td>
1860limit of result</td>
1861  </tr>
1862</table>
1863
1864### Return Value
1865
1866true if <a href="#SkIRect_intersect_r">r</a> and <a href="#IRect">IRect</a> have area in common
1867
1868### Example
1869
1870<div><fiddle-embed name="2be1302480e54a767e25cbeed5d41b41"><div>Two <a href="undocumented#SkDebugf">SkDebugf</a> calls are required. If the calls are combined, their arguments
1871may not be evaluated in left to right order: the printed intersection may
1872be before or after the call to intersect.</div>
1873
1874#### Example Output
1875
1876~~~~
1877intersection: 30, 60, 50, 80
1878~~~~
1879
1880</fiddle-embed></div>
1881
1882### See Also
1883
1884<a href="#SkIRect_Intersects">Intersects</a> <a href="#SkIRect_intersectNoEmptyCheck">intersectNoEmptyCheck</a> <a href="#SkIRect_join">join</a><sup><a href="#SkIRect_join_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_intersect">SkRect::intersect</a><sup><a href="SkRect_Reference#SkRect_intersect_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_intersect_3">[3]</a></sup>
1885
1886---
1887
1888<a name="SkIRect_intersect_2"></a>
1889
1890<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1891bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b)
1892</pre>
1893
1894Returns true if <a href="#SkIRect_intersect_2_a">a</a> intersects <a href="#SkIRect_intersect_2_b">b</a>, and sets <a href="#IRect">IRect</a> to intersection.
1895Returns false if <a href="#SkIRect_intersect_2_a">a</a> does not intersect <a href="#SkIRect_intersect_2_b">b</a>, and leaves <a href="#IRect">IRect</a> unchanged.
1896
1897Returns false if either <a href="#SkIRect_intersect_2_a">a</a> or <a href="#SkIRect_intersect_2_b">b</a> is empty, leaving <a href="#IRect">IRect</a> unchanged.
1898
1899### Parameters
1900
1901<table>  <tr>    <td><a name="SkIRect_intersect_2_a"> <code><strong>a </strong></code> </a></td> <td>
1902<a href="#IRect">IRect</a> to intersect</td>
1903  </tr>  <tr>    <td><a name="SkIRect_intersect_2_b"> <code><strong>b </strong></code> </a></td> <td>
1904<a href="#IRect">IRect</a> to intersect</td>
1905  </tr>
1906</table>
1907
1908### Return Value
1909
1910true if <a href="#SkIRect_intersect_2_a">a</a> and <a href="#SkIRect_intersect_2_b">b</a> have area in common
1911
1912### Example
1913
1914<div><fiddle-embed name="b2db0573aacf99ca52776c5522459d02">
1915
1916#### Example Output
1917
1918~~~~
1919intersection: 30, 60, 50, 80
1920~~~~
1921
1922</fiddle-embed></div>
1923
1924### See Also
1925
1926<a href="#SkIRect_Intersects">Intersects</a> <a href="#SkIRect_intersectNoEmptyCheck">intersectNoEmptyCheck</a> <a href="#SkIRect_join">join</a><sup><a href="#SkIRect_join_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_intersect">SkRect::intersect</a><sup><a href="SkRect_Reference#SkRect_intersect_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_intersect_3">[3]</a></sup>
1927
1928---
1929
1930<a name="SkIRect_intersectNoEmptyCheck"></a>
1931## intersectNoEmptyCheck
1932
1933<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1934bool SK_WARN_UNUSED_RESULT intersectNoEmptyCheck(const SkIRect& a, const SkIRect& b)
1935</pre>
1936
1937Returns true if <a href="#SkIRect_intersectNoEmptyCheck_a">a</a> intersects <a href="#SkIRect_intersectNoEmptyCheck_b">b</a>, and sets <a href="#IRect">IRect</a> to intersection.
1938Returns false if <a href="#SkIRect_intersectNoEmptyCheck_a">a</a> does not intersect <a href="#SkIRect_intersectNoEmptyCheck_b">b</a>, and leaves <a href="#IRect">IRect</a> unchanged.
1939
1940Asserts if either <a href="#SkIRect_intersectNoEmptyCheck_a">a</a> or <a href="#SkIRect_intersectNoEmptyCheck_b">b</a> is empty, and if SK_DEBUG is defined.
1941
1942### Parameters
1943
1944<table>  <tr>    <td><a name="SkIRect_intersectNoEmptyCheck_a"> <code><strong>a </strong></code> </a></td> <td>
1945<a href="#IRect">IRect</a> to intersect</td>
1946  </tr>  <tr>    <td><a name="SkIRect_intersectNoEmptyCheck_b"> <code><strong>b </strong></code> </a></td> <td>
1947<a href="#IRect">IRect</a> to intersect</td>
1948  </tr>
1949</table>
1950
1951### Return Value
1952
1953true if <a href="#SkIRect_intersectNoEmptyCheck_a">a</a> and <a href="#SkIRect_intersectNoEmptyCheck_b">b</a> have area in common
1954
1955### Example
1956
1957<div><fiddle-embed name="2b3e26ccba1cba3d961645f0824621ac">
1958
1959#### Example Output
1960
1961~~~~
1962intersection: 30, 60, 50, 80
1963~~~~
1964
1965</fiddle-embed></div>
1966
1967### See Also
1968
1969<a href="#SkIRect_Intersects">Intersects</a> <a href="#SkIRect_intersect">intersect</a><sup><a href="#SkIRect_intersect_2">[2]</a></sup><sup><a href="#SkIRect_intersect_3">[3]</a></sup> <a href="#SkIRect_join">join</a><sup><a href="#SkIRect_join_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_intersect">SkRect::intersect</a><sup><a href="SkRect_Reference#SkRect_intersect_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_intersect_3">[3]</a></sup>
1970
1971---
1972
1973<a name="SkIRect_intersect_3"></a>
1974
1975<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
1976bool intersect(int32_t left, int32_t top, int32_t right, int32_t bottom)
1977</pre>
1978
1979Constructs <a href="#IRect">IRect</a> to intersect from (left, top, right, bottom). Does not sort
1980construction.
1981
1982Returns true if <a href="#IRect">IRect</a> intersects construction, and sets <a href="#IRect">IRect</a> to intersection.
1983Returns false if <a href="#IRect">IRect</a> does not intersect construction, and leaves <a href="#IRect">IRect</a> unchanged.
1984
1985Returns false if either construction or <a href="#IRect">IRect</a> is empty, leaving <a href="#IRect">IRect</a> unchanged.
1986
1987### Parameters
1988
1989<table>  <tr>    <td><a name="SkIRect_intersect_3_left"> <code><strong>left </strong></code> </a></td> <td>
1990x minimum of constructed <a href="#IRect">IRect</a></td>
1991  </tr>  <tr>    <td><a name="SkIRect_intersect_3_top"> <code><strong>top </strong></code> </a></td> <td>
1992y minimum of constructed <a href="#IRect">IRect</a></td>
1993  </tr>  <tr>    <td><a name="SkIRect_intersect_3_right"> <code><strong>right </strong></code> </a></td> <td>
1994x maximum of constructed <a href="#IRect">IRect</a></td>
1995  </tr>  <tr>    <td><a name="SkIRect_intersect_3_bottom"> <code><strong>bottom </strong></code> </a></td> <td>
1996y maximum of constructed <a href="#IRect">IRect</a></td>
1997  </tr>
1998</table>
1999
2000### Return Value
2001
2002true if construction and <a href="#IRect">IRect</a> have area in common
2003
2004### Example
2005
2006<div><fiddle-embed name="4e6f580a3906c08a5faee524f7e72334"><div>Two <a href="undocumented#SkDebugf">SkDebugf</a> calls are required. If the calls are combined, their arguments
2007may not be evaluated in left to right order: the printed intersection may
2008be before or after the call to intersect.</div>
2009
2010#### Example Output
2011
2012~~~~
2013intersection: 30, 60, 50, 80
2014~~~~
2015
2016</fiddle-embed></div>
2017
2018### See Also
2019
2020<a href="#SkIRect_intersectNoEmptyCheck">intersectNoEmptyCheck</a> <a href="#SkIRect_Intersects">Intersects</a> <a href="#SkIRect_join">join</a><sup><a href="#SkIRect_join_2">[2]</a></sup> <a href="SkRect_Reference#SkRect_intersect">SkRect::intersect</a><sup><a href="SkRect_Reference#SkRect_intersect_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_intersect_3">[3]</a></sup>
2021
2022---
2023
2024<a name="SkIRect_Intersects"></a>
2025## Intersects
2026
2027<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2028static bool Intersects(const SkIRect& a, const SkIRect& b)
2029</pre>
2030
2031Returns true if <a href="#SkIRect_Intersects_a">a</a> intersects <a href="#SkIRect_Intersects_b">b</a>.
2032Returns false if either <a href="#SkIRect_Intersects_a">a</a> or <a href="#SkIRect_Intersects_b">b</a> is empty, or do not intersect.
2033
2034### Parameters
2035
2036<table>  <tr>    <td><a name="SkIRect_Intersects_a"> <code><strong>a </strong></code> </a></td> <td>
2037<a href="#IRect">IRect</a> to intersect</td>
2038  </tr>  <tr>    <td><a name="SkIRect_Intersects_b"> <code><strong>b </strong></code> </a></td> <td>
2039<a href="#IRect">IRect</a> to intersect</td>
2040  </tr>
2041</table>
2042
2043### Return Value
2044
2045true if <a href="#SkIRect_Intersects_a">a</a> and <a href="#SkIRect_Intersects_b">b</a> have area in common
2046
2047### Example
2048
2049<div><fiddle-embed name="0c67cf8981389efc7108369fb9b7976b">
2050
2051#### Example Output
2052
2053~~~~
2054intersection
2055~~~~
2056
2057</fiddle-embed></div>
2058
2059### See Also
2060
2061<a href="#SkIRect_IntersectsNoEmptyCheck">IntersectsNoEmptyCheck</a> <a href="#SkIRect_intersect">intersect</a><sup><a href="#SkIRect_intersect_2">[2]</a></sup><sup><a href="#SkIRect_intersect_3">[3]</a></sup> <a href="SkRect_Reference#SkRect_intersect">SkRect::intersect</a><sup><a href="SkRect_Reference#SkRect_intersect_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_intersect_3">[3]</a></sup>
2062
2063---
2064
2065<a name="SkIRect_IntersectsNoEmptyCheck"></a>
2066## IntersectsNoEmptyCheck
2067
2068<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2069static bool IntersectsNoEmptyCheck(const SkIRect& a, const SkIRect& b)
2070</pre>
2071
2072Returns true if <a href="#SkIRect_IntersectsNoEmptyCheck_a">a</a> intersects <a href="#SkIRect_IntersectsNoEmptyCheck_b">b</a>.
2073Asserts if either <a href="#SkIRect_IntersectsNoEmptyCheck_a">a</a> or <a href="#SkIRect_IntersectsNoEmptyCheck_b">b</a> is empty, and if SK_DEBUG is defined.
2074
2075### Parameters
2076
2077<table>  <tr>    <td><a name="SkIRect_IntersectsNoEmptyCheck_a"> <code><strong>a </strong></code> </a></td> <td>
2078<a href="#IRect">IRect</a> to intersect</td>
2079  </tr>  <tr>    <td><a name="SkIRect_IntersectsNoEmptyCheck_b"> <code><strong>b </strong></code> </a></td> <td>
2080<a href="#IRect">IRect</a> to intersect</td>
2081  </tr>
2082</table>
2083
2084### Return Value
2085
2086true if <a href="#SkIRect_IntersectsNoEmptyCheck_a">a</a> and <a href="#SkIRect_IntersectsNoEmptyCheck_b">b</a> have area in common
2087
2088### Example
2089
2090<div><fiddle-embed name="dba234d15162fb5b26e1a96529ca6a2a">
2091
2092#### Example Output
2093
2094~~~~
2095intersection
2096~~~~
2097
2098</fiddle-embed></div>
2099
2100### See Also
2101
2102<a href="#SkIRect_Intersects">Intersects</a> <a href="#SkIRect_intersect">intersect</a><sup><a href="#SkIRect_intersect_2">[2]</a></sup><sup><a href="#SkIRect_intersect_3">[3]</a></sup> <a href="SkRect_Reference#SkRect_intersect">SkRect::intersect</a><sup><a href="SkRect_Reference#SkRect_intersect_2">[2]</a></sup><sup><a href="SkRect_Reference#SkRect_intersect_3">[3]</a></sup>
2103
2104---
2105
2106## <a name="Join"></a> Join
2107
2108| name | description |
2109| --- | --- |
2110| <a href="#SkIRect_join">join</a> | sets to union of bounds |
2111|  | <a href="#SkIRect_join">join(int32 t left, int32 t top, int32 t right, int32 t bottom)</a> |
2112|  | <a href="#SkIRect_join_2">join(const SkIRect& r)</a> |
2113
2114<a name="SkIRect_join"></a>
2115## join
2116
2117<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2118void join(int32_t left, int32_t top, int32_t right, int32_t bottom)
2119</pre>
2120
2121Constructs <a href="#IRect">IRect</a> to intersect from (left, top, right, bottom). Does not sort
2122construction.
2123
2124Sets <a href="#IRect">IRect</a> to the union of itself and the construction.
2125
2126Has no effect if construction is empty. Otherwise, if <a href="#IRect">IRect</a> is empty, sets
2127<a href="#IRect">IRect</a> to construction.
2128
2129### Parameters
2130
2131<table>  <tr>    <td><a name="SkIRect_join_left"> <code><strong>left </strong></code> </a></td> <td>
2132x minimum of constructed <a href="#IRect">IRect</a></td>
2133  </tr>  <tr>    <td><a name="SkIRect_join_top"> <code><strong>top </strong></code> </a></td> <td>
2134y minimum of constructed <a href="#IRect">IRect</a></td>
2135  </tr>  <tr>    <td><a name="SkIRect_join_right"> <code><strong>right </strong></code> </a></td> <td>
2136x maximum of constructed <a href="#IRect">IRect</a></td>
2137  </tr>  <tr>    <td><a name="SkIRect_join_bottom"> <code><strong>bottom </strong></code> </a></td> <td>
2138y maximum of constructed <a href="#IRect">IRect</a></td>
2139  </tr>
2140</table>
2141
2142### Example
2143
2144<div><fiddle-embed name="c00ef06289d21db70340e465690e0e08">
2145
2146#### Example Output
2147
2148~~~~
2149join: 10, 20, 55, 65
2150~~~~
2151
2152</fiddle-embed></div>
2153
2154### See Also
2155
2156<a href="#SkIRect_set">set</a> <a href="SkRect_Reference#SkRect_join">SkRect::join</a><sup><a href="SkRect_Reference#SkRect_join_2">[2]</a></sup>
2157
2158---
2159
2160<a name="SkIRect_join_2"></a>
2161
2162<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2163void join(const SkIRect& r)
2164</pre>
2165
2166Sets <a href="#IRect">IRect</a> to the union of itself and <a href="#SkIRect_join_2_r">r</a>.
2167
2168Has no effect if <a href="#SkIRect_join_2_r">r</a> is empty. Otherwise, if <a href="#IRect">IRect</a> is empty, sets <a href="#IRect">IRect</a> to <a href="#SkIRect_join_2_r">r</a>.
2169
2170### Parameters
2171
2172<table>  <tr>    <td><a name="SkIRect_join_2_r"> <code><strong>r </strong></code> </a></td> <td>
2173expansion <a href="#IRect">IRect</a></td>
2174  </tr>
2175</table>
2176
2177### Example
2178
2179<div><fiddle-embed name="75fd81c1d3512e63890d085593018876">
2180
2181#### Example Output
2182
2183~~~~
2184join: 10, 20, 55, 65
2185~~~~
2186
2187</fiddle-embed></div>
2188
2189### See Also
2190
2191<a href="#SkIRect_set">set</a> <a href="SkRect_Reference#SkRect_join">SkRect::join</a><sup><a href="SkRect_Reference#SkRect_join_2">[2]</a></sup>
2192
2193---
2194
2195## <a name="Sorting"></a> Sorting
2196
2197| name | description |
2198| --- | --- |
2199| <a href="#SkIRect_sort">sort</a> | orders sides from smaller to larger |
2200
2201<a name="SkIRect_sort"></a>
2202## sort
2203
2204<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2205void sort()
2206</pre>
2207
2208Swaps <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a> if <a href="#SkIRect_fLeft">fLeft</a> is greater than <a href="#SkIRect_fRight">fRight</a>; and swaps
2209<a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a> if <a href="#SkIRect_fTop">fTop</a> is greater than <a href="#SkIRect_fBottom">fBottom</a>. Result may be empty,
2210and <a href="#SkIRect_width">width</a> and <a href="#SkIRect_height">height</a> will be zero or positive.
2211
2212### Example
2213
2214<div><fiddle-embed name="fa12547fcfd4c1aef3db1a1f6aae0fe4">
2215
2216#### Example Output
2217
2218~~~~
2219rect: 30, 50, 20, 10
2220sorted: 20, 10, 30, 50
2221~~~~
2222
2223</fiddle-embed></div>
2224
2225### See Also
2226
2227<a href="#SkIRect_makeSorted">makeSorted</a> <a href="SkRect_Reference#SkRect_sort">SkRect::sort</a>
2228
2229---
2230
2231<a name="SkIRect_makeSorted"></a>
2232## makeSorted
2233
2234<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2235SkIRect makeSorted() const
2236</pre>
2237
2238Returns <a href="#IRect">IRect</a> with <a href="#SkIRect_fLeft">fLeft</a> and <a href="#SkIRect_fRight">fRight</a> swapped if <a href="#SkIRect_fLeft">fLeft</a> is greater than <a href="#SkIRect_fRight">fRight</a>; and
2239with <a href="#SkIRect_fTop">fTop</a> and <a href="#SkIRect_fBottom">fBottom</a> swapped if <a href="#SkIRect_fTop">fTop</a> is greater than <a href="#SkIRect_fBottom">fBottom</a>. Result may be empty;
2240and <a href="#SkIRect_width">width</a> and <a href="#SkIRect_height">height</a> will be zero or positive.
2241
2242### Return Value
2243
2244sorted <a href="#IRect">IRect</a>
2245
2246### Example
2247
2248<div><fiddle-embed name="de89926c374aa16427916900b89a3441">
2249
2250#### Example Output
2251
2252~~~~
2253rect: 30, 50, 20, 10
2254sorted: 20, 10, 30, 50
2255~~~~
2256
2257</fiddle-embed></div>
2258
2259### See Also
2260
2261<a href="#SkIRect_sort">sort</a> <a href="SkRect_Reference#SkRect_makeSorted">SkRect::makeSorted</a>
2262
2263---
2264
2265<a name="SkIRect_EmptyIRect"></a>
2266## EmptyIRect
2267
2268<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2269static const SkIRect& SK_WARN_UNUSED_RESULT EmptyIRect()
2270</pre>
2271
2272Returns a reference to immutable empty <a href="#IRect">IRect</a>, set to (0, 0, 0, 0).
2273
2274### Return Value
2275
2276global <a href="#IRect">IRect</a> set to all zeroes
2277
2278### Example
2279
2280<div><fiddle-embed name="65e0b9b52e907902630577941fb3ed6d">
2281
2282#### Example Output
2283
2284~~~~
2285rect: 0, 0, 0, 0
2286~~~~
2287
2288</fiddle-embed></div>
2289
2290### See Also
2291
2292<a href="#SkIRect_MakeEmpty">MakeEmpty</a>
2293
2294---
2295
2296<a name="SkIRect_MakeLargest"></a>
2297## MakeLargest
2298
2299<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
2300static SkIRect SK_WARN_UNUSED_RESULT MakeLargest()
2301</pre>
2302
2303---
2304
2305