1 SkRegion 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 4 on 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> 10 in <a href='SkPath_Reference#Path'>Path</a> become integer rectangle edges. <a href='SkRegion_Reference#Region'>Regions</a> operators compute union, 11 intersection, difference, and so on. <a href='SkCanvas_Reference#Canvas'>Canvas</a> allows only intersection and 12 difference; 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"> 19 class <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, 79 efficiently storing a single integer rectangle, or a run length encoded array 80 of rectangles. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> may reduce the current <a href='#Canvas_Clip'>Canvas_Clip</a>, or may be drawn as 81 one or more integer rectangles. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator returns the scan <a href='undocumented#Line'>lines</a> or 82 rectangles 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 102 Returns sequence of rectangles, sorted along y-axis, then x-axis, that make 103 up <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 113 Initializes <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> 114 returns true. 115 Call <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 119 empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a> iterator 120 121 ### Example 122 123 <div><fiddle-embed name="a2db43ee3cbf6893e9b23927fb44298a"> 124 125 #### Example Output 126 127 ~~~~ 128 rect={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 145 Sets <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 ~~~~ 165 rect={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"> 179 bool <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>. 183 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> was set; otherwise, returns false. 184 185 ### Return Value 186 187 true 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 197 empty iter rewind success=false 198 empty iter rect={0,0,0,0} 199 empty region rewind success=true 200 empty region rect={0,0,0,0} 201 after set rect rect={1,2,3,4} 202 after rewind rewind success=true 203 after 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"> 217 void reset(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 218 </pre> 219 220 Resets 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 ~~~~ 236 empty region: done=true 237 after set rect: done=true 238 after 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"> 252 bool <a href='#SkRegion_Iterator_done'>done()</a>const 253 </pre> 254 255 Returns 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 259 true 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 ~~~~ 268 done=true 269 done=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"> 283 void <a href='#SkRegion_Iterator_next'>next()</a> 284 </pre> 285 286 Advances <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 ~~~~ 295 rect={1,2,3,4} 296 rect={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"> 310 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_Iterator_rect'>rect()</a>const 311 </pre> 312 313 Returns <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> 314 is empty. 315 316 ### Return Value 317 318 part 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 328 rect={0,0,0,0} 329 rect={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"> 343 const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>* <a href='#SkRegion_Iterator_rgn'>rgn()</a>const 344 </pre> 345 346 Returns <a href='SkRegion_Reference#SkRegion'>SkRegion</a> if set; otherwise, returns nullptr. 347 348 ### Return Value 349 350 iterated <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 374 Returns the sequence of rectangles, sorted along y-axis, then x-axis, that make 375 up <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 385 Sets <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 ~~~~ 408 rect={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"> 422 bool <a href='#SkRegion_Cliperator_done'>done()</a> 423 </pre> 424 425 Returns 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 429 true 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 ~~~~ 438 empty region done=true 439 after 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"> 453 void <a href='#SkRegion_Cliperator_next'>next()</a> 454 </pre> 455 456 Advances 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 ~~~~ 465 rect={1,3,3,4} 466 rect={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"> 480 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_Cliperator_rect'>rect()</a>const 481 </pre> 482 483 Returns <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> 485 is empty. 486 487 ### Return Value 488 489 part 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 499 empty region rect={1094713344,1065353216,0,-1} 500 after 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 521 Returns 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 531 Sets <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"> 566 bool next(int* left, int* right) 567 </pre> 568 569 Advances iterator to next span intersecting <a href='SkRegion_Reference#SkRegion'>SkRegion</a> within <a href='undocumented#Line'>line</a> segment provided 570 in 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 584 true if interval was found 585 586 ### Example 587 588 <div><fiddle-embed name="03d02180fee5f64ec4a3347e118fb2ec"> 589 590 #### Example Output 591 592 ~~~~ 593 empty region: result=false 594 after set rect: result=true left=2 right=3 595 ~~~~ 596 597 </fiddle-embed></div> 598 599 ### See Also 600 601 done 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 611 Constructs an empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is set to empty bounds 612 at (0, 0) with zero width and height. 613 614 ### Return Value 615 616 empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 617 618 ### Example 619 620 <div><fiddle-embed name="4549dcda3e0f9a41b3daee0ed37deca8"> 621 622 #### Example Output 623 624 ~~~~ 625 region 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 642 Constructs a copy of an existing <a href='#SkRegion_copy_const_SkRegion_region'>region</a>. 643 Copy constructor makes two <a href='SkRegion_Reference#Region'>regions</a> identical by value. Internally, <a href='#SkRegion_copy_const_SkRegion_region'>region</a> and 644 the returned result share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 645 copied when modified. 646 647 Creating 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 649 pointers 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 660 copy of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 661 662 ### Example 663 664 <div><fiddle-embed name="3daa83fca809b9ec6560d2ef9e2da5e6"> 665 666 #### Example Output 667 668 ~~~~ 669 region bounds: {1,2,3,4} 670 region2 bounds: {1,2,3,4} 671 after region set empty: 672 region bounds: {0,0,0,0} 673 region2 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"> 687 explicit <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 690 Constructs 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 701 rectangular <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 719 Releases 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 ~~~~ 729 region2 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 746 Constructs a copy of an existing <a href='#SkRegion_copy_operator_region'>region</a>. 747 Makes two <a href='SkRegion_Reference#Region'>regions</a> identical by value. Internally, <a href='#SkRegion_copy_operator_region'>region</a> and 748 the returned result share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 749 copied when modified. 750 751 Creating 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 753 pointers 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 ~~~~ 773 region1 bounds: {1,2,3,4} 774 region2 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"> 788 bool operator==(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 789 </pre> 790 791 Compares <a href='SkRegion_Reference#SkRegion'>SkRegion</a> and <a href='#SkRegion_equal1_operator_other'>other</a>; returns true if they enclose exactly 792 the 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 803 true 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 ~~~~ 812 empty one == two 813 set rect one != two 814 set 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"> 828 bool operator!=(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 829 </pre> 830 831 Compares <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 842 true 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 ~~~~ 851 empty one == two 852 set rect one != two 853 union 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"> 867 bool set(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& src) 868 </pre> 869 870 Sets <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. 871 This 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 873 copied when modified. 874 875 Creating 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 877 pointers 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 888 copy of <a href='#SkRegion_set_src'>src</a> 889 890 ### Example 891 892 <div><fiddle-embed name="b3538117c7ae2cb7de3b42ca45fe1b13"> 893 894 #### Example Output 895 896 ~~~~ 897 region1 bounds: {1,2,3,4} 898 region2 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"> 912 void <a href='#SkRegion_swap'>swap</a>(<a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other) 913 </pre> 914 915 Exchanges <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, 916 so 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, 920 making 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 ~~~~ 936 region1 bounds: {0,0,0,0} 937 region2 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"> 951 bool <a href='#SkRegion_isEmpty'>isEmpty</a>()const 952 </pre> 953 954 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 955 Empty <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>() 957 and <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 961 true if bounds has no width or height 962 963 ### Example 964 965 <div><fiddle-embed name="10ef0de39e8553dd97cf8668ce185070"> 966 967 #### Example Output 968 969 ~~~~ 970 initial: region is empty 971 set rect: region is not empty 972 set 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"> 986 bool <a href='#SkRegion_isRect'>isRect</a>()const 987 </pre> 988 989 Returns 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 993 true 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 ~~~~ 1002 initial: region is not rect 1003 set rect: region is rect 1004 set 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"> 1018 bool <a href='#SkRegion_isComplex'>isComplex</a>()const 1019 </pre> 1020 1021 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is described by more than one rectangle. 1022 1023 ### Return Value 1024 1025 true 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 ~~~~ 1034 initial: region is not complex 1035 set rect: region is not complex 1036 op 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"> 1050 const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='#SkRegion_getBounds'>getBounds</a>()const 1051 </pre> 1052 1053 Returns minimum and maximum axes values of <a href='SkIRect_Reference#SkIRect'>SkIRect</a> array. 1054 Returns (0, 0, 0, 0) if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1055 1056 ### Return Value 1057 1058 combined 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 ~~~~ 1067 bounds: {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"> 1081 int <a href='#SkRegion_computeRegionComplexity'>computeRegionComplexity</a>()const 1082 </pre> 1083 1084 Returns a value that increases with the number of 1085 elements in <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. Returns zero if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1086 Returns one if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> equals <a href='SkIRect_Reference#SkIRect'>SkIRect</a>; otherwise, returns 1087 value greater than one indicating that <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is complex. 1088 1089 Call to compare <a href='SkRegion_Reference#SkRegion'>SkRegion</a> for relative complexity. 1090 1091 ### Return Value 1092 1093 relative complexity 1094 1095 ### Example 1096 1097 <div><fiddle-embed name="c4984fefdcecdd1090be160f80939d87"> 1098 1099 #### Example Output 1100 1101 ~~~~ 1102 initial: region complexity 0 1103 set rect: region complexity 1 1104 op 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"> 1118 bool <a href='#SkRegion_getBoundaryPath'>getBoundaryPath</a>(<a href='SkPath_Reference#SkPath'>SkPath</a>* <a href='SkPath_Reference#Path'>path</a>)const 1119 </pre> 1120 1121 Appends outline of <a href='SkRegion_Reference#SkRegion'>SkRegion</a> to <a href='#SkRegion_getBoundaryPath_path'>path</a>. 1122 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is not empty; otherwise, returns false, and leaves <a href='#SkRegion_getBoundaryPath_path'>path</a> 1123 unmodified. 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 1134 true 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"> 1149 bool <a href='#SkRegion_setEmpty'>setEmpty</a>() 1150 </pre> 1151 1152 Constructs an empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is set to empty bounds 1153 at (0, 0) with zero width and height. Always returns false. 1154 1155 ### Return Value 1156 1157 false 1158 1159 ### Example 1160 1161 <div><fiddle-embed name="1314f7250963775c5ee89cc5981eee24"> 1162 1163 #### Example Output 1164 1165 ~~~~ 1166 region bounds: {1,2,3,4} 1167 after region set empty: 1168 region 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"> 1182 bool <a href='#SkRegion_setRect'>setRect</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) 1183 </pre> 1184 1185 Constructs a rectangular <a href='SkRegion_Reference#SkRegion'>SkRegion</a> matching the bounds of <a href='#SkRegion_setRect_rect'>rect</a>. 1186 If <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 1197 true 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 ~~~~ 1206 region is not empty 1207 region is empty 1208 setEmpty: 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"> 1222 bool <a href='#SkRegion_setRect'>setRect</a>(int32_t left, int32_t top, int32_t right, int32_t bottom) 1223 </pre> 1224 1225 Constructs <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>). 1226 Returns 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, 1227 constructs 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 1247 rectangular <a href='SkRegion_Reference#SkRegion'>SkRegion</a> 1248 1249 ### Example 1250 1251 <div><fiddle-embed name="5b31a1b077818a8150ad50f3b19e7bfe"> 1252 1253 #### Example Output 1254 1255 ~~~~ 1256 set to: 1,2,3,4: success:true {1,2,3,4} 1257 set 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"> 1271 bool <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 1274 Constructs <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 1275 zero, constructs empty <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. Returns false if constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1276 1277 May 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 1291 true 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"> 1306 bool <a href='#SkRegion_setRegion'>setRegion</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& <a href='SkRegion_Reference#Region'>region</a>) 1307 </pre> 1308 1309 Constructs a copy of an existing <a href='#SkRegion_setRegion_region'>region</a>. 1310 Makes two <a href='SkRegion_Reference#Region'>regions</a> identical by value. Internally, <a href='#SkRegion_setRegion_region'>region</a> and 1311 the returned result share pointer values. The underlying <a href='SkRect_Reference#SkRect'>SkRect</a> array is 1312 copied when modified. 1313 1314 Creating 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 1316 pointers 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 ~~~~ 1336 region bounds: {1,2,3,4} 1337 region2 bounds: {1,2,3,4} 1338 after region set empty: 1339 region bounds: {1,2,3,4} 1340 region2 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"> 1354 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) 1355 </pre> 1356 1357 Constructs <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>. 1358 Returns false if constructed <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1359 1360 Constructed <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 1375 true 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"> 1390 bool intersects(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& <a href='SkRect_Reference#Rect'>rect</a>)const 1391 </pre> 1392 1393 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> intersects <a href='#SkRegion_intersects_rect'>rect</a>. 1394 Returns 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 1405 true 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"> 1420 bool intersects(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 1421 </pre> 1422 1423 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> intersects <a href='#SkRegion_intersects_2_other'>other</a>. 1424 Returns 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 1435 true 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"> 1450 bool contains(int32_t x, int32_t y)const 1451 </pre> 1452 1453 Returns 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>. 1454 Returns 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 1468 true 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"> 1483 bool contains(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& other)const 1484 </pre> 1485 1486 Returns true if <a href='#SkRegion_contains_2_other'>other</a> is completely inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 1487 Returns 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 1498 true 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"> 1513 bool contains(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& other)const 1514 </pre> 1515 1516 Returns true if <a href='#SkRegion_contains_3_other'>other</a> is completely inside <a href='SkRegion_Reference#SkRegion'>SkRegion</a>. 1517 Returns 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 1528 true 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"> 1543 bool <a href='#SkRegion_quickContains'>quickContains</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& r)const 1544 </pre> 1545 1546 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is a single rectangle and contains <a href='#SkRegion_quickContains_r'>r</a>. 1547 May 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 1558 true 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 ~~~~ 1567 quickContains 1: true 1568 quickContains 2: true 1569 quickContains 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"> 1583 bool <a href='#SkRegion_quickContains'>quickContains</a>(int32_t left, int32_t top, int32_t right, int32_t bottom)const 1584 </pre> 1585 1586 Returns 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>). 1588 Returns 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. 1589 May 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 1609 true 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 ~~~~ 1618 quickContains 1: true 1619 quickContains 2: true 1620 quickContains 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"> 1634 bool <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 1637 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> does not intersect <a href='#SkRegion_quickReject_rect'>rect</a>. 1638 Returns true if <a href='#SkRegion_quickReject_rect'>rect</a> is empty or <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1639 May 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 1650 true 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 ~~~~ 1659 quickReject 1: true 1660 quickReject 2: true 1661 quickReject 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"> 1675 bool <a href='#SkRegion_quickReject'>quickReject</a>(const <a href='SkRegion_Reference#SkRegion'>SkRegion</a>& rgn)const 1676 </pre> 1677 1678 Returns true if <a href='SkRegion_Reference#SkRegion'>SkRegion</a> does not intersect <a href='#SkRegion_quickReject_2_rgn'>rgn</a>. 1679 Returns true if <a href='#SkRegion_quickReject_2_rgn'>rgn</a> is empty or <a href='SkRegion_Reference#SkRegion'>SkRegion</a> is empty. 1680 May 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 1691 true 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 ~~~~ 1700 quickReject 1: true 1701 quickReject 2: true 1702 quickReject 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"> 1716 void translate(int dx, int dy) 1717 </pre> 1718 1719 Offsets <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"> 1744 void translate(int dx, int dy, <a href='SkRegion_Reference#SkRegion'>SkRegion</a>* dst)const 1745 </pre> 1746 1747 Offsets <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 1748 as <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. 1749 If <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 1788 The 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; '> 1800 Subtracts 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; '> 1807 Intersects 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; '> 1814 Unions 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; '> 1821 Replaces 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; '> 1828 Subtracts 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; '> 1835 Replaces 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; '> 1842 last 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; '> 1864 May 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"> 1873 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) 1874 </pre> 1875 1876 Replaces <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>. 1877 Returns 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 1894 false 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"> 1909 bool <a href='#SkRegion_op'>op</a>(int left, int top, int right, int bottom, <a href='#SkRegion_Op'>Op</a> op) 1910 </pre> 1911 1912 Replaces <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>). 1913 Returns 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 1939 false 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"> 1954 bool <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 1957 Replaces <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>. 1958 Returns 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 1975 false 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"> 1990 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) 1991 </pre> 1992 1993 Replaces <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>. 1994 Returns 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 2014 false 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"> 2029 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) 2030 </pre> 2031 2032 Replaces <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>. 2033 Returns 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 2053 false 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"> 2068 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) 2069 </pre> 2070 2071 Replaces <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>. 2072 Returns 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 2092 false 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"> 2107 size_t <a href='#SkRegion_writeToMemory'>writeToMemory</a>(void* buffer)const 2108 </pre> 2109 2110 Writes <a href='SkRegion_Reference#SkRegion'>SkRegion</a> to <a href='#SkRegion_writeToMemory_buffer'>buffer</a>, and returns number of bytes written. 2111 If <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"> 2137 size_t <a href='#SkRegion_readFromMemory'>readFromMemory</a>(const void* buffer, size_t length) 2138 </pre> 2139 2140 Constructs <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. 2141 Returned 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 2155 bytes 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