1 SkRRect Reference 2 === 3 4 5 <a name='SkRRect'></a> 6 7 --- 8 9 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 10 class <a href='SkRRect_Reference#SkRRect'>SkRRect</a> { 11 public: 12 <a href='#SkRRect_empty_constructor'>SkRRect()</a> = default; 13 <a href='#SkRRect_copy_const_SkRRect'>SkRRect</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& rrect) = default; 14 <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_copy_operator'>operator=</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& rrect) = default; 15 16 enum <a href='#SkRRect_Type'>Type</a> { 17 <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>, 18 <a href='#SkRRect_kRect_Type'>kRect_Type</a>, 19 <a href='#SkRRect_kOval_Type'>kOval_Type</a>, 20 <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>, 21 <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a>, 22 <a href='#SkRRect_kComplex_Type'>kComplex_Type</a>, 23 <a href='#SkRRect_kLastType'>kLastType</a> = <a href='#SkRRect_kComplex_Type'>kComplex_Type</a>, 24 }; 25 26 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_getType'>getType</a>() const; 27 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_type'>type()</a> const; 28 bool <a href='#SkRRect_isEmpty'>isEmpty</a>() const; 29 bool <a href='#SkRRect_isRect'>isRect</a>() const; 30 bool <a href='#SkRRect_isOval'>isOval</a>() const; 31 bool <a href='#SkRRect_isSimple'>isSimple</a>() const; 32 bool <a href='#SkRRect_isNinePatch'>isNinePatch</a>() const; 33 bool <a href='#SkRRect_isComplex'>isComplex</a>() const; 34 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRRect_width'>width()</a> const; 35 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRRect_height'>height()</a> const; 36 <a href='SkPoint_Reference#SkVector'>SkVector</a> <a href='#SkRRect_getSimpleRadii'>getSimpleRadii</a>() const; 37 void <a href='#SkRRect_setEmpty'>setEmpty</a>(); 38 void <a href='#SkRRect_setRect'>setRect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>); 39 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeEmpty'>MakeEmpty</a>(); 40 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeRect'>MakeRect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r); 41 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeOval'>MakeOval</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='undocumented#Oval'>oval</a>); 42 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeRectXY'>MakeRectXY</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='undocumented#SkScalar'>SkScalar</a> xRad, <a href='undocumented#SkScalar'>SkScalar</a> yRad); 43 void <a href='#SkRRect_setOval'>setOval</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='undocumented#Oval'>oval</a>); 44 void <a href='#SkRRect_setRectXY'>setRectXY</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='undocumented#SkScalar'>SkScalar</a> xRad, <a href='undocumented#SkScalar'>SkScalar</a> yRad); 45 void <a href='#SkRRect_setNinePatch'>setNinePatch</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='undocumented#SkScalar'>SkScalar</a> leftRad, <a href='undocumented#SkScalar'>SkScalar</a> topRad, 46 <a href='undocumented#SkScalar'>SkScalar</a> rightRad, <a href='undocumented#SkScalar'>SkScalar</a> bottomRad); 47 void <a href='#SkRRect_setRectRadii'>setRectRadii</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, const <a href='SkPoint_Reference#SkVector'>SkVector</a> radii[4]); 48 49 enum <a href='#SkRRect_Corner'>Corner</a> { 50 <a href='#SkRRect_kUpperLeft_Corner'>kUpperLeft_Corner</a>, 51 <a href='#SkRRect_kUpperRight_Corner'>kUpperRight_Corner</a>, 52 <a href='#SkRRect_kLowerRight_Corner'>kLowerRight_Corner</a>, 53 <a href='#SkRRect_kLowerLeft_Corner'>kLowerLeft_Corner</a>, 54 }; 55 56 const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRRect_rect'>rect()</a> const; 57 <a href='SkPoint_Reference#SkVector'>SkVector</a> <a href='#SkRRect_radii'>radii</a>(<a href='#SkRRect_Corner'>Corner</a> corner) const; 58 const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRRect_getBounds'>getBounds</a>() const; 59 friend bool <a href='#SkRRect_equal_operator'>operator==</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& a, const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& b); 60 friend bool <a href='#SkRRect_notequal_operator'>operator!=</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& a, const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& b); 61 void <a href='#SkRRect_inset'>inset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy, <a href='SkRRect_Reference#SkRRect'>SkRRect</a>* dst) const; 62 void <a href='#SkRRect_inset'>inset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy); 63 void <a href='#SkRRect_outset'>outset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy, <a href='SkRRect_Reference#SkRRect'>SkRRect</a>* dst) const; 64 void <a href='#SkRRect_outset'>outset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy); 65 void <a href='#SkRRect_offset'>offset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy); 66 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_makeOffset'>makeOffset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) const; 67 bool <a href='#SkRRect_contains'>contains</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) const; 68 bool <a href='#SkRRect_isValid'>isValid</a>() const; 69 70 static constexpr size_t <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a> = 12 * <a href='undocumented#sizeof()'>sizeof</a>(<a href='undocumented#SkScalar'>SkScalar</a>); 71 72 size_t <a href='#SkRRect_writeToMemory'>writeToMemory</a>(void* buffer) const; 73 size_t <a href='#SkRRect_readFromMemory'>readFromMemory</a>(const void* buffer, size_t length); 74 bool <a href='#SkRRect_transform'>transform</a>(const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>& <a href='SkMatrix_Reference#Matrix'>matrix</a>, <a href='SkRRect_Reference#SkRRect'>SkRRect</a>* dst) const; 75 void <a href='#SkRRect_dump'>dump</a>(bool asHex) const; 76 void <a href='#SkRRect_dump'>dump()</a> const; 77 void <a href='#SkRRect_dumpHex'>dumpHex</a>() const; 78 }; 79 </pre> 80 81 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> describes a rounded rectangle with a bounds and a pair of radii for each corner. 82 The bounds and radii can be set so that <a href='SkRRect_Reference#SkRRect'>SkRRect</a> describes: a rectangle with sharp corners; 83 a <a href='undocumented#Circle'>Circle</a>; an <a href='undocumented#Oval'>Oval</a>; or a rectangle with one or more rounded corners. 84 85 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> allows implementing CSS properties that describe rounded corners. 86 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> may have up to eight different radii, one for each axis on each of its four 87 corners. 88 89 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> may modify the provided parameters when initializing bounds and radii. 90 If either axis radii is zero or less: radii are stored as zero; corner is square. 91 If corner <a href='undocumented#Curve'>curves</a> overlap, radii are proportionally reduced to fit within bounds. 92 93 <a name='SkRRect_empty_constructor'></a> 94 95 --- 96 97 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 98 <a href='#SkRRect_empty_constructor'>SkRRect()</a> 99 </pre> 100 101 Initializes bounds at (0, 0), the origin, with zero width and height. 102 Initializes corner radii to (0, 0), and sets type of <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 103 104 ### Return Value 105 106 empty <a href='SkRRect_Reference#SkRRect'>SkRRect</a> 107 108 ### Example 109 110 <div><fiddle-embed name="471e7aad0feaf9ec3a21757a317a64f5"></fiddle-embed></div> 111 112 ### See Also 113 114 <a href='#SkRRect_setEmpty'>setEmpty</a> <a href='#SkRRect_isEmpty'>isEmpty</a> 115 116 <a name='SkRRect_copy_const_SkRRect'></a> 117 118 --- 119 120 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 121 <a href='#SkRRect_copy_const_SkRRect'>SkRRect</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& rrect) 122 </pre> 123 124 Initializes to copy of <a href='#SkRRect_copy_const_SkRRect_rrect'>rrect</a> bounds and corner radii. 125 126 ### Parameters 127 128 <table> <tr> <td><a name='SkRRect_copy_const_SkRRect_rrect'><code><strong>rrect</strong></code></a></td> 129 <td>bounds and corner to copy</td> 130 </tr> 131 </table> 132 133 ### Return Value 134 135 copy of <a href='#SkRRect_copy_const_SkRRect_rrect'>rrect</a> 136 137 ### Example 138 139 <div><fiddle-embed name="ad8f5d49edfcee60eddfe2a955b6c5f5"></fiddle-embed></div> 140 141 ### See Also 142 143 <a href='#SkRRect_copy_operator'>operator=</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_copy_const_SkRRect_rrect'>rrect</a>) <a href='#SkRRect_MakeRect'>MakeRect</a> 144 145 <a name='SkRRect_copy_operator'></a> 146 147 --- 148 149 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 150 <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_copy_operator'>operator=</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& rrect) 151 </pre> 152 153 Copies <a href='#SkRRect_copy_operator_rrect'>rrect</a> bounds and corner radii. 154 155 ### Parameters 156 157 <table> <tr> <td><a name='SkRRect_copy_operator_rrect'><code><strong>rrect</strong></code></a></td> 158 <td>bounds and corner to copy</td> 159 </tr> 160 </table> 161 162 ### Return Value 163 164 copy of <a href='#SkRRect_copy_operator_rrect'>rrect</a> 165 166 ### Example 167 168 <div><fiddle-embed name="52926c98c1cca00606d3ea99f23fea3d"></fiddle-embed></div> 169 170 ### See Also 171 172 <a href='#SkRRect_copy_const_SkRRect'>SkRRect</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_copy_operator_rrect'>rrect</a>) <a href='#SkRRect_MakeRect'>MakeRect</a> 173 174 <a name='Type'></a> 175 176 <a name='SkRRect_Type'></a> 177 178 --- 179 180 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 181 enum <a href='#SkRRect_Type'>Type</a> { 182 <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>, 183 <a href='#SkRRect_kRect_Type'>kRect_Type</a>, 184 <a href='#SkRRect_kOval_Type'>kOval_Type</a>, 185 <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>, 186 <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a>, 187 <a href='#SkRRect_kComplex_Type'>kComplex_Type</a>, 188 <a href='#SkRRect_kLastType'>kLastType</a> = <a href='#SkRRect_kComplex_Type'>kComplex_Type</a>, 189 }; 190 </pre> 191 192 <a href='#SkRRect_Type'>Type</a> describes possible specializations of <a href='#RRect'>Round_Rect</a>. Each <a href='#SkRRect_Type'>Type</a> is 193 exclusive; a <a href='#RRect'>Round_Rect</a> may only have one type. 194 195 <a href='#SkRRect_Type'>Type</a> members become progressively less restrictive; larger values of 196 <a href='#SkRRect_Type'>Type</a> have more degrees of freedom than smaller values. 197 198 ### Constants 199 200 <table style='border-collapse: collapse; width: 62.5em'> 201 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 202 <th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 203 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 204 <tr style='background-color: #f0f0f0; '> 205 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kEmpty_Type'><code>SkRRect::kEmpty_Type</code></a></td> 206 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 207 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 208 <a href='#RRect'>Round_Rect</a> has zero width or height. All radii are zero. 209 </td> 210 </tr> 211 <tr> 212 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kRect_Type'><code>SkRRect::kRect_Type</code></a></td> 213 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 214 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 215 <a href='#RRect'>Round_Rect</a> has width and height. All radii are zero. 216 </td> 217 </tr> 218 <tr style='background-color: #f0f0f0; '> 219 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kOval_Type'><code>SkRRect::kOval_Type</code></a></td> 220 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 221 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 222 <a href='#RRect'>Round_Rect</a> has width and height. All four x-radii are equal, 223 and at least half the width. All four y-radii are equal, 224 and at least half the height. 225 </td> 226 </tr> 227 <tr> 228 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kSimple_Type'><code>SkRRect::kSimple_Type</code></a></td> 229 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 230 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 231 <a href='#RRect'>Round_Rect</a> has width and height. All four x-radii are equal and 232 greater than zero, and all four y-radii are equal and greater than 233 zero. Either x-radii are less than half the width, or y-radii is 234 less than half the height, or both. 235 </td> 236 </tr> 237 <tr style='background-color: #f0f0f0; '> 238 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kNinePatch_Type'><code>SkRRect::kNinePatch_Type</code></a></td> 239 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>4</td> 240 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 241 <a href='#RRect'>Round_Rect</a> has width and height. Left x-radii are equal, top 242 y-radii are equal, right x-radii are equal, and bottom y-radii 243 are equal. The radii do not describe <a href='SkRect_Reference#Rect'>Rect</a>, <a href='undocumented#Oval'>Oval</a>, or simple type. 244 245 The centers of the corner ellipses form an axis-aligned rectangle 246 that divides the <a href='#RRect'>Round_Rect</a> into nine rectangular <a href='undocumented#Patch'>patches</a>; an 247 interior rectangle, four edges, and four corners. 248 </td> 249 </tr> 250 <tr> 251 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kComplex_Type'><code>SkRRect::kComplex_Type</code></a></td> 252 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>5</td> 253 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 254 both radii are non-zero. 255 </td> 256 </tr> 257 <tr style='background-color: #f0f0f0; '> 258 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kLastType'><code>SkRRect::kLastType</code></a></td> 259 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>5</td> 260 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 261 largest Type value</td> 262 </tr> 263 </table> 264 265 ### Example 266 267 <div><fiddle-embed name="a4233634c75b72fc7a2815ddb69bd669"></fiddle-embed></div> 268 269 ### See Also 270 271 <a href='SkRect_Reference#Rect'>Rect</a> <a href='SkPath_Reference#Path'>Path</a> 272 273 <a name='SkRRect_getType'></a> 274 275 --- 276 277 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 278 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_getType'>getType</a>()const 279 </pre> 280 281 Returns <a href='#SkRRect_Type'>Type</a>, one of: <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>, <a href='#SkRRect_kRect_Type'>kRect_Type</a>, <a href='#SkRRect_kOval_Type'>kOval_Type</a>, <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>, <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a>, 282 <a href='#SkRRect_kComplex_Type'>kComplex_Type</a> 283 . 284 285 ### Return Value 286 287 <a href='#SkRRect_Type'>Type</a> 288 289 ### Example 290 291 <div><fiddle-embed name="ace8f4aebf90527d43e4b7291375c9ad"><div>rrect2 is not a <a href='SkRect_Reference#Rect'>Rect</a>; <a href='#SkRRect_inset'>inset()</a> has made it empty. 292 </div></fiddle-embed></div> 293 294 ### See Also 295 296 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_type'>type</a> 297 298 <a name='SkRRect_type'></a> 299 300 --- 301 302 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 303 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_type'>type()</a>const 304 </pre> 305 306 Returns <a href='#SkRRect_Type'>Type</a>, one of: <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>, <a href='#SkRRect_kRect_Type'>kRect_Type</a>, <a href='#SkRRect_kOval_Type'>kOval_Type</a>, <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>, <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a>, 307 <a href='#SkRRect_kComplex_Type'>kComplex_Type</a> 308 . 309 310 ### Return Value 311 312 <a href='#SkRRect_Type'>Type</a> 313 314 ### Example 315 316 <div><fiddle-embed name="1080805c8449406a4e26d694bc56d2dc"><div><a href='#SkRRect_inset'>inset()</a> has made rrect2 empty. 317 </div></fiddle-embed></div> 318 319 ### See Also 320 321 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_getType'>getType</a> 322 323 <a name='SkRRect_isEmpty'></a> 324 325 --- 326 327 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 328 bool <a href='#SkRRect_isEmpty'>isEmpty</a>()const 329 </pre> 330 331 ### Example 332 333 <div><fiddle-embed name="099d79ecfbdfb0a19c10deb7201859c3"></fiddle-embed></div> 334 335 ### See Also 336 337 <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_isEmpty'>isEmpty</a> <a href='#SkRRect_height'>height</a> <a href='#SkRRect_width'>width</a> 338 339 <a name='SkRRect_isRect'></a> 340 341 --- 342 343 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 344 bool <a href='#SkRRect_isRect'>isRect</a>()const 345 </pre> 346 347 ### Example 348 349 <div><fiddle-embed name="bc931c9a6eb8ffe7ea8d3fb47e07a475"></fiddle-embed></div> 350 351 ### See Also 352 353 <a href='#SkRRect_isEmpty'>isEmpty</a> <a href='#SkRRect_radii'>radii</a> 354 355 <a name='SkRRect_isOval'></a> 356 357 --- 358 359 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 360 bool <a href='#SkRRect_isOval'>isOval</a>()const 361 </pre> 362 363 ### Example 364 365 <div><fiddle-embed name="4dfdb28d8343958425f2c1323fe8170d"><div>The first radii are scaled down proportionately until both x-axis and y-axis fit 366 within the bounds. After scaling, x-axis radius is smaller than half the width; 367 left <a href='#RRect'>Round_Rect</a> is not an <a href='undocumented#Oval'>oval</a>. The second radii are equal to half the 368 dimensions; right <a href='#RRect'>Round_Rect</a> is an <a href='undocumented#Oval'>oval</a>. 369 </div></fiddle-embed></div> 370 371 ### See Also 372 373 <a href='#SkRRect_isEmpty'>isEmpty</a> <a href='#SkRRect_isSimple'>isSimple</a> <a href='SkCanvas_Reference#SkCanvas'>SkCanvas</a>::<a href='#SkCanvas_drawOval'>drawOval</a> 374 375 <a name='SkRRect_isSimple'></a> 376 377 --- 378 379 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 380 bool <a href='#SkRRect_isSimple'>isSimple</a>()const 381 </pre> 382 383 ### Example 384 385 <div><fiddle-embed name="f6959ea422a7c6e98ddfad216a52c707"></fiddle-embed></div> 386 387 ### See Also 388 389 <a href='#SkRRect_isEmpty'>isEmpty</a> <a href='#SkRRect_isRect'>isRect</a> <a href='#SkRRect_isOval'>isOval</a> <a href='#SkRRect_isNinePatch'>isNinePatch</a> 390 391 <a name='SkRRect_isNinePatch'></a> 392 393 --- 394 395 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 396 bool <a href='#SkRRect_isNinePatch'>isNinePatch</a>()const 397 </pre> 398 399 ### Example 400 401 <div><fiddle-embed name="429f6dfd4cf6287df3c3c77fa7681c99"></fiddle-embed></div> 402 403 ### See Also 404 405 <a href='#SkRRect_isEmpty'>isEmpty</a> <a href='#SkRRect_isRect'>isRect</a> <a href='#SkRRect_isOval'>isOval</a> <a href='#SkRRect_isSimple'>isSimple</a> <a href='#SkRRect_isComplex'>isComplex</a> 406 407 <a name='SkRRect_isComplex'></a> 408 409 --- 410 411 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 412 bool <a href='#SkRRect_isComplex'>isComplex</a>()const 413 </pre> 414 415 ### Example 416 417 <div><fiddle-embed name="b62c183dc435d1fc091111fb2f3c3f8e"></fiddle-embed></div> 418 419 ### See Also 420 421 <a href='#SkRRect_isEmpty'>isEmpty</a> <a href='#SkRRect_isRect'>isRect</a> <a href='#SkRRect_isOval'>isOval</a> <a href='#SkRRect_isSimple'>isSimple</a> <a href='#SkRRect_isNinePatch'>isNinePatch</a> 422 423 <a name='SkRRect_width'></a> 424 425 --- 426 427 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 428 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRRect_width'>width()</a>const 429 </pre> 430 431 Returns span on the x-axis. This does not check if result fits in 32-bit float; 432 result may be infinity. 433 434 ### Return Value 435 436 <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a> minus <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a> 437 438 ### Example 439 440 <div><fiddle-embed name="c675a480b41dee157f84fa2550a2a53c"><div><a href='SkRRect_Reference#SkRRect'>SkRRect</a>::<a href='#SkRRect_MakeRect'>MakeRect</a> sorts its input, so <a href='#SkRRect_width'>width()</a> is always zero or larger. 441 </div> 442 443 #### Example Output 444 445 ~~~~ 446 unsorted width: 5 447 large width: inf 448 ~~~~ 449 450 </fiddle-embed></div> 451 452 ### See Also 453 454 <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_width'>width</a> <a href='#SkRRect_height'>height</a> <a href='#SkRRect_getBounds'>getBounds</a> 455 456 <a name='SkRRect_height'></a> 457 458 --- 459 460 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 461 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRRect_height'>height()</a>const 462 </pre> 463 464 Returns span on the y-axis. This does not check if result fits in 32-bit float; 465 result may be infinity. 466 467 ### Return Value 468 469 <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a> minus <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a> 470 471 ### Example 472 473 <div><fiddle-embed name="5a3eb1755164a7becec33cec6e6eca31"><div><a href='SkRRect_Reference#SkRRect'>SkRRect</a>::<a href='#SkRRect_MakeRect'>MakeRect</a> sorts its input, so <a href='#SkRRect_height'>height()</a> is always zero or larger. 474 </div> 475 476 #### Example Output 477 478 ~~~~ 479 unsorted height: 5 480 large height: inf 481 ~~~~ 482 483 </fiddle-embed></div> 484 485 ### See Also 486 487 <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_height'>height</a> <a href='#SkRRect_width'>width</a> <a href='#SkRRect_getBounds'>getBounds</a> 488 489 <a name='SkRRect_getSimpleRadii'></a> 490 491 --- 492 493 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 494 <a href='SkPoint_Reference#SkVector'>SkVector</a> <a href='#SkRRect_getSimpleRadii'>getSimpleRadii</a>()const 495 </pre> 496 497 Returns top-left corner radii. If <a href='#SkRRect_type'>type()</a> returns <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>, <a href='#SkRRect_kRect_Type'>kRect_Type</a>, 498 <a href='#SkRRect_kOval_Type'>kOval_Type</a>, or <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>, returns a value representative of all corner radii. 499 If <a href='#SkRRect_type'>type()</a> returns <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a> or <a href='#SkRRect_kComplex_Type'>kComplex_Type</a>, at least one of the 500 remaining three corners has a different value. 501 502 ### Return Value 503 504 corner radii for simple types 505 506 ### Example 507 508 <div><fiddle-embed name="81345f7619a072bb2b0cf59810fe86d0"></fiddle-embed></div> 509 510 ### See Also 511 512 <a href='#SkRRect_radii'>radii</a> <a href='#SkRRect_getBounds'>getBounds</a> <a href='#SkRRect_getType'>getType</a> <a href='#SkRRect_isSimple'>isSimple</a> 513 514 <a name='SkRRect_setEmpty'></a> 515 516 --- 517 518 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 519 void <a href='#SkRRect_setEmpty'>setEmpty</a>() 520 </pre> 521 522 Sets bounds to zero width and height at (0, 0), the origin. Sets 523 corner radii to zero and sets type to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 524 525 ### Example 526 527 <div><fiddle-embed name="44e9a9c2c5ef1af2a616086ff46a9037"><div>Nothing blue is drawn because <a href='#RRect'>Round_Rect</a> is set to empty. 528 </div></fiddle-embed></div> 529 530 ### See Also 531 532 <a href='#SkRRect_MakeEmpty'>MakeEmpty</a> <a href='#SkRRect_setRect'>setRect</a> 533 534 <a name='SkRRect_setRect'></a> 535 536 --- 537 538 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 539 void <a href='#SkRRect_setRect'>setRect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>) 540 </pre> 541 542 Sets bounds to sorted <a href='#SkRRect_setRect_rect'>rect</a>, and sets corner radii to zero. 543 If set bounds has width and height, and sets type to <a href='#SkRRect_kRect_Type'>kRect_Type</a>; 544 otherwise, sets type to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 545 546 ### Parameters 547 548 <table> <tr> <td><a name='SkRRect_setRect_rect'><code><strong>rect</strong></code></a></td> 549 <td>bounds to set</td> 550 </tr> 551 </table> 552 553 ### Example 554 555 <div><fiddle-embed name="3afc3ac9bebd1d7387822cc608571e82"></fiddle-embed></div> 556 557 ### See Also 558 559 <a href='#SkRRect_MakeRect'>MakeRect</a> <a href='#SkRRect_setRectXY'>setRectXY</a> 560 561 <a name='SkRRect_MakeEmpty'></a> 562 563 --- 564 565 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 566 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeEmpty'>MakeEmpty</a>() 567 </pre> 568 569 Initializes bounds at (0, 0), the origin, with zero width and height. 570 Initializes corner radii to (0, 0), and sets type of <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 571 572 ### Return Value 573 574 empty <a href='SkRRect_Reference#SkRRect'>SkRRect</a> 575 576 ### Example 577 578 <div><fiddle-embed name="c6c6be3b3c137226adbb5b5af9203d27"></fiddle-embed></div> 579 580 ### See Also 581 582 <a href='#SkRRect_empty_constructor'>SkRRect()</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_MakeEmpty'>MakeEmpty</a> 583 584 <a name='SkRRect_MakeRect'></a> 585 586 --- 587 588 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 589 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeRect'>MakeRect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) 590 </pre> 591 592 Initializes to copy of <a href='#SkRRect_MakeRect_r'>r</a> bounds and zeroes corner radii. 593 594 ### Parameters 595 596 <table> <tr> <td><a name='SkRRect_MakeRect_r'><code><strong>r</strong></code></a></td> 597 <td>bounds to copy</td> 598 </tr> 599 </table> 600 601 ### Return Value 602 603 copy of <a href='#SkRRect_MakeRect_r'>r</a> 604 605 ### Example 606 607 <div><fiddle-embed name="5295b07fe4d2cdcd077979a9e19854d9"></fiddle-embed></div> 608 609 ### See Also 610 611 <a href='#SkRRect_setRect'>setRect</a> <a href='#SkRRect_MakeOval'>MakeOval</a> <a href='#SkRRect_MakeRectXY'>MakeRectXY</a> 612 613 <a name='SkRRect_MakeOval'></a> 614 615 --- 616 617 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 618 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeOval'>MakeOval</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='undocumented#Oval'>oval</a>) 619 </pre> 620 621 Sets bounds to <a href='#SkRRect_MakeOval_oval'>oval</a>, x-axis radii to half <a href='#SkRRect_MakeOval_oval'>oval</a>.<a href='#SkRect_width'>width()</a>, and all y-axis radii 622 to half <a href='#SkRRect_MakeOval_oval'>oval</a>.<a href='#SkRect_height'>height()</a>. If <a href='#SkRRect_MakeOval_oval'>oval</a> bounds is empty, sets to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 623 Otherwise, sets to <a href='#SkRRect_kOval_Type'>kOval_Type</a>. 624 625 ### Parameters 626 627 <table> <tr> <td><a name='SkRRect_MakeOval_oval'><code><strong>oval</strong></code></a></td> 628 <td>bounds of <a href='#SkRRect_MakeOval_oval'>oval</a></td> 629 </tr> 630 </table> 631 632 ### Return Value 633 634 <a href='#SkRRect_MakeOval_oval'>oval</a> 635 636 ### Example 637 638 <div><fiddle-embed name="0b99ee38fd154f769f6031242e02fa7a"></fiddle-embed></div> 639 640 ### See Also 641 642 <a href='#SkRRect_setOval'>setOval</a> <a href='#SkRRect_MakeRect'>MakeRect</a> <a href='#SkRRect_MakeRectXY'>MakeRectXY</a> 643 644 <a name='SkRRect_MakeRectXY'></a> 645 646 --- 647 648 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 649 static <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_MakeRectXY'>MakeRectXY</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='undocumented#SkScalar'>SkScalar</a> xRad, <a href='undocumented#SkScalar'>SkScalar</a> yRad) 650 </pre> 651 652 Sets to rounded rectangle with the same radii for all four corners. 653 If <a href='#SkRRect_MakeRectXY_rect'>rect</a> is empty, sets to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 654 Otherwise, if <a href='#SkRRect_MakeRectXY_xRad'>xRad</a> and <a href='#SkRRect_MakeRectXY_yRad'>yRad</a> are zero, sets to <a href='#SkRRect_kRect_Type'>kRect_Type</a>. 655 Otherwise, if <a href='#SkRRect_MakeRectXY_xRad'>xRad</a> is at least half <a href='#SkRRect_MakeRectXY_rect'>rect</a>.<a href='#SkRect_width'>width()</a> and <a href='#SkRRect_MakeRectXY_yRad'>yRad</a> is at least half 656 <a href='#SkRRect_MakeRectXY_rect'>rect</a>.<a href='#SkRect_height'>height()</a>, sets to <a href='#SkRRect_kOval_Type'>kOval_Type</a>. 657 Otherwise, sets to <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>. 658 659 ### Parameters 660 661 <table> <tr> <td><a name='SkRRect_MakeRectXY_rect'><code><strong>rect</strong></code></a></td> 662 <td>bounds of rounded rectangle</td> 663 </tr> 664 <tr> <td><a name='SkRRect_MakeRectXY_xRad'><code><strong>xRad</strong></code></a></td> 665 <td>x-axis radius of corners</td> 666 </tr> 667 <tr> <td><a name='SkRRect_MakeRectXY_yRad'><code><strong>yRad</strong></code></a></td> 668 <td>y-axis radius of corners</td> 669 </tr> 670 </table> 671 672 ### Return Value 673 674 rounded rectangle 675 676 ### Example 677 678 <div><fiddle-embed name="2b24a1247637cbc94f8b3c77d37ed3e2"></fiddle-embed></div> 679 680 ### See Also 681 682 <a href='#SkRRect_setRectXY'>setRectXY</a> 683 684 <a name='SkRRect_setOval'></a> 685 686 --- 687 688 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 689 void <a href='#SkRRect_setOval'>setOval</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='undocumented#Oval'>oval</a>) 690 </pre> 691 692 Sets bounds to <a href='#SkRRect_setOval_oval'>oval</a>, x-axis radii to half <a href='#SkRRect_setOval_oval'>oval</a>.<a href='#SkRect_width'>width()</a>, and all y-axis radii 693 to half <a href='#SkRRect_setOval_oval'>oval</a>.<a href='#SkRect_height'>height()</a>. If <a href='#SkRRect_setOval_oval'>oval</a> bounds is empty, sets to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 694 Otherwise, sets to <a href='#SkRRect_kOval_Type'>kOval_Type</a>. 695 696 ### Parameters 697 698 <table> <tr> <td><a name='SkRRect_setOval_oval'><code><strong>oval</strong></code></a></td> 699 <td>bounds of <a href='#SkRRect_setOval_oval'>oval</a></td> 700 </tr> 701 </table> 702 703 ### Example 704 705 <div><fiddle-embed name="cf418af29cbab6243ac16aacd1217ffe"></fiddle-embed></div> 706 707 ### See Also 708 709 <a href='#SkRRect_MakeOval'>MakeOval</a> 710 711 <a name='SkRRect_setRectXY'></a> 712 713 --- 714 715 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 716 void <a href='#SkRRect_setRectXY'>setRectXY</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='undocumented#SkScalar'>SkScalar</a> xRad, <a href='undocumented#SkScalar'>SkScalar</a> yRad) 717 </pre> 718 719 Sets to rounded rectangle with the same radii for all four corners. 720 If <a href='#SkRRect_setRectXY_rect'>rect</a> is empty, sets to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 721 Otherwise, if <a href='#SkRRect_setRectXY_xRad'>xRad</a> or <a href='#SkRRect_setRectXY_yRad'>yRad</a> is zero, sets to <a href='#SkRRect_kRect_Type'>kRect_Type</a>. 722 Otherwise, if <a href='#SkRRect_setRectXY_xRad'>xRad</a> is at least half <a href='#SkRRect_setRectXY_rect'>rect</a>.<a href='#SkRect_width'>width()</a> and <a href='#SkRRect_setRectXY_yRad'>yRad</a> is at least half 723 <a href='#SkRRect_setRectXY_rect'>rect</a>.<a href='#SkRect_height'>height()</a>, sets to <a href='#SkRRect_kOval_Type'>kOval_Type</a>. 724 Otherwise, sets to <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>. 725 726 ### Parameters 727 728 <table> <tr> <td><a name='SkRRect_setRectXY_rect'><code><strong>rect</strong></code></a></td> 729 <td>bounds of rounded rectangle</td> 730 </tr> 731 <tr> <td><a name='SkRRect_setRectXY_xRad'><code><strong>xRad</strong></code></a></td> 732 <td>x-axis radius of corners</td> 733 </tr> 734 <tr> <td><a name='SkRRect_setRectXY_yRad'><code><strong>yRad</strong></code></a></td> 735 <td>y-axis radius of corners</td> 736 </tr> 737 </table> 738 739 ### Example 740 741 <div><fiddle-embed name="6ac569e40fb68c758319e85428b9ae95"></fiddle-embed></div> 742 743 ### See Also 744 745 <a href='#SkRRect_MakeRectXY'>MakeRectXY</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_addRoundRect'>addRoundRect</a> 746 747 <a name='SkRRect_setNinePatch'></a> 748 749 --- 750 751 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 752 void <a href='#SkRRect_setNinePatch'>setNinePatch</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, <a href='undocumented#SkScalar'>SkScalar</a> leftRad, <a href='undocumented#SkScalar'>SkScalar</a> topRad, <a href='undocumented#SkScalar'>SkScalar</a> rightRad, 753 <a href='undocumented#SkScalar'>SkScalar</a> bottomRad) 754 </pre> 755 756 Sets bounds to <a href='#SkRRect_setNinePatch_rect'>rect</a>. Sets radii to (<a href='#SkRRect_setNinePatch_leftRad'>leftRad</a>, <a href='#SkRRect_setNinePatch_topRad'>topRad</a>), (<a href='#SkRRect_setNinePatch_rightRad'>rightRad</a>, <a href='#SkRRect_setNinePatch_topRad'>topRad</a>), 757 (<a href='#SkRRect_setNinePatch_rightRad'>rightRad</a>, <a href='#SkRRect_setNinePatch_bottomRad'>bottomRad</a>), (<a href='#SkRRect_setNinePatch_leftRad'>leftRad</a>, <a href='#SkRRect_setNinePatch_bottomRad'>bottomRad</a>). 758 759 If <a href='#SkRRect_setNinePatch_rect'>rect</a> is empty, sets to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 760 Otherwise, if <a href='#SkRRect_setNinePatch_leftRad'>leftRad</a> and <a href='#SkRRect_setNinePatch_rightRad'>rightRad</a> are zero, sets to <a href='#SkRRect_kRect_Type'>kRect_Type</a>. 761 Otherwise, if <a href='#SkRRect_setNinePatch_topRad'>topRad</a> and <a href='#SkRRect_setNinePatch_bottomRad'>bottomRad</a> are zero, sets to <a href='#SkRRect_kRect_Type'>kRect_Type</a>. 762 Otherwise, if <a href='#SkRRect_setNinePatch_leftRad'>leftRad</a> and <a href='#SkRRect_setNinePatch_rightRad'>rightRad</a> are equal and at least half <a href='#SkRRect_setNinePatch_rect'>rect</a>.<a href='#SkRect_width'>width()</a>, and 763 <a href='#SkRRect_setNinePatch_topRad'>topRad</a> and <a href='#SkRRect_setNinePatch_bottomRad'>bottomRad</a> are equal at least half <a href='#SkRRect_setNinePatch_rect'>rect</a>.<a href='#SkRect_height'>height()</a>, sets to <a href='#SkRRect_kOval_Type'>kOval_Type</a>. 764 Otherwise, if <a href='#SkRRect_setNinePatch_leftRad'>leftRad</a> and <a href='#SkRRect_setNinePatch_rightRad'>rightRad</a> are equal, and <a href='#SkRRect_setNinePatch_topRad'>topRad</a> and <a href='#SkRRect_setNinePatch_bottomRad'>bottomRad</a> are equal, 765 sets to <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>. Otherwise, sets to <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a>. 766 767 Nine <a href='undocumented#Patch'>patch</a> refers to the nine parts defined by the radii: one center rectangle, 768 four edge <a href='undocumented#Patch'>patches</a>, and four corner <a href='undocumented#Patch'>patches</a>. 769 770 ### Parameters 771 772 <table> <tr> <td><a name='SkRRect_setNinePatch_rect'><code><strong>rect</strong></code></a></td> 773 <td>bounds of rounded rectangle</td> 774 </tr> 775 <tr> <td><a name='SkRRect_setNinePatch_leftRad'><code><strong>leftRad</strong></code></a></td> 776 <td>left-top and left-bottom x-axis radius</td> 777 </tr> 778 <tr> <td><a name='SkRRect_setNinePatch_topRad'><code><strong>topRad</strong></code></a></td> 779 <td>left-top and right-top y-axis radius</td> 780 </tr> 781 <tr> <td><a name='SkRRect_setNinePatch_rightRad'><code><strong>rightRad</strong></code></a></td> 782 <td>right-top and right-bottom x-axis radius</td> 783 </tr> 784 <tr> <td><a name='SkRRect_setNinePatch_bottomRad'><code><strong>bottomRad</strong></code></a></td> 785 <td>left-bottom and right-bottom y-axis radius</td> 786 </tr> 787 </table> 788 789 ### Example 790 791 <div><fiddle-embed name="c4620df2eaba447b581688d3100053b1"></fiddle-embed></div> 792 793 ### See Also 794 795 <a href='#SkRRect_setRectRadii'>setRectRadii</a> 796 797 <a name='SkRRect_setRectRadii'></a> 798 799 --- 800 801 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 802 void <a href='#SkRRect_setRectRadii'>setRectRadii</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>, const <a href='SkPoint_Reference#SkVector'>SkVector</a> radii[4]) 803 </pre> 804 805 Sets bounds to <a href='#SkRRect_setRectRadii_rect'>rect</a>. Sets <a href='#SkRRect_setRectRadii_radii'>radii</a> array for individual control of all for corners. 806 807 If <a href='#SkRRect_setRectRadii_rect'>rect</a> is empty, sets to <a href='#SkRRect_kEmpty_Type'>kEmpty_Type</a>. 808 Otherwise, if one of each corner <a href='#SkRRect_setRectRadii_radii'>radii</a> are zero, sets to <a href='#SkRRect_kRect_Type'>kRect_Type</a>. 809 Otherwise, if all x-axis <a href='#SkRRect_setRectRadii_radii'>radii</a> are equal and at least half <a href='#SkRRect_setRectRadii_rect'>rect</a>.<a href='#SkRect_width'>width()</a>, and 810 all y-axis <a href='#SkRRect_setRectRadii_radii'>radii</a> are equal at least half <a href='#SkRRect_setRectRadii_rect'>rect</a>.<a href='#SkRect_height'>height()</a>, sets to <a href='#SkRRect_kOval_Type'>kOval_Type</a>. 811 Otherwise, if all x-axis <a href='#SkRRect_setRectRadii_radii'>radii</a> are equal, and all y-axis <a href='#SkRRect_setRectRadii_radii'>radii</a> are equal, 812 sets to <a href='#SkRRect_kSimple_Type'>kSimple_Type</a>. Otherwise, sets to <a href='#SkRRect_kNinePatch_Type'>kNinePatch_Type</a>. 813 814 ### Parameters 815 816 <table> <tr> <td><a name='SkRRect_setRectRadii_rect'><code><strong>rect</strong></code></a></td> 817 <td>bounds of rounded rectangle</td> 818 </tr> 819 <tr> <td><a name='SkRRect_setRectRadii_radii'><code><strong>radii</strong></code></a></td> 820 <td>corner x-axis and y-axis <a href='#SkRRect_setRectRadii_radii'>radii</a></td> 821 </tr> 822 </table> 823 824 ### Example 825 826 <div><fiddle-embed name="340d6c51efaa1f7f3d0dcaf8b0e90696"></fiddle-embed></div> 827 828 ### See Also 829 830 <a href='#SkRRect_setNinePatch'>setNinePatch</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_addRoundRect'>addRoundRect</a> 831 832 <a name='SkRRect_Corner'></a> 833 834 --- 835 836 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 837 enum <a href='#SkRRect_Corner'>Corner</a> { 838 <a href='#SkRRect_kUpperLeft_Corner'>kUpperLeft_Corner</a>, 839 <a href='#SkRRect_kUpperRight_Corner'>kUpperRight_Corner</a>, 840 <a href='#SkRRect_kLowerRight_Corner'>kLowerRight_Corner</a>, 841 <a href='#SkRRect_kLowerLeft_Corner'>kLowerLeft_Corner</a>, 842 }; 843 </pre> 844 845 The radii are stored: top-left, top-right, bottom-right, bottom-left. 846 847 ### Constants 848 849 <table style='border-collapse: collapse; width: 62.5em'> 850 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 851 <th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 852 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 853 <tr style='background-color: #f0f0f0; '> 854 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kUpperLeft_Corner'><code>SkRRect::kUpperLeft_Corner</code></a></td> 855 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>0</td> 856 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 857 index of top-left corner radii</td> 858 </tr> 859 <tr> 860 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kUpperRight_Corner'><code>SkRRect::kUpperRight_Corner</code></a></td> 861 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>1</td> 862 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 863 index of top-right corner radii</td> 864 </tr> 865 <tr style='background-color: #f0f0f0; '> 866 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kLowerRight_Corner'><code>SkRRect::kLowerRight_Corner</code></a></td> 867 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>2</td> 868 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 869 index of bottom-right corner radii</td> 870 </tr> 871 <tr> 872 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kLowerLeft_Corner'><code>SkRRect::kLowerLeft_Corner</code></a></td> 873 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>3</td> 874 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 875 index of bottom-left corner radii</td> 876 </tr> 877 </table> 878 879 ### Example 880 881 <div><fiddle-embed name="9205393f30b156e1507e88aa27f1dd91"></fiddle-embed></div> 882 883 ### See Also 884 885 <a href='#SkRRect_radii'>radii</a> 886 887 <a name='SkRRect_rect'></a> 888 889 --- 890 891 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 892 const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRRect_rect'>rect()</a>const 893 </pre> 894 895 Returns bounds. Bounds may have zero width or zero height. Bounds right is 896 greater than or equal to left; bounds bottom is greater than or equal to top. 897 Result is identical to <a href='#SkRRect_getBounds'>getBounds</a>(). 898 899 ### Return Value 900 901 bounding box 902 903 ### Example 904 905 <div><fiddle-embed name="6831adf4c536047f4709c686feb10c48"> 906 907 #### Example Output 908 909 ~~~~ 910 left bounds: (nan) 0 911 left bounds: (inf) 0 912 left bounds: (100) 60 913 left bounds: (50) 50 914 left bounds: (25) 25 915 ~~~~ 916 917 </fiddle-embed></div> 918 919 ### See Also 920 921 <a href='#SkRRect_getBounds'>getBounds</a> 922 923 <a name='SkRRect_radii'></a> 924 925 --- 926 927 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 928 <a href='SkPoint_Reference#SkVector'>SkVector</a> radii(<a href='#SkRRect_Corner'>Corner</a> corner)const 929 </pre> 930 931 Returns <a href='undocumented#Scalar'>scalar</a> pair for radius of <a href='undocumented#Curve'>curve</a> on x-axis and y-axis for one <a href='#SkRRect_radii_corner'>corner</a>. 932 Both radii may be zero. If not zero, both are positive and finite. 933 934 ### Parameters 935 936 <table> <tr> <td><a name='SkRRect_radii_corner'><code><strong>corner</strong></code></a></td> 937 <td>one of: <a href='#SkRRect_kUpperLeft_Corner'>kUpperLeft_Corner</a>, <a href='#SkRRect_kUpperRight_Corner'>kUpperRight_Corner</a>,</td> 938 </tr> 939 </table> 940 941 <a href='#SkRRect_kLowerRight_Corner'>kLowerRight_Corner</a>, <a href='#SkRRect_kLowerLeft_Corner'>kLowerLeft_Corner</a> 942 943 ### Return Value 944 945 x-axis and y-axis radii for one <a href='#SkRRect_radii_corner'>corner</a> 946 947 ### Example 948 949 <div><fiddle-embed name="8d5c88478528584913867ada423e0d59"><div>Finite values are scaled proportionately to fit; other values are set to zero. 950 Scaled values cannot be larger than 25, half the bounding <a href='#RRect'>Round_Rect</a> width. 951 Small scaled values are halved to scale in proportion to the y-axis <a href='#SkRRect_radii_corner'>corner</a> 952 radius, which is twice the bounds height. 953 </div> 954 955 #### Example Output 956 957 ~~~~ 958 left corner: (nan) 0 959 left corner: (inf) 0 960 left corner: (100) 25 961 left corner: (50) 25 962 left corner: (25) 12.5 963 ~~~~ 964 965 </fiddle-embed></div> 966 967 ### See Also 968 969 <a href='#SkRRect_Corner'>Corner</a> 970 971 <a name='SkRRect_getBounds'></a> 972 973 --- 974 975 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 976 const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRRect_getBounds'>getBounds</a>()const 977 </pre> 978 979 Returns bounds. Bounds may have zero width or zero height. Bounds right is 980 greater than or equal to left; bounds bottom is greater than or equal to top. 981 Result is identical to <a href='#SkRRect_rect'>rect()</a>. 982 983 ### Return Value 984 985 bounding box 986 987 ### Example 988 989 <div><fiddle-embed name="4577e2dcb086b241bb43d8b89ee0b0dd"></fiddle-embed></div> 990 991 ### See Also 992 993 <a href='#SkRRect_rect'>rect</a> 994 995 <a name='SkRRect_equal_operator'></a> 996 997 --- 998 999 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1000 bool <a href='#SkRRect_equal_operator'>operator==</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& a, const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& b) 1001 </pre> 1002 1003 Returns true if bounds and radii in <a href='#SkRRect_equal_operator_a'>a</a> are equal to bounds and radii in <a href='#SkRRect_equal_operator_b'>b</a>. 1004 1005 <a href='#SkRRect_equal_operator_a'>a</a> and <a href='#SkRRect_equal_operator_b'>b</a> are not equal if either contain NaN. <a href='#SkRRect_equal_operator_a'>a</a> and <a href='#SkRRect_equal_operator_b'>b</a> are equal if members 1006 contain zeroes with different signs. 1007 1008 ### Parameters 1009 1010 <table> <tr> <td><a name='SkRRect_equal_operator_a'><code><strong>a</strong></code></a></td> 1011 <td><a href='SkRect_Reference#SkRect'>SkRect</a> bounds and radii to compare</td> 1012 </tr> 1013 <tr> <td><a name='SkRRect_equal_operator_b'><code><strong>b</strong></code></a></td> 1014 <td><a href='SkRect_Reference#SkRect'>SkRect</a> bounds and radii to compare</td> 1015 </tr> 1016 </table> 1017 1018 ### Return Value 1019 1020 true if members are equal 1021 1022 ### Example 1023 1024 <div><fiddle-embed name="df181af37f1d2b06f0f45af73df7b47d"></fiddle-embed></div> 1025 1026 ### See Also 1027 1028 <a href='#SkRRect_notequal_operator'>operator!=</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_equal_operator_a'>a</a>, const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_equal_operator_b'>b</a>) 1029 1030 <a name='SkRRect_notequal_operator'></a> 1031 1032 --- 1033 1034 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1035 bool <a href='#SkRRect_notequal_operator'>operator!=</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& a, const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& b) 1036 </pre> 1037 1038 Returns true if bounds and radii in <a href='#SkRRect_notequal_operator_a'>a</a> are not equal to bounds and radii in <a href='#SkRRect_notequal_operator_b'>b</a>. 1039 1040 <a href='#SkRRect_notequal_operator_a'>a</a> and <a href='#SkRRect_notequal_operator_b'>b</a> are not equal if either contain NaN. <a href='#SkRRect_notequal_operator_a'>a</a> and <a href='#SkRRect_notequal_operator_b'>b</a> are equal if members 1041 contain zeroes with different signs. 1042 1043 ### Parameters 1044 1045 <table> <tr> <td><a name='SkRRect_notequal_operator_a'><code><strong>a</strong></code></a></td> 1046 <td><a href='SkRect_Reference#SkRect'>SkRect</a> bounds and radii to compare</td> 1047 </tr> 1048 <tr> <td><a name='SkRRect_notequal_operator_b'><code><strong>b</strong></code></a></td> 1049 <td><a href='SkRect_Reference#SkRect'>SkRect</a> bounds and radii to compare</td> 1050 </tr> 1051 </table> 1052 1053 ### Return Value 1054 1055 true if members are not equal 1056 1057 ### Example 1058 1059 <div><fiddle-embed name="505e47b3e6474ebdecdc04c3c2af2c34"></fiddle-embed></div> 1060 1061 ### See Also 1062 1063 <a href='#SkRRect_equal_operator'>operator==</a>(const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_notequal_operator_a'>a</a>, const <a href='SkRRect_Reference#SkRRect'>SkRRect</a>& <a href='#SkRRect_notequal_operator_b'>b</a>) 1064 1065 <a name='SkRRect_inset'></a> 1066 1067 --- 1068 1069 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1070 void inset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy, <a href='SkRRect_Reference#SkRRect'>SkRRect</a>* dst)const 1071 </pre> 1072 1073 Copies <a href='SkRRect_Reference#SkRRect'>SkRRect</a> to <a href='#SkRRect_inset_dst'>dst</a>, then insets <a href='#SkRRect_inset_dst'>dst</a> bounds by <a href='#SkRRect_inset_dx'>dx</a> and <a href='#SkRRect_inset_dy'>dy</a>, and adjusts <a href='#SkRRect_inset_dst'>dst</a> 1074 radii by <a href='#SkRRect_inset_dx'>dx</a> and <a href='#SkRRect_inset_dy'>dy</a>. <a href='#SkRRect_inset_dx'>dx</a> and <a href='#SkRRect_inset_dy'>dy</a> may be positive, negative, or zero. <a href='#SkRRect_inset_dst'>dst</a> may be 1075 <a href='SkRRect_Reference#SkRRect'>SkRRect</a>. 1076 1077 If either corner radius is zero, the corner has no curvature and is unchanged. 1078 Otherwise, if adjusted radius becomes negative, pins radius to zero. 1079 If <a href='#SkRRect_inset_dx'>dx</a> exceeds half <a href='#SkRRect_inset_dst'>dst</a> bounds width, <a href='#SkRRect_inset_dst'>dst</a> bounds left and right are set to 1080 bounds x-axis center. If <a href='#SkRRect_inset_dy'>dy</a> exceeds half <a href='#SkRRect_inset_dst'>dst</a> bounds height, <a href='#SkRRect_inset_dst'>dst</a> bounds top and 1081 bottom are set to bounds y-axis center. 1082 1083 If <a href='#SkRRect_inset_dx'>dx</a> or <a href='#SkRRect_inset_dy'>dy</a> cause the bounds to become infinite, <a href='#SkRRect_inset_dst'>dst</a> bounds is zeroed. 1084 1085 ### Parameters 1086 1087 <table> <tr> <td><a name='SkRRect_inset_dx'><code><strong>dx</strong></code></a></td> 1088 <td>added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a>, and subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a></td> 1089 </tr> 1090 <tr> <td><a name='SkRRect_inset_dy'><code><strong>dy</strong></code></a></td> 1091 <td>added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a>, and subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a></td> 1092 </tr> 1093 <tr> <td><a name='SkRRect_inset_dst'><code><strong>dst</strong></code></a></td> 1094 <td>insets bounds and radii</td> 1095 </tr> 1096 </table> 1097 1098 ### Example 1099 1100 <div><fiddle-embed name="f02f0110d5605dac6d14dcb8d1d8cb6e"></fiddle-embed></div> 1101 1102 ### See Also 1103 1104 <a href='#SkRRect_outset'>outset</a> <a href='#SkRRect_offset'>offset</a> <a href='#SkRRect_makeOffset'>makeOffset</a> 1105 1106 <a name='SkRRect_inset_2'></a> 1107 1108 --- 1109 1110 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1111 void inset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) 1112 </pre> 1113 1114 Insets bounds by <a href='#SkRRect_inset_2_dx'>dx</a> and <a href='#SkRRect_inset_2_dy'>dy</a>, and adjusts radii by <a href='#SkRRect_inset_2_dx'>dx</a> and <a href='#SkRRect_inset_2_dy'>dy</a>. <a href='#SkRRect_inset_2_dx'>dx</a> and <a href='#SkRRect_inset_2_dy'>dy</a> may be 1115 positive, negative, or zero. 1116 1117 If either corner radius is zero, the corner has no curvature and is unchanged. 1118 Otherwise, if adjusted radius becomes negative, pins radius to zero. 1119 If <a href='#SkRRect_inset_2_dx'>dx</a> exceeds half bounds width, bounds left and right are set to 1120 bounds x-axis center. If <a href='#SkRRect_inset_2_dy'>dy</a> exceeds half bounds height, bounds top and 1121 bottom are set to bounds y-axis center. 1122 1123 If <a href='#SkRRect_inset_2_dx'>dx</a> or <a href='#SkRRect_inset_2_dy'>dy</a> cause the bounds to become infinite, bounds is zeroed. 1124 1125 ### Parameters 1126 1127 <table> <tr> <td><a name='SkRRect_inset_2_dx'><code><strong>dx</strong></code></a></td> 1128 <td>added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a>, and subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a></td> 1129 </tr> 1130 <tr> <td><a name='SkRRect_inset_2_dy'><code><strong>dy</strong></code></a></td> 1131 <td>added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a>, and subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a></td> 1132 </tr> 1133 </table> 1134 1135 ### Example 1136 1137 <div><fiddle-embed name="da61054322550a2d5ac15114da23bd23"></fiddle-embed></div> 1138 1139 ### See Also 1140 1141 <a href='#SkRRect_outset'>outset</a> <a href='#SkRRect_offset'>offset</a> <a href='#SkRRect_makeOffset'>makeOffset</a> 1142 1143 <a name='SkRRect_outset'></a> 1144 1145 --- 1146 1147 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1148 void outset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy, <a href='SkRRect_Reference#SkRRect'>SkRRect</a>* dst)const 1149 </pre> 1150 1151 Outsets <a href='#SkRRect_outset_dst'>dst</a> bounds by <a href='#SkRRect_outset_dx'>dx</a> and <a href='#SkRRect_outset_dy'>dy</a>, and adjusts radii by <a href='#SkRRect_outset_dx'>dx</a> and <a href='#SkRRect_outset_dy'>dy</a>. <a href='#SkRRect_outset_dx'>dx</a> and <a href='#SkRRect_outset_dy'>dy</a> may be 1152 positive, negative, or zero. 1153 1154 If either corner radius is zero, the corner has no curvature and is unchanged. 1155 Otherwise, if adjusted radius becomes negative, pins radius to zero. 1156 If <a href='#SkRRect_outset_dx'>dx</a> exceeds half <a href='#SkRRect_outset_dst'>dst</a> bounds width, <a href='#SkRRect_outset_dst'>dst</a> bounds left and right are set to 1157 bounds x-axis center. If <a href='#SkRRect_outset_dy'>dy</a> exceeds half <a href='#SkRRect_outset_dst'>dst</a> bounds height, <a href='#SkRRect_outset_dst'>dst</a> bounds top and 1158 bottom are set to bounds y-axis center. 1159 1160 If <a href='#SkRRect_outset_dx'>dx</a> or <a href='#SkRRect_outset_dy'>dy</a> cause the bounds to become infinite, <a href='#SkRRect_outset_dst'>dst</a> bounds is zeroed. 1161 1162 ### Parameters 1163 1164 <table> <tr> <td><a name='SkRRect_outset_dx'><code><strong>dx</strong></code></a></td> 1165 <td>subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a>, and added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a></td> 1166 </tr> 1167 <tr> <td><a name='SkRRect_outset_dy'><code><strong>dy</strong></code></a></td> 1168 <td>subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a>, and added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a></td> 1169 </tr> 1170 <tr> <td><a name='SkRRect_outset_dst'><code><strong>dst</strong></code></a></td> 1171 <td>outset bounds and radii</td> 1172 </tr> 1173 </table> 1174 1175 ### Example 1176 1177 <div><fiddle-embed name="4d69b6d9c7726c47c42827d79fc7899c"></fiddle-embed></div> 1178 1179 ### See Also 1180 1181 <a href='#SkRRect_inset'>inset</a> <a href='#SkRRect_offset'>offset</a> <a href='#SkRRect_makeOffset'>makeOffset</a> 1182 1183 <a name='SkRRect_outset_2'></a> 1184 1185 --- 1186 1187 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1188 void outset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) 1189 </pre> 1190 1191 Outsets bounds by <a href='#SkRRect_outset_2_dx'>dx</a> and <a href='#SkRRect_outset_2_dy'>dy</a>, and adjusts radii by <a href='#SkRRect_outset_2_dx'>dx</a> and <a href='#SkRRect_outset_2_dy'>dy</a>. <a href='#SkRRect_outset_2_dx'>dx</a> and <a href='#SkRRect_outset_2_dy'>dy</a> may be 1192 positive, negative, or zero. 1193 1194 If either corner radius is zero, the corner has no curvature and is unchanged. 1195 Otherwise, if adjusted radius becomes negative, pins radius to zero. 1196 If <a href='#SkRRect_outset_2_dx'>dx</a> exceeds half bounds width, bounds left and right are set to 1197 bounds x-axis center. If <a href='#SkRRect_outset_2_dy'>dy</a> exceeds half bounds height, bounds top and 1198 bottom are set to bounds y-axis center. 1199 1200 If <a href='#SkRRect_outset_2_dx'>dx</a> or <a href='#SkRRect_outset_2_dy'>dy</a> cause the bounds to become infinite, bounds is zeroed. 1201 1202 ### Parameters 1203 1204 <table> <tr> <td><a name='SkRRect_outset_2_dx'><code><strong>dx</strong></code></a></td> 1205 <td>subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a>, and added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a></td> 1206 </tr> 1207 <tr> <td><a name='SkRRect_outset_2_dy'><code><strong>dy</strong></code></a></td> 1208 <td>subtracted from <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a>, and added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a></td> 1209 </tr> 1210 </table> 1211 1212 ### Example 1213 1214 <div><fiddle-embed name="4391cced86653dcd0f84439a5c0bb3f2"></fiddle-embed></div> 1215 1216 ### See Also 1217 1218 <a href='#SkRRect_inset'>inset</a> <a href='#SkRRect_offset'>offset</a> <a href='#SkRRect_makeOffset'>makeOffset</a> 1219 1220 <a name='SkRRect_offset'></a> 1221 1222 --- 1223 1224 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1225 void offset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) 1226 </pre> 1227 1228 Translates <a href='SkRRect_Reference#SkRRect'>SkRRect</a> by (<a href='#SkRRect_offset_dx'>dx</a>, <a href='#SkRRect_offset_dy'>dy</a>). 1229 1230 ### Parameters 1231 1232 <table> <tr> <td><a name='SkRRect_offset_dx'><code><strong>dx</strong></code></a></td> 1233 <td>offset added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a></td> 1234 </tr> 1235 <tr> <td><a name='SkRRect_offset_dy'><code><strong>dy</strong></code></a></td> 1236 <td>offset added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a> and <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a></td> 1237 </tr> 1238 </table> 1239 1240 ### Example 1241 1242 <div><fiddle-embed name="a45cdd46ef2fe0df62d84d41713e82e2"></fiddle-embed></div> 1243 1244 ### See Also 1245 1246 <a href='#SkRRect_makeOffset'>makeOffset</a> <a href='#SkRRect_inset'>inset outset</a> 1247 1248 <a name='SkRRect_makeOffset'></a> 1249 1250 --- 1251 1252 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1253 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='#SkRRect_makeOffset'>makeOffset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy)const 1254 </pre> 1255 1256 Returns <a href='SkRRect_Reference#SkRRect'>SkRRect</a> translated by (<a href='#SkRRect_makeOffset_dx'>dx</a>, <a href='#SkRRect_makeOffset_dy'>dy</a>). 1257 1258 ### Parameters 1259 1260 <table> <tr> <td><a name='SkRRect_makeOffset_dx'><code><strong>dx</strong></code></a></td> 1261 <td>offset added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fRight'>fRight</a></td> 1262 </tr> 1263 <tr> <td><a name='SkRRect_makeOffset_dy'><code><strong>dy</strong></code></a></td> 1264 <td>offset added to <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fTop'>fTop</a> and <a href='#SkRRect_rect'>rect()</a>.<a href='#SkRect_fBottom'>fBottom</a></td> 1265 </tr> 1266 </table> 1267 1268 ### Return Value 1269 1270 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> bounds offset by (<a href='#SkRRect_makeOffset_dx'>dx</a>, <a href='#SkRRect_makeOffset_dy'>dy</a>), with unchanged corner radii 1271 1272 ### Example 1273 1274 <div><fiddle-embed name="c433aa41eaf5e419e3349fb970a08151"></fiddle-embed></div> 1275 1276 ### See Also 1277 1278 <a href='#SkRRect_offset'>offset</a> <a href='#SkRRect_inset'>inset outset</a> 1279 1280 <a name='SkRRect_contains'></a> 1281 1282 --- 1283 1284 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1285 bool contains(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='SkRect_Reference#Rect'>rect</a>)const 1286 </pre> 1287 1288 Returns true if <a href='#SkRRect_contains_rect'>rect</a> is inside the bounds and corner radii, and if 1289 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> and <a href='#SkRRect_contains_rect'>rect</a> are not empty. 1290 1291 ### Parameters 1292 1293 <table> <tr> <td><a name='SkRRect_contains_rect'><code><strong>rect</strong></code></a></td> 1294 <td>area tested for containment</td> 1295 </tr> 1296 </table> 1297 1298 ### Return Value 1299 1300 true if <a href='SkRRect_Reference#SkRRect'>SkRRect</a> contains <a href='#SkRRect_contains_rect'>rect</a> 1301 1302 ### Example 1303 1304 <div><fiddle-embed name="0bb057140e4119234bdd2e8dd2f0fa19"></fiddle-embed></div> 1305 1306 ### See Also 1307 1308 <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_contains'>contains</a> 1309 1310 <a name='SkRRect_isValid'></a> 1311 1312 --- 1313 1314 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1315 bool <a href='#SkRRect_isValid'>isValid</a>()const 1316 </pre> 1317 1318 Returns true if bounds and radii values are finite and describe a <a href='SkRRect_Reference#SkRRect'>SkRRect</a> 1319 <a href='SkRRect_Reference#SkRRect'>SkRRect</a>::<a href='#SkRRect_Type'>Type</a> that matches <a href='#SkRRect_getType'>getType</a>(). All <a href='SkRRect_Reference#SkRRect'>SkRRect</a> methods construct valid types, 1320 even if the input values are not valid. Invalid <a href='SkRRect_Reference#SkRRect'>SkRRect</a> <a href='undocumented#Data'>data</a> can only 1321 be generated by corrupting memory. 1322 1323 ### Return Value 1324 1325 true if bounds and radii match <a href='#SkRRect_type'>type()</a> 1326 1327 ### Example 1328 1329 <div><fiddle-embed name="8cc1f21c98c0416f7724ad218f557a00"></fiddle-embed></div> 1330 1331 ### See Also 1332 1333 <a href='#SkRRect_Type'>Type</a> <a href='#SkRRect_getType'>getType</a> 1334 1335 ### Constants 1336 1337 <table style='border-collapse: collapse; width: 62.5em'> 1338 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Const</th> 1339 <th style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>Value</th> 1340 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 1341 <tr style='background-color: #f0f0f0; '> 1342 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRRect_kSizeInMemory'><code>SkRRect::kSizeInMemory</code></a></td> 1343 <td style='text-align: center; border: 2px solid #dddddd; padding: 8px; '>48</td> 1344 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 1345 Space required to write the contents of <a href='SkRRect_Reference#SkRRect'>SkRRect</a> into a buffer; always a multiple of four. 1346 </td> 1347 </tr> 1348 </table> 1349 1350 <a name='SkRRect_writeToMemory'></a> 1351 1352 --- 1353 1354 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1355 size_t <a href='#SkRRect_writeToMemory'>writeToMemory</a>(void* buffer)const 1356 </pre> 1357 1358 Writes <a href='SkRRect_Reference#SkRRect'>SkRRect</a> to <a href='#SkRRect_writeToMemory_buffer'>buffer</a>. Writes <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a> bytes, and returns 1359 <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a>, the number of bytes written. 1360 1361 ### Parameters 1362 1363 <table> <tr> <td><a name='SkRRect_writeToMemory_buffer'><code><strong>buffer</strong></code></a></td> 1364 <td>storage for <a href='SkRRect_Reference#SkRRect'>SkRRect</a></td> 1365 </tr> 1366 </table> 1367 1368 ### Return Value 1369 1370 bytes written, <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a> 1371 1372 ### Example 1373 1374 <div><fiddle-embed name="d6f5a3d21727ddc15e10ef4d5103ff91"></fiddle-embed></div> 1375 1376 ### See Also 1377 1378 <a href='#SkRRect_readFromMemory'>readFromMemory</a> 1379 1380 <a name='SkRRect_readFromMemory'></a> 1381 1382 --- 1383 1384 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1385 size_t <a href='#SkRRect_readFromMemory'>readFromMemory</a>(const void* buffer, size_t length) 1386 </pre> 1387 1388 Reads <a href='SkRRect_Reference#SkRRect'>SkRRect</a> from <a href='#SkRRect_readFromMemory_buffer'>buffer</a>, reading <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a> bytes. 1389 Returns <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a>, bytes read if <a href='#SkRRect_readFromMemory_length'>length</a> is at least <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a>. 1390 Otherwise, returns zero. 1391 1392 ### Parameters 1393 1394 <table> <tr> <td><a name='SkRRect_readFromMemory_buffer'><code><strong>buffer</strong></code></a></td> 1395 <td>memory to read from</td> 1396 </tr> 1397 <tr> <td><a name='SkRRect_readFromMemory_length'><code><strong>length</strong></code></a></td> 1398 <td><a href='undocumented#Size'>size</a> of <a href='#SkRRect_readFromMemory_buffer'>buffer</a></td> 1399 </tr> 1400 </table> 1401 1402 ### Return Value 1403 1404 bytes read, or 0 if <a href='#SkRRect_readFromMemory_length'>length</a> is less than <a href='#SkRRect_kSizeInMemory'>kSizeInMemory</a> 1405 1406 ### Example 1407 1408 <div><fiddle-embed name="50969745cf2b23544362f4cff5592b75"></fiddle-embed></div> 1409 1410 ### See Also 1411 1412 <a href='#SkRRect_writeToMemory'>writeToMemory</a> 1413 1414 <a name='SkRRect_transform'></a> 1415 1416 --- 1417 1418 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1419 bool transform(const <a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a>& <a href='SkMatrix_Reference#Matrix'>matrix</a>, <a href='SkRRect_Reference#SkRRect'>SkRRect</a>* dst)const 1420 </pre> 1421 1422 Transforms by <a href='SkRRect_Reference#SkRRect'>SkRRect</a> by <a href='#SkRRect_transform_matrix'>matrix</a>, storing result in <a href='#SkRRect_transform_dst'>dst</a>. 1423 Returns true if <a href='SkRRect_Reference#SkRRect'>SkRRect</a> transformed can be represented by another <a href='SkRRect_Reference#SkRRect'>SkRRect</a>. 1424 Returns false if <a href='#SkRRect_transform_matrix'>matrix</a> contains transformations other than scale and translate. 1425 1426 Asserts in debug builds if <a href='SkRRect_Reference#SkRRect'>SkRRect</a> equals <a href='#SkRRect_transform_dst'>dst</a>. 1427 1428 ### Parameters 1429 1430 <table> <tr> <td><a name='SkRRect_transform_matrix'><code><strong>matrix</strong></code></a></td> 1431 <td><a href='SkMatrix_Reference#SkMatrix'>SkMatrix</a> specifying the transform</td> 1432 </tr> 1433 <tr> <td><a name='SkRRect_transform_dst'><code><strong>dst</strong></code></a></td> 1434 <td><a href='SkRRect_Reference#SkRRect'>SkRRect</a> to store the result</td> 1435 </tr> 1436 </table> 1437 1438 ### Return Value 1439 1440 true if transformation succeeded. 1441 1442 ### Example 1443 1444 <div><fiddle-embed name="68a5d24f22e2d798608fce8a20e47fd0"></fiddle-embed></div> 1445 1446 ### See Also 1447 1448 <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_transform'>transform</a> 1449 1450 <a name='SkRRect_dump'></a> 1451 1452 --- 1453 1454 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1455 void <a href='#SkRRect_dump'>dump</a>(bool asHex)const 1456 </pre> 1457 1458 Writes <a href='undocumented#Text'>text</a> representation of <a href='SkRRect_Reference#SkRRect'>SkRRect</a> to standard output. 1459 Set <a href='#SkRRect_dump_asHex'>asHex</a> true to generate exact binary representations 1460 of floating <a href='SkPoint_Reference#Point'>point</a> numbers. 1461 1462 ### Parameters 1463 1464 <table> <tr> <td><a name='SkRRect_dump_asHex'><code><strong>asHex</strong></code></a></td> 1465 <td>true if <a href='undocumented#SkScalar'>SkScalar</a> values are written as hexadecimal</td> 1466 </tr> 1467 </table> 1468 1469 ### Example 1470 1471 <div><fiddle-embed name="265b8d23288dc8026ff788e809360af7"> 1472 1473 #### Example Output 1474 1475 ~~~~ 1476 SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); 1477 const SkPoint corners[] = { 1478 { 0, 0 }, 1479 { 0, 0 }, 1480 { 0, 0 }, 1481 { 0, 0 }, 1482 }; 1483 SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ 1484 SkBits2Float(0x3f2aaaab), /* 0.666667 */ 1485 SkBits2Float(0x3f5b6db7), /* 0.857143 */ 1486 SkBits2Float(0x3f2aaaab) /* 0.666667 */); 1487 const SkPoint corners[] = { 1488 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1489 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1490 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1491 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1492 }; 1493 ~~~~ 1494 1495 </fiddle-embed></div> 1496 1497 ### See Also 1498 1499 <a href='#SkRRect_dumpHex'>dumpHex</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_dump'>dump</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_dump'>dump</a> <a href='undocumented#SkPathMeasure'>SkPathMeasure</a>::<a href='#SkPathMeasure_dump'>dump</a> 1500 1501 <a name='SkRRect_dump_2'></a> 1502 1503 --- 1504 1505 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1506 void <a href='#SkRRect_dump'>dump()</a>const 1507 </pre> 1508 1509 Writes <a href='undocumented#Text'>text</a> representation of <a href='SkRRect_Reference#SkRRect'>SkRRect</a> to standard output. The representation 1510 may be directly compiled as C++ code. Floating <a href='SkPoint_Reference#Point'>point</a> values are written 1511 with limited precision; it may not be possible to reconstruct original 1512 <a href='SkRRect_Reference#SkRRect'>SkRRect</a> from output. 1513 1514 ### Example 1515 1516 <div><fiddle-embed name="f850423c7c0c4f803d479ecd92221059"> 1517 1518 #### Example Output 1519 1520 ~~~~ 1521 SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f); 1522 const SkPoint corners[] = { 1523 { 0, 0 }, 1524 { 0, 0 }, 1525 { 0, 0 }, 1526 { 0, 0 }, 1527 }; 1528 rrect is not equal to copy 1529 ~~~~ 1530 1531 </fiddle-embed></div> 1532 1533 ### See Also 1534 1535 <a href='#SkRRect_dumpHex'>dumpHex</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_dump'>dump</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_dump'>dump</a> <a href='undocumented#SkPathMeasure'>SkPathMeasure</a>::<a href='#SkPathMeasure_dump'>dump</a> 1536 1537 <a name='SkRRect_dumpHex'></a> 1538 1539 --- 1540 1541 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1542 void <a href='#SkRRect_dumpHex'>dumpHex</a>()const 1543 </pre> 1544 1545 Writes <a href='undocumented#Text'>text</a> representation of <a href='SkRRect_Reference#SkRRect'>SkRRect</a> to standard output. The representation 1546 may be directly compiled as C++ code. Floating <a href='SkPoint_Reference#Point'>point</a> values are written 1547 in hexadecimal to preserve their exact bit pattern. The output reconstructs the 1548 original <a href='SkRRect_Reference#SkRRect'>SkRRect</a>. 1549 1550 ### Example 1551 1552 <div><fiddle-embed name="c73f5e2644d949b859f05bd367883454"> 1553 1554 #### Example Output 1555 1556 ~~~~ 1557 SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ 1558 SkBits2Float(0x3f2aaaab), /* 0.666667 */ 1559 SkBits2Float(0x3f5b6db7), /* 0.857143 */ 1560 SkBits2Float(0x3f2aaaab) /* 0.666667 */); 1561 const SkPoint corners[] = { 1562 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1563 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1564 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1565 { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */ 1566 }; 1567 rrect is equal to copy 1568 ~~~~ 1569 1570 </fiddle-embed></div> 1571 1572 ### See Also 1573 1574 <a href='#SkRRect_dump'>dump</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_dumpHex'>dumpHex</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_dumpHex'>dumpHex</a> 1575 1576