1SkRegion Reference 2=== 3<a href='SkRegion_Reference#Region'>Region</a> is a compressed one bit mask. <a href='SkRegion_Reference#Region'>Region</a> describes an <a href='undocumented#Alias'>aliased</a> clipping area 4on integer boundaries. <a href='SkRegion_Reference#Region'>Region</a> can also describe an array of integer rectangles. 5 6<a href='SkCanvas_Reference#Canvas'>Canvas</a> uses <a href='SkRegion_Reference#Region'>Region</a> to reduce the current clip. <a href='SkRegion_Reference#Region'>Region</a> may be drawn to <a href='SkCanvas_Reference#Canvas'>Canvas</a>; 7<a href='SkPaint_Reference#Paint'>Paint</a> determines if <a href='SkRegion_Reference#Region'>Region</a> is filled or stroked, its <a href='SkColor_Reference#Color'>Color</a>, and so on. 8 9<a href='SkRegion_Reference#Region'>Region</a> may be constructed from <a href='SkIRect_Reference#IRect'>IRect</a> array or <a href='SkPath_Reference#Path'>Path</a>. Diagonal <a href='undocumented#Line'>lines</a> and <a href='undocumented#Curve'>curves</a> 10in <a href='SkPath_Reference#Path'>Path</a> become integer rectangle edges. <a href='SkRegion_Reference#Region'>Regions</a> operators compute union, 11intersection, difference, and so on. <a href='SkCanvas_Reference#Canvas'>Canvas</a> allows only intersection and 12difference; successive clips can only reduce available <a href='SkCanvas_Reference#Canvas'>Canvas</a> area. 13 14<a name='SkRegion'></a> 15 16--- 17 18<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 19class <a href='SkRegion_Reference#SkRegion'>SkRegion</a> { 20 21 <a href='#SkRegion_empty_constructor'>SkRegion()</a>; 22 <a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>); 23 explicit <a href='#SkRegion_copy_const_SkIRect'>SkRegion</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>); 24 <a href='#SkRegion_destructor'>~SkRegion()</a>; 25 <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>); 26 bool <a href='#SkRegion_equal1_operator'>operator==</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) const; 27 bool <a href='#SkRegion_notequal1_operator'>operator!=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) const; 28 bool <a href='#SkRegion_set'>set</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& src); 29 void <a href='#SkRegion_swap'>swap</a>(<a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other); 30 bool <a href='#SkRegion_isEmpty'>isEmpty</a>() const; 31 bool <a href='#SkRegion_isRect'>isRect</a>() const; 32 bool <a href='#SkRegion_isComplex'>isComplex</a>() const; 33 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_getBounds'>getBounds</a>() const; 34 int <a href='#SkRegion_computeRegionComplexity'>computeRegionComplexity</a>() const; 35 bool <a href='#SkRegion_getBoundaryPath'>getBoundaryPath</a>(<a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>) const; 36 bool <a href='#SkRegion_setEmpty'>setEmpty</a>(); 37 bool <a href='#SkRegion_setRect'>setRect</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>); 38 bool <a href='#SkRegion_setRect'>setRect</a>(int32_t left, int32_t top, int32_t right, int32_t bottom); 39 bool <a href='#SkRegion_setRects'>setRects</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='SkRect_Reference#Rect'>rects</a>[], int count); 40 bool <a href='#SkRegion_setRegion'>setRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>); 41 bool <a href='#SkRegion_setPath'>setPath</a>(const <a href='SkPath_Reference#SkPath'>SkPath</a>& <a href='SkPath_Reference#Path'>path</a>, const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& clip); 42 bool <a href='#SkRegion_intersects'>intersects</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) const; 43 bool <a href='#SkRegion_intersects'>intersects</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) const; 44 bool <a href='#SkRegion_contains'>contains</a>(int32_t x, int32_t y) const; 45 bool <a href='#SkRegion_contains'>contains</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& other) const; 46 bool <a href='#SkRegion_contains'>contains</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) const; 47 bool <a href='#SkRegion_quickContains'>quickContains</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& r) const; 48 bool <a href='#SkRegion_quickContains'>quickContains</a>(int32_t left, int32_t top, int32_t right, 49 int32_t bottom) const; 50 bool <a href='#SkRegion_quickReject'>quickReject</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) const; 51 bool <a href='#SkRegion_quickReject'>quickReject</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn) const; 52 void <a href='#SkRegion_translate'>translate</a>(int dx, int dy); 53 void <a href='#SkRegion_translate'>translate</a>(int dx, int dy, <a href='SkRegion_Reference#SkRegion'>SkRegion</a>* dst) const; 54 55 enum <a href='#SkRegion_Op'>Op</a> { 56 <a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, 57 <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, 58 <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, 59 <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, 60 <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 61 <a href='#SkRegion_kReplace_Op'>kReplace_Op</a>, 62 <a href='#SkRegion_kLastOp'>kLastOp</a> = <a href='#SkRegion_kReplace_Op'>kReplace_Op</a>, 63 }; 64 65 static const int <a href='#SkRegion_kOpCnt'>kOpCnt</a> = <a href='#SkRegion_kLastOp'>kLastOp</a> + 1 66 bool <a href='#SkRegion_op'>op</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='#SkRegion_Op'>Op</a> op); 67 bool <a href='#SkRegion_op'>op</a>(int left, int top, int right, int bottom, <a href='#SkRegion_Op'>Op</a> op); 68 bool <a href='#SkRegion_op'>op</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn, <a href='#SkRegion_Op'>Op</a> op); 69 bool <a href='#SkRegion_op'>op</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn, <a href='#SkRegion_Op'>Op</a> op); 70 bool <a href='#SkRegion_op'>op</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='#SkRegion_Op'>Op</a> op); 71 bool <a href='#SkRegion_op'>op</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgna, const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgnb, <a href='#SkRegion_Op'>Op</a> op); 72 size_t <a href='#SkRegion_writeToMemory'>writeToMemory</a>(void* buffer) const; 73 size_t <a href='#SkRegion_readFromMemory'>readFromMemory</a>(const void* buffer, size_t length); 74}; 75 76</pre> 77 78<a href='SkRegion_Reference#SkRegion'>SkRegion</a> describes the set of pixels used to clip <a href='SkCanvas_Reference#Canvas'>Canvas</a>. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is compact, 79efficiently storing a single integer rectangle, or a run length encoded array 80of rectangles. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> may reduce the current <a href='#Canvas_Clip'>Canvas_Clip</a>, or may be drawn as 81one or more integer rectangles. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator returns the scan <a href='undocumented#Line'>lines</a> or 82rectangles contained by it, optionally intersecting a bounding rectangle. 83 84<a name='SkRegion_Iterator'></a> 85 86--- 87 88<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 89 class <a href='#SkRegion_Iterator'>Iterator</a> { 90 public: 91 <a href='#SkRegion_Iterator_Iterator'>Iterator()</a>; 92 <a href='#SkRegion_Iterator_Iterator'>Iterator</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>); 93 bool <a href='#SkRegion_Iterator_rewind'>rewind()</a>; 94 void <a href='#SkRegion_Iterator_reset'>reset</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>); 95 bool <a href='#SkRegion_Iterator_done'>done()</a> const; 96 void <a href='#SkRegion_Iterator_next'>next()</a>; 97 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_Iterator_rect'>rect()</a>; 98 const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>* <a href='#SkRegion_Iterator_rgn'>rgn()</a>; 99 }; 100</pre> 101 102Returns sequence of rectangles, sorted along y-axis, then x-axis, that make 103up <a href='SkRegion_Reference#Region'>Region</a>. 104 105<a name='SkRegion_Iterator_Iterator'></a> 106 107--- 108 109<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 110<a href='#SkRegion_Iterator_Iterator'>Iterator()</a> 111</pre> 112 113Initializes <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> with an empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. <a href='#SkRegion_Iterator_done'>done()</a> on <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> 114returns true. 115Call <a href='#SkRegion_Iterator_reset'>reset()</a> to initialized <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> at a later time. 116 117### Return Value 118 119empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator 120 121### Example 122 123<div><fiddle-embed name="a2db43ee3cbf6893e9b23927fb44298a"> 124 125#### Example Output 126 127~~~~ 128rect={1,2,3,4} 129~~~~ 130 131</fiddle-embed></div> 132 133### See Also 134 135<a href='#SkRegion_Iterator_reset'>reset</a> <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 136 137<a name='SkRegion_Iterator_copy_const_SkRegion'></a> 138 139--- 140 141<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 142<a href='#SkRegion_Iterator'>Iterator</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 143</pre> 144 145Sets <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> to return elements of <a href='SkIRect_Reference#SkIRect'>SkIRect</a> array in <a href='#SkRegion_Iterator_copy_const_SkRegion_region'>region</a>. 146 147### Parameters 148 149<table> <tr> <td><a name='SkRegion_Iterator_copy_const_SkRegion_region'><code><strong>region</strong></code></a></td> 150 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to iterate</td> 151 </tr> 152</table> 153 154### Return Value 155 156<a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator 157 158### Example 159 160<div><fiddle-embed name="e317ceca48a6a7504219af58f35d2c95"> 161 162#### Example Output 163 164~~~~ 165rect={1,2,3,4} 166~~~~ 167 168</fiddle-embed></div> 169 170### See Also 171 172<a href='#SkRegion_Iterator_reset'>reset</a> <a href='SkRegion_Reference#SkRegion'>SkRegion</a> <a href='#SkRegion_Cliperator'>Cliperator</a> <a href='#SkRegion_Spanerator'>Spanerator</a> 173 174<a name='SkRegion_Iterator_rewind'></a> 175 176--- 177 178<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 179bool <a href='#SkRegion_Iterator_rewind'>rewind()</a> 180</pre> 181 182<a href='SkPoint_Reference#SkPoint'>SkPoint</a> <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> to start of <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 183Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> was set; otherwise, returns false. 184 185### Return Value 186 187true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> was set 188 189### Example 190 191<div><fiddle-embed name="32d51e959d6cc720a74ec4822511e2cd"> 192 193#### Example Output 194 195~~~~ 196#Volatile 197empty iter rewind success=false 198empty iter rect={0,0,0,0} 199empty region rewind success=true 200empty region rect={0,0,0,0} 201after set rect rect={1,2,3,4} 202after rewind rewind success=true 203after rewind rect={1,2,3,4} 204~~~~ 205 206</fiddle-embed></div> 207 208### See Also 209 210<a href='#SkRegion_Iterator_reset'>reset</a> 211 212<a name='SkRegion_Iterator_reset'></a> 213 214--- 215 216<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 217void reset(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 218</pre> 219 220Resets iterator, using the new <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 221 222### Parameters 223 224<table> <tr> <td><a name='SkRegion_Iterator_reset_region'><code><strong>region</strong></code></a></td> 225 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to iterate</td> 226 </tr> 227</table> 228 229### Example 230 231<div><fiddle-embed name="d153f87bd518a4ab947b7e407ea1db79"> 232 233#### Example Output 234 235~~~~ 236empty region: done=true 237after set rect: done=true 238after reset: done=false 239~~~~ 240 241</fiddle-embed></div> 242 243### See Also 244 245<a href='#SkRegion_Iterator_rewind'>rewind</a> 246 247<a name='SkRegion_Iterator_done'></a> 248 249--- 250 251<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 252bool <a href='#SkRegion_Iterator_done'>done()</a>const 253</pre> 254 255Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> is pointing to final <a href='SkIRect_Reference#SkIRect'>SkIRect</a> in <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 256 257### Return Value 258 259true if <a href='undocumented#Data'>data</a> parsing is complete 260 261### Example 262 263<div><fiddle-embed name="814efa7d7f4ae52dfc861a937c1b5c25"> 264 265#### Example Output 266 267~~~~ 268done=true 269done=false 270~~~~ 271 272</fiddle-embed></div> 273 274### See Also 275 276<a href='#SkRegion_Iterator_next'>next</a> <a href='#SkRegion_Iterator_rect'>rect</a> 277 278<a name='SkRegion_Iterator_next'></a> 279 280--- 281 282<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 283void <a href='#SkRegion_Iterator_next'>next()</a> 284</pre> 285 286Advances <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Iterator'>Iterator</a> to next <a href='SkIRect_Reference#SkIRect'>SkIRect</a> in <a href='SkRegion_Reference#SkRegion'>SkRegion</a> if it is not done. 287 288### Example 289 290<div><fiddle-embed name="771236c2eadfc2fcd02a3e61a0875d39"> 291 292#### Example Output 293 294~~~~ 295rect={1,2,3,4} 296rect={5,6,7,8} 297~~~~ 298 299</fiddle-embed></div> 300 301### See Also 302 303<a href='#SkRegion_Iterator_done'>done</a> <a href='#SkRegion_Iterator_rect'>rect</a> 304 305<a name='SkRegion_Iterator_rect'></a> 306 307--- 308 309<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 310const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_Iterator_rect'>rect()</a>const 311</pre> 312 313Returns <a href='SkIRect_Reference#SkIRect'>SkIRect</a> element in <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. Does not return predictable results if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 314is empty. 315 316### Return Value 317 318part of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> as <a href='SkIRect_Reference#SkIRect'>SkIRect</a> 319 320### Example 321 322<div><fiddle-embed name="0e7c58ab5d3bcfb36b1f8464cf6c7d89"> 323 324#### Example Output 325 326~~~~ 327#Volatile 328rect={0,0,0,0} 329rect={1,2,3,4} 330~~~~ 331 332</fiddle-embed></div> 333 334### See Also 335 336<a href='#SkRegion_Iterator_next'>next</a> <a href='#SkRegion_Iterator_done'>done</a> 337 338<a name='SkRegion_Iterator_rgn'></a> 339 340--- 341 342<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 343const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>* <a href='#SkRegion_Iterator_rgn'>rgn()</a>const 344</pre> 345 346Returns <a href='SkRegion_Reference#SkRegion'>SkRegion</a> if set; otherwise, returns nullptr. 347 348### Return Value 349 350iterated <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 351 352### Example 353 354<div><fiddle-embed name="bbc3c454a21186e2a16e843a5b061c44"></fiddle-embed></div> 355 356### See Also 357 358<a href='#SkRegion_Iterator'>Iterator</a> <a href='#SkRegion_Iterator_reset'>reset</a> 359 360<a name='SkRegion_Cliperator'></a> 361 362--- 363 364<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 365 class <a href='#SkRegion_Cliperator'>Cliperator</a> { 366 public: 367 <a href='#SkRegion_Cliperator'>Cliperator</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& clip); 368 bool <a href='#SkRegion_Cliperator_done'>done()</a>; 369 void <a href='#SkRegion_Cliperator_next'>next()</a>; 370 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_Cliperator_rect'>rect()</a> const; 371 }; 372</pre> 373 374Returns the sequence of rectangles, sorted along y-axis, then x-axis, that make 375up <a href='SkRegion_Reference#Region'>Region</a> intersected with the specified clip rectangle. 376 377<a name='SkRegion_Cliperator_const_SkRegion_const_SkIRect'></a> 378 379--- 380 381<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 382<a href='#SkRegion_Cliperator'>Cliperator</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& clip) 383</pre> 384 385Sets <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Cliperator'>Cliperator</a> to return elements of <a href='SkIRect_Reference#SkIRect'>SkIRect</a> array in <a href='SkRegion_Reference#SkRegion'>SkRegion</a> within <a href='#SkRegion_Cliperator_const_SkRegion_const_SkIRect_clip'>clip</a>. 386 387### Parameters 388 389<table> <tr> <td><a name='SkRegion_Cliperator_const_SkRegion_const_SkIRect_region'><code><strong>region</strong></code></a></td> 390 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to iterate</td> 391 </tr> 392 <tr> <td><a name='SkRegion_Cliperator_const_SkRegion_const_SkIRect_clip'><code><strong>clip</strong></code></a></td> 393 <td>bounds of iteration</td> 394 </tr> 395</table> 396 397### Return Value 398 399<a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator 400 401### Example 402 403<div><fiddle-embed name="3831fb6006a7e0ad5d140c266c22be78"> 404 405#### Example Output 406 407~~~~ 408rect={1,2,2,3} 409~~~~ 410 411</fiddle-embed></div> 412 413### See Also 414 415<a href='SkRegion_Reference#SkRegion'>SkRegion</a> <a href='#SkRegion_Iterator'>Iterator</a> <a href='#SkRegion_Spanerator'>Spanerator</a> 416 417<a name='SkRegion_Cliperator_done'></a> 418 419--- 420 421<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 422bool <a href='#SkRegion_Cliperator_done'>done()</a> 423</pre> 424 425Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Cliperator'>Cliperator</a> is pointing to final <a href='SkIRect_Reference#SkIRect'>SkIRect</a> in <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 426 427### Return Value 428 429true if <a href='undocumented#Data'>data</a> parsing is complete 430 431### Example 432 433<div><fiddle-embed name="6cca7b96836266800d852664a1366453"> 434 435#### Example Output 436 437~~~~ 438empty region done=true 439after add rect done=false 440~~~~ 441 442</fiddle-embed></div> 443 444### See Also 445 446<a href='#SkRegion_Cliperator_next'>next</a> <a href='#SkRegion_Cliperator_rect'>rect</a> 447 448<a name='SkRegion_Cliperator_next'></a> 449 450--- 451 452<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 453void <a href='#SkRegion_Cliperator_next'>next()</a> 454</pre> 455 456Advances iterator to next <a href='SkIRect_Reference#SkIRect'>SkIRect</a> in <a href='SkRegion_Reference#SkRegion'>SkRegion</a> contained by clip. 457 458### Example 459 460<div><fiddle-embed name="3bbcc7eec19c808a8167bbcc987199f8"> 461 462#### Example Output 463 464~~~~ 465rect={1,3,3,4} 466rect={5,6,7,7} 467~~~~ 468 469</fiddle-embed></div> 470 471### See Also 472 473<a href='#SkRegion_Cliperator_done'>done</a> 474 475<a name='SkRegion_Cliperator_rect'></a> 476 477--- 478 479<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 480const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_Cliperator_rect'>rect()</a>const 481</pre> 482 483Returns <a href='SkIRect_Reference#SkIRect'>SkIRect</a> element in <a href='SkRegion_Reference#SkRegion'>SkRegion</a>, intersected with clip passed to 484<a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Cliperator'>Cliperator</a> constructor. Does not return predictable results if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 485is empty. 486 487### Return Value 488 489part of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> inside clip as <a href='SkIRect_Reference#SkIRect'>SkIRect</a> 490 491### Example 492 493<div><fiddle-embed name="05791751f00b4c2426093fa143b43bc7"> 494 495#### Example Output 496 497~~~~ 498#Volatile 499empty region rect={1094713344,1065353216,0,-1} 500after set rect rect={1,2,3,3} 501~~~~ 502 503</fiddle-embed></div> 504 505### See Also 506 507<a href='#SkRegion_Cliperator_next'>next</a> <a href='#SkRegion_Cliperator_done'>done</a> 508 509<a name='SkRegion_Spanerator'></a> 510 511--- 512 513<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 514 class <a href='#SkRegion_Spanerator'>Spanerator</a> { 515 public: 516 <a href='#SkRegion_Spanerator'>Spanerator</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>, int y, int left, int right); 517 bool <a href='#SkRegion_Spanerator_next'>next</a>(int* left, int* right); 518 }; 519</pre> 520 521Returns the <a href='undocumented#Line'>line</a> segment ends within <a href='SkRegion_Reference#Region'>Region</a> that intersect a horizontal <a href='undocumented#Line'>line</a>. 522 523<a name='SkRegion_Spanerator_const_SkRegion_int_int_int'></a> 524 525--- 526 527<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 528<a href='#SkRegion_Spanerator'>Spanerator</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>, int y, int left, int right) 529</pre> 530 531Sets <a href='SkRegion_Reference#SkRegion'>SkRegion</a>::<a href='#SkRegion_Spanerator'>Spanerator</a> to return <a href='undocumented#Line'>line</a> segments in <a href='SkRegion_Reference#SkRegion'>SkRegion</a> on scan <a href='undocumented#Line'>line</a>. 532 533### Parameters 534 535<table> <tr> <td><a name='SkRegion_Spanerator_const_SkRegion_int_int_int_region'><code><strong>region</strong></code></a></td> 536 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to iterate</td> 537 </tr> 538 <tr> <td><a name='SkRegion_Spanerator_const_SkRegion_int_int_int_y'><code><strong>y</strong></code></a></td> 539 <td>horizontal <a href='undocumented#Line'>line</a> to intersect</td> 540 </tr> 541 <tr> <td><a name='SkRegion_Spanerator_const_SkRegion_int_int_int_left'><code><strong>left</strong></code></a></td> 542 <td>bounds of iteration</td> 543 </tr> 544 <tr> <td><a name='SkRegion_Spanerator_const_SkRegion_int_int_int_right'><code><strong>right</strong></code></a></td> 545 <td>bounds of iteration</td> 546 </tr> 547</table> 548 549### Return Value 550 551<a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator 552 553### Example 554 555<div><fiddle-embed name="3073b3f8ea7252871b6156ff674dc385"></fiddle-embed></div> 556 557### See Also 558 559<a href='SkRegion_Reference#SkRegion'>SkRegion</a> <a href='#SkRegion_Iterator'>Iterator</a> <a href='#SkRegion_Cliperator'>Cliperator</a> 560 561<a name='SkRegion_Spanerator_next'></a> 562 563--- 564 565<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 566bool next(int* left, int* right) 567</pre> 568 569Advances iterator to next span intersecting <a href='SkRegion_Reference#SkRegion'>SkRegion</a> within <a href='undocumented#Line'>line</a> segment provided 570in constructor. Returns true if interval was found. 571 572### Parameters 573 574<table> <tr> <td><a name='SkRegion_Spanerator_next_left'><code><strong>left</strong></code></a></td> 575 <td>pointer to span start; may be nullptr</td> 576 </tr> 577 <tr> <td><a name='SkRegion_Spanerator_next_right'><code><strong>right</strong></code></a></td> 578 <td>pointer to span end; may be nullptr</td> 579 </tr> 580</table> 581 582### Return Value 583 584true if interval was found 585 586### Example 587 588<div><fiddle-embed name="03d02180fee5f64ec4a3347e118fb2ec"> 589 590#### Example Output 591 592~~~~ 593empty region: result=false 594after set rect: result=true left=2 right=3 595~~~~ 596 597</fiddle-embed></div> 598 599### See Also 600 601done 602 603<a name='SkRegion_empty_constructor'></a> 604 605--- 606 607<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 608<a href='#SkRegion_empty_constructor'>SkRegion()</a> 609</pre> 610 611Constructs an empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is set to empty bounds 612at (0, 0) with zero width and height. 613 614### Return Value 615 616empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 617 618### Example 619 620<div><fiddle-embed name="4549dcda3e0f9a41b3daee0ed37deca8"> 621 622#### Example Output 623 624~~~~ 625region bounds: {0, 0, 0, 0} 626~~~~ 627 628</fiddle-embed></div> 629 630### See Also 631 632<a href='#SkRegion_setEmpty'>setEmpty</a> 633 634<a name='SkRegion_copy_const_SkRegion'></a> 635 636--- 637 638<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 639<a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 640</pre> 641 642Constructs a copy of an existing <a href='#SkRegion_copy_const_SkRegion_region'>region</a>. 643Copy constructor makes two <a href='SkRegion_Reference#Region'>regions</a> identical by value. Internally, <a href='#SkRegion_copy_const_SkRegion_region'>region</a> and 644the returned result share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 645copied when modified. 646 647Creating a <a href='SkRegion_Reference#SkRegion'>SkRegion</a> copy is very efficient and never allocates memory. 648<a href='SkRegion_Reference#SkRegion'>SkRegion</a> are always copied by value from the interface; the underlying shared 649pointers are not exposed. 650 651### Parameters 652 653<table> <tr> <td><a name='SkRegion_copy_const_SkRegion_region'><code><strong>region</strong></code></a></td> 654 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to copy by value</td> 655 </tr> 656</table> 657 658### Return Value 659 660copy of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 661 662### Example 663 664<div><fiddle-embed name="3daa83fca809b9ec6560d2ef9e2da5e6"> 665 666#### Example Output 667 668~~~~ 669region bounds: {1,2,3,4} 670region2 bounds: {1,2,3,4} 671after region set empty: 672region bounds: {0,0,0,0} 673region2 bounds: {1,2,3,4} 674~~~~ 675 676</fiddle-embed></div> 677 678### See Also 679 680<a href='#SkRegion_setRegion'>setRegion</a> <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_copy_const_SkRegion_region'>region</a>) 681 682<a name='SkRegion_copy_const_SkIRect'></a> 683 684--- 685 686<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 687explicit <a href='#SkRegion_copy_const_SkIRect'>SkRegion</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) 688</pre> 689 690Constructs a rectangular <a href='SkRegion_Reference#SkRegion'>SkRegion</a> matching the bounds of <a href='#SkRegion_copy_const_SkIRect_rect'>rect</a>. 691 692### Parameters 693 694<table> <tr> <td><a name='SkRegion_copy_const_SkIRect_rect'><code><strong>rect</strong></code></a></td> 695 <td>bounds of constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a></td> 696 </tr> 697</table> 698 699### Return Value 700 701rectangular <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 702 703### Example 704 705<div><fiddle-embed name="5253910233f7961c30b4c18ab911e917"></fiddle-embed></div> 706 707### See Also 708 709<a href='#SkRegion_setRect'>setRect</a> <a href='#SkRegion_setRegion'>setRegion</a> 710 711<a name='SkRegion_destructor'></a> 712 713--- 714 715<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 716<a href='#SkRegion_destructor'>~SkRegion()</a> 717</pre> 718 719Releases ownership of any shared <a href='undocumented#Data'>data</a> and deletes <a href='undocumented#Data'>data</a> if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is sole owner. 720 721### Example 722 723<div><fiddle-embed name="985ff654a6b67288d322c748132a088e"><div>delete calls <a href='SkRegion_Reference#Region'>Region</a> destructor, but copy of original in region2 is unaffected. 724</div> 725 726#### Example Output 727 728~~~~ 729region2 bounds: {1,2,3,4} 730~~~~ 731 732</fiddle-embed></div> 733 734### See Also 735 736<a href='#SkRegion_empty_constructor'>SkRegion()</a> <a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) <a href='#SkRegion_copy_const_SkIRect'>SkRegion</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 737 738<a name='SkRegion_copy_operator'></a> 739 740--- 741 742<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 743<a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 744</pre> 745 746Constructs a copy of an existing <a href='#SkRegion_copy_operator_region'>region</a>. 747Makes two <a href='SkRegion_Reference#Region'>regions</a> identical by value. Internally, <a href='#SkRegion_copy_operator_region'>region</a> and 748the returned result share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 749copied when modified. 750 751Creating a <a href='SkRegion_Reference#SkRegion'>SkRegion</a> copy is very efficient and never allocates memory. 752<a href='SkRegion_Reference#SkRegion'>SkRegion</a> are always copied by value from the interface; the underlying shared 753pointers are not exposed. 754 755### Parameters 756 757<table> <tr> <td><a name='SkRegion_copy_operator_region'><code><strong>region</strong></code></a></td> 758 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to copy by value</td> 759 </tr> 760</table> 761 762### Return Value 763 764<a href='SkRegion_Reference#SkRegion'>SkRegion</a> to copy by value 765 766### Example 767 768<div><fiddle-embed name="e8513f6394c24efaa301d41921c5241a"> 769 770#### Example Output 771 772~~~~ 773region1 bounds: {1,2,3,4} 774region2 bounds: {1,2,3,4} 775~~~~ 776 777</fiddle-embed></div> 778 779### See Also 780 781<a href='#SkRegion_set'>set</a> <a href='#SkRegion_swap'>swap</a> <a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_copy_operator_region'>region</a>) 782 783<a name='SkRegion_equal1_operator'></a> 784 785--- 786 787<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 788bool operator==(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 789</pre> 790 791Compares <a href='SkRegion_Reference#SkRegion'>SkRegion</a> and <a href='#SkRegion_equal1_operator_other'>other</a>; returns true if they enclose exactly 792the same area. 793 794### Parameters 795 796<table> <tr> <td><a name='SkRegion_equal1_operator_other'><code><strong>other</strong></code></a></td> 797 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to compare</td> 798 </tr> 799</table> 800 801### Return Value 802 803true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> pair are equivalent 804 805### Example 806 807<div><fiddle-embed name="d7f4fdc8bc63ca8410ed166ecef0aef3"> 808 809#### Example Output 810 811~~~~ 812empty one == two 813set rect one != two 814set empty one == two 815~~~~ 816 817</fiddle-embed></div> 818 819### See Also 820 821<a href='#SkRegion_notequal1_operator'>operator!=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_equal1_operator_other'>other</a>) const <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 822 823<a name='SkRegion_notequal1_operator'></a> 824 825--- 826 827<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 828bool operator!=(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 829</pre> 830 831Compares <a href='SkRegion_Reference#SkRegion'>SkRegion</a> and <a href='#SkRegion_notequal1_operator_other'>other</a>; returns true if they do not enclose the same area. 832 833### Parameters 834 835<table> <tr> <td><a name='SkRegion_notequal1_operator_other'><code><strong>other</strong></code></a></td> 836 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to compare</td> 837 </tr> 838</table> 839 840### Return Value 841 842true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> pair are not equivalent 843 844### Example 845 846<div><fiddle-embed name="3357caa9d8d810f200cbccb668182496"> 847 848#### Example Output 849 850~~~~ 851empty one == two 852set rect one != two 853union rect one == two 854~~~~ 855 856</fiddle-embed></div> 857 858### See Also 859 860<a href='#SkRegion_equal1_operator'>operator==</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_notequal1_operator_other'>other</a>) const <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 861 862<a name='SkRegion_set'></a> 863 864--- 865 866<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 867bool set(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& src) 868</pre> 869 870Sets <a href='SkRegion_Reference#SkRegion'>SkRegion</a> to <a href='#SkRegion_set_src'>src</a>, and returns true if <a href='#SkRegion_set_src'>src</a> bounds is not empty. 871This makes <a href='SkRegion_Reference#SkRegion'>SkRegion</a> and <a href='#SkRegion_set_src'>src</a> identical by value. Internally, 872<a href='SkRegion_Reference#SkRegion'>SkRegion</a> and <a href='#SkRegion_set_src'>src</a> share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 873copied when modified. 874 875Creating a <a href='SkRegion_Reference#SkRegion'>SkRegion</a> copy is very efficient and never allocates memory. 876<a href='SkRegion_Reference#SkRegion'>SkRegion</a> are always copied by value from the interface; the underlying shared 877pointers are not exposed. 878 879### Parameters 880 881<table> <tr> <td><a name='SkRegion_set_src'><code><strong>src</strong></code></a></td> 882 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to copy</td> 883 </tr> 884</table> 885 886### Return Value 887 888copy of <a href='#SkRegion_set_src'>src</a> 889 890### Example 891 892<div><fiddle-embed name="b3538117c7ae2cb7de3b42ca45fe1b13"> 893 894#### Example Output 895 896~~~~ 897region1 bounds: {1,2,3,4} 898region2 bounds: {1,2,3,4} 899~~~~ 900 901</fiddle-embed></div> 902 903### See Also 904 905<a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) <a href='#SkRegion_swap'>swap</a> <a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 906 907<a name='SkRegion_swap'></a> 908 909--- 910 911<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 912void <a href='#SkRegion_swap'>swap</a>(<a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) 913</pre> 914 915Exchanges <a href='SkIRect_Reference#SkIRect'>SkIRect</a> array of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> and <a href='#SkRegion_swap_other'>other</a>. <a href='#SkRegion_swap'>swap()</a> internally exchanges pointers, 916so it is lightweight and does not allocate memory. 917 918<a href='#SkRegion_swap'>swap()</a> usage has largely been replaced by <a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>). 919<a href='SkPath_Reference#SkPath'>SkPath</a> do not copy their content on assignment until they are written to, 920making assignment as efficient as <a href='#SkRegion_swap'>swap()</a>. 921 922### Parameters 923 924<table> <tr> <td><a name='SkRegion_swap_other'><code><strong>other</strong></code></a></td> 925 <td><a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) set</td> 926 </tr> 927</table> 928 929### Example 930 931<div><fiddle-embed name="ae67b7b4c198b46c58e48f5af061c8f1"> 932 933#### Example Output 934 935~~~~ 936region1 bounds: {0,0,0,0} 937region2 bounds: {1,2,3,4} 938~~~~ 939 940</fiddle-embed></div> 941 942### See Also 943 944<a href='#SkRegion_copy_operator'>operator=</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) <a href='#SkRegion_set'>set</a> <a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 945 946<a name='SkRegion_isEmpty'></a> 947 948--- 949 950<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 951bool <a href='#SkRegion_isEmpty'>isEmpty</a>()const 952</pre> 953 954Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 955Empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a> has bounds width or height less than or equal to zero. 956<a href='#SkRegion_empty_constructor'>SkRegion()</a> constructs empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>; <a href='#SkRegion_setEmpty'>setEmpty</a>() 957and <a href='#SkRegion_setRect'>setRect</a>() with dimensionless <a href='undocumented#Data'>data</a> make <a href='SkRegion_Reference#SkRegion'>SkRegion</a> empty. 958 959### Return Value 960 961true if bounds has no width or height 962 963### Example 964 965<div><fiddle-embed name="10ef0de39e8553dd97cf8668ce185070"> 966 967#### Example Output 968 969~~~~ 970initial: region is empty 971set rect: region is not empty 972set empty: region is empty 973~~~~ 974 975</fiddle-embed></div> 976 977### See Also 978 979<a href='#SkRegion_isRect'>isRect</a> <a href='#SkRegion_isComplex'>isComplex</a> <a href='#SkRegion_equal1_operator'>operator==</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) const 980 981<a name='SkRegion_isRect'></a> 982 983--- 984 985<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 986bool <a href='#SkRegion_isRect'>isRect</a>()const 987</pre> 988 989Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is one <a href='SkIRect_Reference#SkIRect'>SkIRect</a> with positive dimensions. 990 991### Return Value 992 993true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> contains one <a href='SkIRect_Reference#SkIRect'>SkIRect</a> 994 995### Example 996 997<div><fiddle-embed name="b6adbdddf7fe45a1098121c4e5fd57ea"> 998 999#### Example Output 1000 1001~~~~ 1002initial: region is not rect 1003set rect: region is rect 1004set empty: region is not rect 1005~~~~ 1006 1007</fiddle-embed></div> 1008 1009### See Also 1010 1011<a href='#SkRegion_isEmpty'>isEmpty</a> <a href='#SkRegion_isComplex'>isComplex</a> 1012 1013<a name='SkRegion_isComplex'></a> 1014 1015--- 1016 1017<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1018bool <a href='#SkRegion_isComplex'>isComplex</a>()const 1019</pre> 1020 1021Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is described by more than one rectangle. 1022 1023### Return Value 1024 1025true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> contains more than one <a href='SkIRect_Reference#SkIRect'>SkIRect</a> 1026 1027### Example 1028 1029<div><fiddle-embed name="1fbd76d75ca2d280e81856311de4e54e"> 1030 1031#### Example Output 1032 1033~~~~ 1034initial: region is not complex 1035set rect: region is not complex 1036op rect: region is complex 1037~~~~ 1038 1039</fiddle-embed></div> 1040 1041### See Also 1042 1043<a href='#SkRegion_isEmpty'>isEmpty</a> <a href='#SkRegion_isRect'>isRect</a> 1044 1045<a name='SkRegion_getBounds'></a> 1046 1047--- 1048 1049<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1050const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_getBounds'>getBounds</a>()const 1051</pre> 1052 1053Returns minimum and maximum axes values of <a href='SkIRect_Reference#SkIRect'>SkIRect</a> array. 1054Returns (0, 0, 0, 0) if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1055 1056### Return Value 1057 1058combined bounds of all <a href='SkIRect_Reference#SkIRect'>SkIRect</a> elements 1059 1060### Example 1061 1062<div><fiddle-embed name="651632582d385d2531e7aa551c31e331"> 1063 1064#### Example Output 1065 1066~~~~ 1067bounds: {1,2,4,5} 1068~~~~ 1069 1070</fiddle-embed></div> 1071 1072### See Also 1073 1074<a href='#SkRegion_isEmpty'>isEmpty</a> <a href='#SkRegion_isRect'>isRect</a> 1075 1076<a name='SkRegion_computeRegionComplexity'></a> 1077 1078--- 1079 1080<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1081int <a href='#SkRegion_computeRegionComplexity'>computeRegionComplexity</a>()const 1082</pre> 1083 1084Returns a value that increases with the number of 1085elements in <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. Returns zero if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1086Returns one if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> equals <a href='SkIRect_Reference#SkIRect'>SkIRect</a>; otherwise, returns 1087value greater than one indicating that <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is complex. 1088 1089Call to compare <a href='SkRegion_Reference#SkRegion'>SkRegion</a> for relative complexity. 1090 1091### Return Value 1092 1093relative complexity 1094 1095### Example 1096 1097<div><fiddle-embed name="c4984fefdcecdd1090be160f80939d87"> 1098 1099#### Example Output 1100 1101~~~~ 1102initial: region complexity 0 1103set rect: region complexity 1 1104op rect: region complexity 3 1105~~~~ 1106 1107</fiddle-embed></div> 1108 1109### See Also 1110 1111<a href='#SkRegion_isRect'>isRect</a> <a href='#SkRegion_isComplex'>isComplex</a> 1112 1113<a name='SkRegion_getBoundaryPath'></a> 1114 1115--- 1116 1117<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1118bool <a href='#SkRegion_getBoundaryPath'>getBoundaryPath</a>(<a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>)const 1119</pre> 1120 1121Appends outline of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> to <a href='#SkRegion_getBoundaryPath_path'>path</a>. 1122Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty; otherwise, returns false, and leaves <a href='#SkRegion_getBoundaryPath_path'>path</a> 1123unmodified. 1124 1125### Parameters 1126 1127<table> <tr> <td><a name='SkRegion_getBoundaryPath_path'><code><strong>path</strong></code></a></td> 1128 <td><a href='SkPath_Reference#SkPath'>SkPath</a> to append to</td> 1129 </tr> 1130</table> 1131 1132### Return Value 1133 1134true if <a href='#SkRegion_getBoundaryPath_path'>path</a> changed 1135 1136### Example 1137 1138<div><fiddle-embed name="6631d36406efa3b3e27960c876421a7f"></fiddle-embed></div> 1139 1140### See Also 1141 1142<a href='#SkRegion_isEmpty'>isEmpty</a> <a href='#SkRegion_isComplex'>isComplex</a> 1143 1144<a name='SkRegion_setEmpty'></a> 1145 1146--- 1147 1148<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1149bool <a href='#SkRegion_setEmpty'>setEmpty</a>() 1150</pre> 1151 1152Constructs an empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is set to empty bounds 1153at (0, 0) with zero width and height. Always returns false. 1154 1155### Return Value 1156 1157false 1158 1159### Example 1160 1161<div><fiddle-embed name="1314f7250963775c5ee89cc5981eee24"> 1162 1163#### Example Output 1164 1165~~~~ 1166region bounds: {1,2,3,4} 1167after region set empty: 1168region bounds: {0,0,0,0} 1169~~~~ 1170 1171</fiddle-embed></div> 1172 1173### See Also 1174 1175<a href='#SkRegion_empty_constructor'>SkRegion()</a> 1176 1177<a name='SkRegion_setRect'></a> 1178 1179--- 1180 1181<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1182bool <a href='#SkRegion_setRect'>setRect</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) 1183</pre> 1184 1185Constructs a rectangular <a href='SkRegion_Reference#SkRegion'>SkRegion</a> matching the bounds of <a href='#SkRegion_setRect_rect'>rect</a>. 1186If <a href='#SkRegion_setRect_rect'>rect</a> is empty, constructs empty and returns false. 1187 1188### Parameters 1189 1190<table> <tr> <td><a name='SkRegion_setRect_rect'><code><strong>rect</strong></code></a></td> 1191 <td>bounds of constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a></td> 1192 </tr> 1193</table> 1194 1195### Return Value 1196 1197true if <a href='#SkRegion_setRect_rect'>rect</a> is not empty 1198 1199### Example 1200 1201<div><fiddle-embed name="e12575ffcd262f2364e0e6bece98a825"> 1202 1203#### Example Output 1204 1205~~~~ 1206region is not empty 1207region is empty 1208setEmpty: false 1209~~~~ 1210 1211</fiddle-embed></div> 1212 1213### See Also 1214 1215<a href='#SkRegion_copy_const_SkIRect'>SkRegion</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_setRect_rect'>rect</a>) 1216 1217<a name='SkRegion_setRect_2'></a> 1218 1219--- 1220 1221<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1222bool <a href='#SkRegion_setRect'>setRect</a>(int32_t left, int32_t top, int32_t right, int32_t bottom) 1223</pre> 1224 1225Constructs <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with bounds (<a href='#SkRegion_setRect_2_left'>left</a>, <a href='#SkRegion_setRect_2_top'>top</a>, <a href='#SkRegion_setRect_2_right'>right</a>, <a href='#SkRegion_setRect_2_bottom'>bottom</a>). 1226Returns true if <a href='#SkRegion_setRect_2_left'>left</a> is less than <a href='#SkRegion_setRect_2_right'>right</a> and <a href='#SkRegion_setRect_2_top'>top</a> is less than <a href='#SkRegion_setRect_2_bottom'>bottom</a>; otherwise, 1227constructs empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a> and returns false. 1228 1229### Parameters 1230 1231<table> <tr> <td><a name='SkRegion_setRect_2_left'><code><strong>left</strong></code></a></td> 1232 <td>edge of bounds on x-axis</td> 1233 </tr> 1234 <tr> <td><a name='SkRegion_setRect_2_top'><code><strong>top</strong></code></a></td> 1235 <td>edge of bounds on y-axis</td> 1236 </tr> 1237 <tr> <td><a name='SkRegion_setRect_2_right'><code><strong>right</strong></code></a></td> 1238 <td>edge of bounds on x-axis</td> 1239 </tr> 1240 <tr> <td><a name='SkRegion_setRect_2_bottom'><code><strong>bottom</strong></code></a></td> 1241 <td>edge of bounds on y-axis</td> 1242 </tr> 1243</table> 1244 1245### Return Value 1246 1247rectangular <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 1248 1249### Example 1250 1251<div><fiddle-embed name="5b31a1b077818a8150ad50f3b19e7bfe"> 1252 1253#### Example Output 1254 1255~~~~ 1256set to: 1,2,3,4: success:true {1,2,3,4} 1257set to: 3,2,1,4: success:false {0,0,0,0} 1258~~~~ 1259 1260</fiddle-embed></div> 1261 1262### See Also 1263 1264<a href='#SkRegion_copy_const_SkIRect'>SkRegion</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) 1265 1266<a name='SkRegion_setRects'></a> 1267 1268--- 1269 1270<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1271bool <a href='#SkRegion_setRects'>setRects</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='SkRect_Reference#Rect'>rects</a>[], int count) 1272</pre> 1273 1274Constructs <a href='SkRegion_Reference#SkRegion'>SkRegion</a> as the union of <a href='SkIRect_Reference#SkIRect'>SkIRect</a> in <a href='#SkRegion_setRects_rects'>rects</a> array. If <a href='#SkRegion_setRects_count'>count</a> is 1275zero, constructs empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. Returns false if constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1276 1277May be faster than repeated calls to <a href='#SkRegion_op'>op()</a>. 1278 1279### Parameters 1280 1281<table> <tr> <td><a name='SkRegion_setRects_rects'><code><strong>rects</strong></code></a></td> 1282 <td>array of <a href='SkIRect_Reference#SkIRect'>SkIRect</a></td> 1283 </tr> 1284 <tr> <td><a name='SkRegion_setRects_count'><code><strong>count</strong></code></a></td> 1285 <td>array <a href='undocumented#Size'>size</a></td> 1286 </tr> 1287</table> 1288 1289### Return Value 1290 1291true if constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty 1292 1293### Example 1294 1295<div><fiddle-embed name="fc793a14ed76c096a68a755c963c1ee0"></fiddle-embed></div> 1296 1297### See Also 1298 1299<a href='#SkRegion_setRect'>setRect</a> <a href='#SkRegion_op'>op</a> 1300 1301<a name='SkRegion_setRegion'></a> 1302 1303--- 1304 1305<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1306bool <a href='#SkRegion_setRegion'>setRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 1307</pre> 1308 1309Constructs a copy of an existing <a href='#SkRegion_setRegion_region'>region</a>. 1310Makes two <a href='SkRegion_Reference#Region'>regions</a> identical by value. Internally, <a href='#SkRegion_setRegion_region'>region</a> and 1311the returned result share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 1312copied when modified. 1313 1314Creating a <a href='SkRegion_Reference#SkRegion'>SkRegion</a> copy is very efficient and never allocates memory. 1315<a href='SkRegion_Reference#SkRegion'>SkRegion</a> are always copied by value from the interface; the underlying shared 1316pointers are not exposed. 1317 1318### Parameters 1319 1320<table> <tr> <td><a name='SkRegion_setRegion_region'><code><strong>region</strong></code></a></td> 1321 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to copy by value</td> 1322 </tr> 1323</table> 1324 1325### Return Value 1326 1327<a href='SkRegion_Reference#SkRegion'>SkRegion</a> to copy by value 1328 1329### Example 1330 1331<div><fiddle-embed name="5d75d22bd155576838155762ab040751"> 1332 1333#### Example Output 1334 1335~~~~ 1336region bounds: {1,2,3,4} 1337region2 bounds: {1,2,3,4} 1338after region set empty: 1339region bounds: {1,2,3,4} 1340region2 bounds: {0,0,0,0} 1341~~~~ 1342 1343</fiddle-embed></div> 1344 1345### See Also 1346 1347<a href='#SkRegion_copy_const_SkRegion'>SkRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='#SkRegion_setRegion_region'>region</a>) 1348 1349<a name='SkRegion_setPath'></a> 1350 1351--- 1352 1353<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1354bool <a href='#SkRegion_setPath'>setPath</a>(const <a href='SkPath_Reference#SkPath'>SkPath</a>& <a href='SkPath_Reference#Path'>path</a>, const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& clip) 1355</pre> 1356 1357Constructs <a href='SkRegion_Reference#SkRegion'>SkRegion</a> to match outline of <a href='#SkRegion_setPath_path'>path</a> within <a href='#SkRegion_setPath_clip'>clip</a>. 1358Returns false if constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1359 1360Constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> draws the same pixels as <a href='#SkRegion_setPath_path'>path</a> through <a href='#SkRegion_setPath_clip'>clip</a> when 1361<a href='SkPaint_Reference#Anti_Alias'>anti-aliasing</a> is disabled. 1362 1363### Parameters 1364 1365<table> <tr> <td><a name='SkRegion_setPath_path'><code><strong>path</strong></code></a></td> 1366 <td><a href='SkPath_Reference#SkPath'>SkPath</a> providing outline</td> 1367 </tr> 1368 <tr> <td><a name='SkRegion_setPath_clip'><code><strong>clip</strong></code></a></td> 1369 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> containing <a href='#SkRegion_setPath_path'>path</a></td> 1370 </tr> 1371</table> 1372 1373### Return Value 1374 1375true if constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty 1376 1377### Example 1378 1379<div><fiddle-embed name="45b9ea2247b9ca7f10aa22ea29a426f4"></fiddle-embed></div> 1380 1381### See Also 1382 1383<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_op'>op</a> 1384 1385<a name='SkRegion_intersects'></a> 1386 1387--- 1388 1389<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1390bool intersects(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>)const 1391</pre> 1392 1393Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> intersects <a href='#SkRegion_intersects_rect'>rect</a>. 1394Returns false if either <a href='#SkRegion_intersects_rect'>rect</a> or <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty, or do not intersect. 1395 1396### Parameters 1397 1398<table> <tr> <td><a name='SkRegion_intersects_rect'><code><strong>rect</strong></code></a></td> 1399 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> to intersect</td> 1400 </tr> 1401</table> 1402 1403### Return Value 1404 1405true if <a href='#SkRegion_intersects_rect'>rect</a> and <a href='SkRegion_Reference#SkRegion'>SkRegion</a> have area in common 1406 1407### Example 1408 1409<div><fiddle-embed name="42bde0ef8c2ee372751428cd6e21c1ca"></fiddle-embed></div> 1410 1411### See Also 1412 1413<a href='#SkRegion_contains'>contains</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_intersects'>intersects</a> 1414 1415<a name='SkRegion_intersects_2'></a> 1416 1417--- 1418 1419<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1420bool intersects(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 1421</pre> 1422 1423Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> intersects <a href='#SkRegion_intersects_2_other'>other</a>. 1424Returns false if either <a href='#SkRegion_intersects_2_other'>other</a> or <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty, or do not intersect. 1425 1426### Parameters 1427 1428<table> <tr> <td><a name='SkRegion_intersects_2_other'><code><strong>other</strong></code></a></td> 1429 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to intersect</td> 1430 </tr> 1431</table> 1432 1433### Return Value 1434 1435true if <a href='#SkRegion_intersects_2_other'>other</a> and <a href='SkRegion_Reference#SkRegion'>SkRegion</a> have area in common 1436 1437### Example 1438 1439<div><fiddle-embed name="4263d79ac0e7df02e90948fdde9fa965"></fiddle-embed></div> 1440 1441### See Also 1442 1443<a href='#SkRegion_contains'>contains</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_intersects'>intersects</a> 1444 1445<a name='SkRegion_contains'></a> 1446 1447--- 1448 1449<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1450bool contains(int32_t x, int32_t y)const 1451</pre> 1452 1453Returns true if <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a> (<a href='#SkRegion_contains_x'>x</a>, <a href='#SkRegion_contains_y'>y</a>) is inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 1454Returns false if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1455 1456### Parameters 1457 1458<table> <tr> <td><a name='SkRegion_contains_x'><code><strong>x</strong></code></a></td> 1459 <td>test <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a> x-coordinate</td> 1460 </tr> 1461 <tr> <td><a name='SkRegion_contains_y'><code><strong>y</strong></code></a></td> 1462 <td>test <a href='SkIPoint_Reference#SkIPoint'>SkIPoint</a> y-coordinate</td> 1463 </tr> 1464</table> 1465 1466### Return Value 1467 1468true if (<a href='#SkRegion_contains_x'>x</a>, <a href='#SkRegion_contains_y'>y</a>) is inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 1469 1470### Example 1471 1472<div><fiddle-embed name="e3899c2715c332bfc7648d5f2b9eefc6"></fiddle-embed></div> 1473 1474### See Also 1475 1476<a href='#SkRegion_intersects'>intersects</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_contains'>contains</a> 1477 1478<a name='SkRegion_contains_2'></a> 1479 1480--- 1481 1482<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1483bool contains(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& other)const 1484</pre> 1485 1486Returns true if <a href='#SkRegion_contains_2_other'>other</a> is completely inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 1487Returns false if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> or <a href='#SkRegion_contains_2_other'>other</a> is empty. 1488 1489### Parameters 1490 1491<table> <tr> <td><a name='SkRegion_contains_2_other'><code><strong>other</strong></code></a></td> 1492 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> to contain</td> 1493 </tr> 1494</table> 1495 1496### Return Value 1497 1498true if <a href='#SkRegion_contains_2_other'>other</a> is inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 1499 1500### Example 1501 1502<div><fiddle-embed name="100b4cbd5dd7406804e40035833a433c"></fiddle-embed></div> 1503 1504### See Also 1505 1506<a href='#SkRegion_intersects'>intersects</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_contains'>contains</a> 1507 1508<a name='SkRegion_contains_3'></a> 1509 1510--- 1511 1512<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1513bool contains(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 1514</pre> 1515 1516Returns true if <a href='#SkRegion_contains_3_other'>other</a> is completely inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 1517Returns false if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> or <a href='#SkRegion_contains_3_other'>other</a> is empty. 1518 1519### Parameters 1520 1521<table> <tr> <td><a name='SkRegion_contains_3_other'><code><strong>other</strong></code></a></td> 1522 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to contain</td> 1523 </tr> 1524</table> 1525 1526### Return Value 1527 1528true if <a href='#SkRegion_contains_3_other'>other</a> is inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 1529 1530### Example 1531 1532<div><fiddle-embed name="46de22da2f3e08a8d7f064634fc1c7b5"></fiddle-embed></div> 1533 1534### See Also 1535 1536<a href='#SkRegion_intersects'>intersects</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_contains'>contains</a> 1537 1538<a name='SkRegion_quickContains'></a> 1539 1540--- 1541 1542<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1543bool <a href='#SkRegion_quickContains'>quickContains</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& r)const 1544</pre> 1545 1546Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is a single rectangle and contains <a href='#SkRegion_quickContains_r'>r</a>. 1547May return false even though <a href='SkRegion_Reference#SkRegion'>SkRegion</a> contains <a href='#SkRegion_quickContains_r'>r</a>. 1548 1549### Parameters 1550 1551<table> <tr> <td><a name='SkRegion_quickContains_r'><code><strong>r</strong></code></a></td> 1552 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> to contain</td> 1553 </tr> 1554</table> 1555 1556### Return Value 1557 1558true quickly if <a href='#SkRegion_quickContains_r'>r</a> <a href='SkPoint_Reference#Point'>points</a> are equal or inside 1559 1560### Example 1561 1562<div><fiddle-embed name="d8e5eac373e2e7cfc1b8cd0229647ba6"> 1563 1564#### Example Output 1565 1566~~~~ 1567quickContains 1: true 1568quickContains 2: true 1569quickContains 3: false 1570~~~~ 1571 1572</fiddle-embed></div> 1573 1574### See Also 1575 1576<a href='#SkRegion_contains'>contains</a> <a href='#SkRegion_quickReject'>quickReject</a> <a href='#SkRegion_intersects'>intersects</a> 1577 1578<a name='SkRegion_quickContains_2'></a> 1579 1580--- 1581 1582<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1583bool <a href='#SkRegion_quickContains'>quickContains</a>(int32_t left, int32_t top, int32_t right, int32_t bottom)const 1584</pre> 1585 1586Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is a single rectangle and contains <a href='SkIRect_Reference#SkIRect'>SkIRect</a> 1587(<a href='#SkRegion_quickContains_2_left'>left</a>, <a href='#SkRegion_quickContains_2_top'>top</a>, <a href='#SkRegion_quickContains_2_right'>right</a>, <a href='#SkRegion_quickContains_2_bottom'>bottom</a>). 1588Returns false if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty or <a href='SkIRect_Reference#SkIRect'>SkIRect</a> (<a href='#SkRegion_quickContains_2_left'>left</a>, <a href='#SkRegion_quickContains_2_top'>top</a>, <a href='#SkRegion_quickContains_2_right'>right</a>, <a href='#SkRegion_quickContains_2_bottom'>bottom</a>) is empty. 1589May return false even though <a href='SkRegion_Reference#SkRegion'>SkRegion</a> contains (<a href='#SkRegion_quickContains_2_left'>left</a>, <a href='#SkRegion_quickContains_2_top'>top</a>, <a href='#SkRegion_quickContains_2_right'>right</a>, <a href='#SkRegion_quickContains_2_bottom'>bottom</a>). 1590 1591### Parameters 1592 1593<table> <tr> <td><a name='SkRegion_quickContains_2_left'><code><strong>left</strong></code></a></td> 1594 <td>edge of bounds on x-axis</td> 1595 </tr> 1596 <tr> <td><a name='SkRegion_quickContains_2_top'><code><strong>top</strong></code></a></td> 1597 <td>edge of bounds on y-axis</td> 1598 </tr> 1599 <tr> <td><a name='SkRegion_quickContains_2_right'><code><strong>right</strong></code></a></td> 1600 <td>edge of bounds on x-axis</td> 1601 </tr> 1602 <tr> <td><a name='SkRegion_quickContains_2_bottom'><code><strong>bottom</strong></code></a></td> 1603 <td>edge of bounds on y-axis</td> 1604 </tr> 1605</table> 1606 1607### Return Value 1608 1609true quickly if <a href='SkIRect_Reference#SkIRect'>SkIRect</a> are equal or inside 1610 1611### Example 1612 1613<div><fiddle-embed name="eb6d290887e1a3a0b051b4d7b012f5e1"> 1614 1615#### Example Output 1616 1617~~~~ 1618quickContains 1: true 1619quickContains 2: true 1620quickContains 3: false 1621~~~~ 1622 1623</fiddle-embed></div> 1624 1625### See Also 1626 1627<a href='#SkRegion_contains'>contains</a> <a href='#SkRegion_quickReject'>quickReject</a> <a href='#SkRegion_intersects'>intersects</a> 1628 1629<a name='SkRegion_quickReject'></a> 1630 1631--- 1632 1633<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1634bool <a href='#SkRegion_quickReject'>quickReject</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>)const 1635</pre> 1636 1637Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> does not intersect <a href='#SkRegion_quickReject_rect'>rect</a>. 1638Returns true if <a href='#SkRegion_quickReject_rect'>rect</a> is empty or <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1639May return false even though <a href='SkRegion_Reference#SkRegion'>SkRegion</a> does not intersect <a href='#SkRegion_quickReject_rect'>rect</a>. 1640 1641### Parameters 1642 1643<table> <tr> <td><a name='SkRegion_quickReject_rect'><code><strong>rect</strong></code></a></td> 1644 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> to intersect</td> 1645 </tr> 1646</table> 1647 1648### Return Value 1649 1650true if <a href='#SkRegion_quickReject_rect'>rect</a> does not intersect 1651 1652### Example 1653 1654<div><fiddle-embed name="71ac24b7d91ac5ca7c14b43930d5f85d"> 1655 1656#### Example Output 1657 1658~~~~ 1659quickReject 1: true 1660quickReject 2: true 1661quickReject 3: false 1662~~~~ 1663 1664</fiddle-embed></div> 1665 1666### See Also 1667 1668<a href='#SkRegion_quickContains'>quickContains</a> <a href='#SkRegion_contains'>contains</a> <a href='#SkRegion_intersects'>intersects</a> 1669 1670<a name='SkRegion_quickReject_2'></a> 1671 1672--- 1673 1674<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1675bool <a href='#SkRegion_quickReject'>quickReject</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn)const 1676</pre> 1677 1678Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> does not intersect <a href='#SkRegion_quickReject_2_rgn'>rgn</a>. 1679Returns true if <a href='#SkRegion_quickReject_2_rgn'>rgn</a> is empty or <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1680May return false even though <a href='SkRegion_Reference#SkRegion'>SkRegion</a> does not intersect <a href='#SkRegion_quickReject_2_rgn'>rgn</a>. 1681 1682### Parameters 1683 1684<table> <tr> <td><a name='SkRegion_quickReject_2_rgn'><code><strong>rgn</strong></code></a></td> 1685 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> to intersect</td> 1686 </tr> 1687</table> 1688 1689### Return Value 1690 1691true if <a href='#SkRegion_quickReject_2_rgn'>rgn</a> does not intersect 1692 1693### Example 1694 1695<div><fiddle-embed name="def7dba38947c33b203e4f9db6c88be3"> 1696 1697#### Example Output 1698 1699~~~~ 1700quickReject 1: true 1701quickReject 2: true 1702quickReject 3: false 1703~~~~ 1704 1705</fiddle-embed></div> 1706 1707### See Also 1708 1709<a href='#SkRegion_quickContains'>quickContains</a> <a href='#SkRegion_contains'>contains</a> <a href='#SkRegion_intersects'>intersects</a> 1710 1711<a name='SkRegion_translate'></a> 1712 1713--- 1714 1715<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1716void translate(int dx, int dy) 1717</pre> 1718 1719Offsets <a href='SkRegion_Reference#SkRegion'>SkRegion</a> by <a href='SkIPoint_Reference#IVector'>ivector</a> (<a href='#SkRegion_translate_dx'>dx</a>, <a href='#SkRegion_translate_dy'>dy</a>). Has no effect if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1720 1721### Parameters 1722 1723<table> <tr> <td><a name='SkRegion_translate_dx'><code><strong>dx</strong></code></a></td> 1724 <td>x-axis offset</td> 1725 </tr> 1726 <tr> <td><a name='SkRegion_translate_dy'><code><strong>dy</strong></code></a></td> 1727 <td>y-axis offset</td> 1728 </tr> 1729</table> 1730 1731### Example 1732 1733<div><fiddle-embed name="4e5b9e53aa1b200fed3ee6596ca01f0e"></fiddle-embed></div> 1734 1735### See Also 1736 1737<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_translate'>translate</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_offset'>offset</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_offset'>offset</a> 1738 1739<a name='SkRegion_translate_2'></a> 1740 1741--- 1742 1743<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1744void translate(int dx, int dy, <a href='SkRegion_Reference#SkRegion'>SkRegion</a>* dst)const 1745</pre> 1746 1747Offsets <a href='SkRegion_Reference#SkRegion'>SkRegion</a> by <a href='SkIPoint_Reference#IVector'>ivector</a> (<a href='#SkRegion_translate_2_dx'>dx</a>, <a href='#SkRegion_translate_2_dy'>dy</a>), writing result to <a href='#SkRegion_translate_2_dst'>dst</a>. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> may be passed 1748as <a href='#SkRegion_translate_2_dst'>dst</a> parameter, translating <a href='SkRegion_Reference#SkRegion'>SkRegion</a> in place. Has no effect if <a href='#SkRegion_translate_2_dst'>dst</a> is nullptr. 1749If <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty, sets <a href='#SkRegion_translate_2_dst'>dst</a> to empty. 1750 1751### Parameters 1752 1753<table> <tr> <td><a name='SkRegion_translate_2_dx'><code><strong>dx</strong></code></a></td> 1754 <td>x-axis offset</td> 1755 </tr> 1756 <tr> <td><a name='SkRegion_translate_2_dy'><code><strong>dy</strong></code></a></td> 1757 <td>y-axis offset</td> 1758 </tr> 1759 <tr> <td><a name='SkRegion_translate_2_dst'><code><strong>dst</strong></code></a></td> 1760 <td>translated result</td> 1761 </tr> 1762</table> 1763 1764### Example 1765 1766<div><fiddle-embed name="024200960eb52fee1f471514607e6001"></fiddle-embed></div> 1767 1768### See Also 1769 1770<a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_translate'>translate</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_offset'>offset</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_offset'>offset</a> 1771 1772<a name='SkRegion_Op'></a> 1773 1774--- 1775 1776<pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 1777 enum <a href='#SkRegion_Op'>Op</a> { 1778 <a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, 1779 <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, 1780 <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, 1781 <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, 1782 <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 1783 <a href='#SkRegion_kReplace_Op'>kReplace_Op</a>, 1784 <a href='#SkRegion_kLastOp'>kLastOp</a> = <a href='#SkRegion_kReplace_Op'>kReplace_Op</a>, 1785 }; 1786</pre> 1787 1788The logical operations that can be performed when combining two <a href='SkRegion_Reference#Region'>Regions</a>. 1789 1790### Constants 1791 1792<table style='border-collapse: collapse; width: 62.5em'> 1793 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 1794<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 1795<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 1796 <tr style='background-color: #f0f0f0; '> 1797 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kDifference_Op'><code>SkRegion::kDifference_Op</code></a></td> 1798 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 1799 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1800Subtracts operand <a href='SkRegion_Reference#Region'>Region</a> from target <a href='SkRegion_Reference#Region'>Region</a>. 1801</td> 1802 </tr> 1803 <tr> 1804 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kIntersect_Op'><code>SkRegion::kIntersect_Op</code></a></td> 1805 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 1806 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1807Intersects operand <a href='SkRegion_Reference#Region'>Region</a> and target <a href='SkRegion_Reference#Region'>Region</a>. 1808</td> 1809 </tr> 1810 <tr style='background-color: #f0f0f0; '> 1811 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kUnion_Op'><code>SkRegion::kUnion_Op</code></a></td> 1812 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 1813 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1814Unions operand <a href='SkRegion_Reference#Region'>Region</a> and target <a href='SkRegion_Reference#Region'>Region</a>. 1815</td> 1816 </tr> 1817 <tr> 1818 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kXOR_Op'><code>SkRegion::kXOR_Op</code></a></td> 1819 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 1820 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1821Replaces target <a href='SkRegion_Reference#Region'>Region</a> with area exclusive to both <a href='SkRegion_Reference#Region'>Regions</a>. 1822</td> 1823 </tr> 1824 <tr style='background-color: #f0f0f0; '> 1825 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kReverseDifference_Op'><code>SkRegion::kReverseDifference_Op</code></a></td> 1826 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>4</td> 1827 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1828Subtracts target <a href='SkRegion_Reference#Region'>Region</a> from operand <a href='SkRegion_Reference#Region'>Region</a>. 1829</td> 1830 </tr> 1831 <tr> 1832 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kReplace_Op'><code>SkRegion::kReplace_Op</code></a></td> 1833 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>5</td> 1834 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1835Replaces target <a href='SkRegion_Reference#Region'>Region</a> with operand <a href='SkRegion_Reference#Region'>Region</a>. 1836</td> 1837 </tr> 1838 <tr style='background-color: #f0f0f0; '> 1839 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kLastOp'><code>SkRegion::kLastOp</code></a></td> 1840 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>5</td> 1841 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1842last operator</td> 1843 </tr> 1844</table> 1845 1846### Example 1847 1848<div><fiddle-embed name="026dd8b180fe8e43f477fce43e9217b3"></fiddle-embed></div> 1849 1850### See Also 1851 1852<a href='undocumented#SkPathOp'>SkPathOp</a> 1853 1854### Constants 1855 1856<table style='border-collapse: collapse; width: 62.5em'> 1857 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 1858<th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 1859<th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 1860 <tr style='background-color: #f0f0f0; '> 1861 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRegion_kOpCnt'><code>SkRegion::kOpCnt</code></a></td> 1862 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>6</td> 1863 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1864May be used to verify that <a href='#SkRegion_Op'>Op</a> is a legal value.</td> 1865 </tr> 1866</table> 1867 1868<a name='SkRegion_op'></a> 1869 1870--- 1871 1872<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1873bool <a href='#SkRegion_op'>op</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='#SkRegion_Op'>Op</a> op) 1874</pre> 1875 1876Replaces <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with the result of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> <a href='#SkRegion_op_op'>op</a> <a href='#SkRegion_op_rect'>rect</a>. 1877Returns true if replaced <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty. 1878 1879### Parameters 1880 1881<table> <tr> <td><a name='SkRegion_op_rect'><code><strong>rect</strong></code></a></td> 1882 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> operand</td> 1883 </tr> 1884 <tr> <td><a name='SkRegion_op_op'><code><strong>op</strong></code></a></td> 1885 <td>operator, one of:</td> 1886 </tr> 1887</table> 1888 1889<a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 1890<a href='#SkRegion_kReplace_Op'>kReplace_Op</a> 1891 1892### Return Value 1893 1894false if result is empty 1895 1896### Example 1897 1898<div><fiddle-embed name="1790b2e054c536a54601138365700ac3"></fiddle-embed></div> 1899 1900### See Also 1901 1902<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_Op'>Op</a> 1903 1904<a name='SkRegion_op_2'></a> 1905 1906--- 1907 1908<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1909bool <a href='#SkRegion_op'>op</a>(int left, int top, int right, int bottom, <a href='#SkRegion_Op'>Op</a> op) 1910</pre> 1911 1912Replaces <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with the result of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> <a href='#SkRegion_op_2_op'>op</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a> (<a href='#SkRegion_op_2_left'>left</a>, <a href='#SkRegion_op_2_top'>top</a>, <a href='#SkRegion_op_2_right'>right</a>, <a href='#SkRegion_op_2_bottom'>bottom</a>). 1913Returns true if replaced <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty. 1914 1915### Parameters 1916 1917<table> <tr> <td><a name='SkRegion_op_2_left'><code><strong>left</strong></code></a></td> 1918 <td>edge of bounds on x-axis</td> 1919 </tr> 1920 <tr> <td><a name='SkRegion_op_2_top'><code><strong>top</strong></code></a></td> 1921 <td>edge of bounds on y-axis</td> 1922 </tr> 1923 <tr> <td><a name='SkRegion_op_2_right'><code><strong>right</strong></code></a></td> 1924 <td>edge of bounds on x-axis</td> 1925 </tr> 1926 <tr> <td><a name='SkRegion_op_2_bottom'><code><strong>bottom</strong></code></a></td> 1927 <td>edge of bounds on y-axis</td> 1928 </tr> 1929 <tr> <td><a name='SkRegion_op_2_op'><code><strong>op</strong></code></a></td> 1930 <td>operator, one of:</td> 1931 </tr> 1932</table> 1933 1934<a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 1935<a href='#SkRegion_kReplace_Op'>kReplace_Op</a> 1936 1937### Return Value 1938 1939false if result is empty 1940 1941### Example 1942 1943<div><fiddle-embed name="2e3497890d523235f96680716c321098"></fiddle-embed></div> 1944 1945### See Also 1946 1947<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_Op'>Op</a> 1948 1949<a name='SkRegion_op_3'></a> 1950 1951--- 1952 1953<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1954bool <a href='#SkRegion_op'>op</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn, <a href='#SkRegion_Op'>Op</a> op) 1955</pre> 1956 1957Replaces <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with the result of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> <a href='#SkRegion_op_3_op'>op</a> <a href='#SkRegion_op_3_rgn'>rgn</a>. 1958Returns true if replaced <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty. 1959 1960### Parameters 1961 1962<table> <tr> <td><a name='SkRegion_op_3_rgn'><code><strong>rgn</strong></code></a></td> 1963 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> operand</td> 1964 </tr> 1965 <tr> <td><a name='SkRegion_op_3_op'><code><strong>op</strong></code></a></td> 1966 <td>operator, one of:</td> 1967 </tr> 1968</table> 1969 1970<a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 1971<a href='#SkRegion_kReplace_Op'>kReplace_Op</a> 1972 1973### Return Value 1974 1975false if result is empty 1976 1977### Example 1978 1979<div><fiddle-embed name="65f4eccea3514ed7e37b5067e15efddb"></fiddle-embed></div> 1980 1981### See Also 1982 1983<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_Op'>Op</a> 1984 1985<a name='SkRegion_op_4'></a> 1986 1987--- 1988 1989<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1990bool <a href='#SkRegion_op'>op</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn, <a href='#SkRegion_Op'>Op</a> op) 1991</pre> 1992 1993Replaces <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with the result of <a href='#SkRegion_op_4_rect'>rect</a> <a href='#SkRegion_op_4_op'>op</a> <a href='#SkRegion_op_4_rgn'>rgn</a>. 1994Returns true if replaced <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty. 1995 1996### Parameters 1997 1998<table> <tr> <td><a name='SkRegion_op_4_rect'><code><strong>rect</strong></code></a></td> 1999 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> operand</td> 2000 </tr> 2001 <tr> <td><a name='SkRegion_op_4_rgn'><code><strong>rgn</strong></code></a></td> 2002 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> operand</td> 2003 </tr> 2004 <tr> <td><a name='SkRegion_op_4_op'><code><strong>op</strong></code></a></td> 2005 <td>operator, one of:</td> 2006 </tr> 2007</table> 2008 2009<a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 2010<a href='#SkRegion_kReplace_Op'>kReplace_Op</a> 2011 2012### Return Value 2013 2014false if result is empty 2015 2016### Example 2017 2018<div><fiddle-embed name="3f964be1e1fd2fbb977b655d3a928f0a"></fiddle-embed></div> 2019 2020### See Also 2021 2022<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_Op'>Op</a> 2023 2024<a name='SkRegion_op_5'></a> 2025 2026--- 2027 2028<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2029bool <a href='#SkRegion_op'>op</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn, const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='#SkRegion_Op'>Op</a> op) 2030</pre> 2031 2032Replaces <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with the result of <a href='#SkRegion_op_5_rgn'>rgn</a> <a href='#SkRegion_op_5_op'>op</a> <a href='#SkRegion_op_5_rect'>rect</a>. 2033Returns true if replaced <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty. 2034 2035### Parameters 2036 2037<table> <tr> <td><a name='SkRegion_op_5_rgn'><code><strong>rgn</strong></code></a></td> 2038 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> operand</td> 2039 </tr> 2040 <tr> <td><a name='SkRegion_op_5_rect'><code><strong>rect</strong></code></a></td> 2041 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> operand</td> 2042 </tr> 2043 <tr> <td><a name='SkRegion_op_5_op'><code><strong>op</strong></code></a></td> 2044 <td>operator, one of:</td> 2045 </tr> 2046</table> 2047 2048<a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 2049<a href='#SkRegion_kReplace_Op'>kReplace_Op</a> 2050 2051### Return Value 2052 2053false if result is empty 2054 2055### Example 2056 2057<div><fiddle-embed name="e623208dd44f0b24499ac5f1593d1b39"></fiddle-embed></div> 2058 2059### See Also 2060 2061<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_Op'>Op</a> 2062 2063<a name='SkRegion_op_6'></a> 2064 2065--- 2066 2067<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2068bool <a href='#SkRegion_op'>op</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgna, const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgnb, <a href='#SkRegion_Op'>Op</a> op) 2069</pre> 2070 2071Replaces <a href='SkRegion_Reference#SkRegion'>SkRegion</a> with the result of <a href='#SkRegion_op_6_rgna'>rgna</a> <a href='#SkRegion_op_6_op'>op</a> <a href='#SkRegion_op_6_rgnb'>rgnb</a>. 2072Returns true if replaced <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty. 2073 2074### Parameters 2075 2076<table> <tr> <td><a name='SkRegion_op_6_rgna'><code><strong>rgna</strong></code></a></td> 2077 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> operand</td> 2078 </tr> 2079 <tr> <td><a name='SkRegion_op_6_rgnb'><code><strong>rgnb</strong></code></a></td> 2080 <td><a href='SkRegion_Reference#SkRegion'>SkRegion</a> operand</td> 2081 </tr> 2082 <tr> <td><a name='SkRegion_op_6_op'><code><strong>op</strong></code></a></td> 2083 <td>operator, one of:</td> 2084 </tr> 2085</table> 2086 2087<a href='#SkRegion_kDifference_Op'>kDifference_Op</a>, <a href='#SkRegion_kIntersect_Op'>kIntersect_Op</a>, <a href='#SkRegion_kUnion_Op'>kUnion_Op</a>, <a href='#SkRegion_kXOR_Op'>kXOR_Op</a>, <a href='#SkRegion_kReverseDifference_Op'>kReverseDifference_Op</a>, 2088<a href='#SkRegion_kReplace_Op'>kReplace_Op</a> 2089 2090### Return Value 2091 2092false if result is empty 2093 2094### Example 2095 2096<div><fiddle-embed name="13de1a6fcb2302a2a30278cb88d3e17d"></fiddle-embed></div> 2097 2098### See Also 2099 2100<a href='#SkRegion_setRects'>setRects</a> <a href='#SkRegion_Op'>Op</a> 2101 2102<a name='SkRegion_writeToMemory'></a> 2103 2104--- 2105 2106<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2107size_t <a href='#SkRegion_writeToMemory'>writeToMemory</a>(void* buffer)const 2108</pre> 2109 2110Writes <a href='SkRegion_Reference#SkRegion'>SkRegion</a> to <a href='#SkRegion_writeToMemory_buffer'>buffer</a>, and returns number of bytes written. 2111If <a href='#SkRegion_writeToMemory_buffer'>buffer</a> is nullptr, returns number number of bytes that would be written. 2112 2113### Parameters 2114 2115<table> <tr> <td><a name='SkRegion_writeToMemory_buffer'><code><strong>buffer</strong></code></a></td> 2116 <td>storage for binary <a href='undocumented#Data'>data</a></td> 2117 </tr> 2118</table> 2119 2120### Return Value 2121 2122<a href='undocumented#Size'>size</a> of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 2123 2124### Example 2125 2126<div><fiddle-embed name="1419d2a8c22c355ab46240865d056ee5"></fiddle-embed></div> 2127 2128### See Also 2129 2130<a href='#SkRegion_readFromMemory'>readFromMemory</a> 2131 2132<a name='SkRegion_readFromMemory'></a> 2133 2134--- 2135 2136<pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2137size_t <a href='#SkRegion_readFromMemory'>readFromMemory</a>(const void* buffer, size_t length) 2138</pre> 2139 2140Constructs <a href='SkRegion_Reference#SkRegion'>SkRegion</a> from <a href='#SkRegion_readFromMemory_buffer'>buffer</a> of <a href='undocumented#Size'>size</a> <a href='#SkRegion_readFromMemory_length'>length</a>. Returns bytes read. 2141Returned value will be multiple of four or zero if <a href='#SkRegion_readFromMemory_length'>length</a> was too small. 2142 2143### Parameters 2144 2145<table> <tr> <td><a name='SkRegion_readFromMemory_buffer'><code><strong>buffer</strong></code></a></td> 2146 <td>storage for binary <a href='undocumented#Data'>data</a></td> 2147 </tr> 2148 <tr> <td><a name='SkRegion_readFromMemory_length'><code><strong>length</strong></code></a></td> 2149 <td><a href='undocumented#Size'>size</a> of <a href='#SkRegion_readFromMemory_buffer'>buffer</a></td> 2150 </tr> 2151</table> 2152 2153### Return Value 2154 2155bytes read 2156 2157### Example 2158 2159<div><fiddle-embed name="1ede346c430ef23df0eaaf0773dd6a15"></fiddle-embed></div> 2160 2161### See Also 2162 2163<a href='#SkRegion_writeToMemory'>writeToMemory</a> 2164 2165