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