1 SkRect Reference 2 === 3 4 5 <a name='SkRect'></a> 6 7 --- 8 9 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0"> 10 struct <a href='SkRect_Reference#SkRect'>SkRect</a> { 11 12 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_fLeft'>fLeft</a>; 13 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_fTop'>fTop</a>; 14 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_fRight'>fRight</a>; 15 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_fBottom'>fBottom</a>; 16 17 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeEmpty'>MakeEmpty</a>(); 18 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeWH'>MakeWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> w, <a href='undocumented#SkScalar'>SkScalar</a> h); 19 static <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeIWH'>MakeIWH</a>(int w, int h); 20 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeSize'>MakeSize</a>(const <a href='undocumented#SkSize'>SkSize</a>& <a href='undocumented#Size'>size</a>); 21 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeLTRB'>MakeLTRB</a>(<a href='undocumented#SkScalar'>SkScalar</a> l, <a href='undocumented#SkScalar'>SkScalar</a> t, <a href='undocumented#SkScalar'>SkScalar</a> r, 22 <a href='undocumented#SkScalar'>SkScalar</a> b); 23 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeXYWH'>MakeXYWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y, <a href='undocumented#SkScalar'>SkScalar</a> w, 24 <a href='undocumented#SkScalar'>SkScalar</a> h); 25 static <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_Make'>Make</a>(const <a href='undocumented#SkISize'>SkISize</a>& <a href='undocumented#Size'>size</a>); 26 static <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_Make'>Make</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& irect); 27 bool <a href='#SkRect_isEmpty'>isEmpty</a>() const; 28 bool <a href='#SkRect_isSorted'>isSorted</a>() const; 29 bool <a href='#SkRect_isFinite'>isFinite</a>() const; 30 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_x'>x()</a> const; 31 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_y'>y()</a> const; 32 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_left'>left()</a> const; 33 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_top'>top()</a> const; 34 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_right'>right()</a> const; 35 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_bottom'>bottom()</a> const; 36 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_width'>width()</a> const; 37 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_height'>height()</a> const; 38 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_centerX'>centerX</a>() const; 39 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_centerY'>centerY</a>() const; 40 friend bool <a href='#SkRect_equal_operator'>operator==</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b); 41 friend bool <a href='#SkRect_notequal_operator'>operator!=</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b); 42 void <a href='#SkRect_toQuad'>toQuad</a>(<a href='SkPoint_Reference#SkPoint'>SkPoint</a> <a href='SkPath_Reference#Quad'>quad</a>[4]) const; 43 void <a href='#SkRect_setEmpty'>setEmpty</a>(); 44 void <a href='#SkRect_set'>set</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& src); 45 void <a href='#SkRect_set'>set</a>(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom); 46 void <a href='#SkRect_setLTRB'>setLTRB</a>(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom); 47 void <a href='#SkRect_iset'>iset</a>(int left, int top, int right, int bottom); 48 void <a href='#SkRect_isetWH'>isetWH</a>(int width, int height); 49 void <a href='#SkRect_set'>set</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count); 50 void <a href='#SkRect_setBounds'>setBounds</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count); 51 bool <a href='#SkRect_setBoundsCheck'>setBoundsCheck</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count); 52 void <a href='#SkRect_setBoundsNoCheck'>setBoundsNoCheck</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count); 53 void <a href='#SkRect_set'>set</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a>& p0, const <a href='SkPoint_Reference#SkPoint'>SkPoint</a>& p1); 54 void <a href='#SkRect_setXYWH'>setXYWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y, <a href='undocumented#SkScalar'>SkScalar</a> width, <a href='undocumented#SkScalar'>SkScalar</a> height); 55 void <a href='#SkRect_setWH'>setWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> width, <a href='undocumented#SkScalar'>SkScalar</a> height); 56 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeOffset'>makeOffset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) const; 57 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeInset'>makeInset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) const; 58 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeOutset'>makeOutset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) const; 59 void <a href='#SkRect_offset'>offset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy); 60 void <a href='#SkRect_offset'>offset</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a>& delta); 61 void <a href='#SkRect_offsetTo'>offsetTo</a>(<a href='undocumented#SkScalar'>SkScalar</a> newX, <a href='undocumented#SkScalar'>SkScalar</a> newY); 62 void <a href='#SkRect_inset'>inset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy); 63 void <a href='#SkRect_outset'>outset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy); 64 bool <a href='#SkRect_intersect'>intersect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r); 65 bool <a href='#SkRect_intersect'>intersect</a>(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom); 66 bool <a href='#SkRect_intersect'>intersect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b); 67 bool <a href='#SkRect_intersects'>intersects</a>(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom) const; 68 bool <a href='#SkRect_intersects'>intersects</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) const; 69 static bool <a href='#SkRect_Intersects'>Intersects</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b); 70 void <a href='#SkRect_join'>join</a>(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom); 71 void <a href='#SkRect_join'>join</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r); 72 void <a href='#SkRect_joinNonEmptyArg'>joinNonEmptyArg</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r); 73 void <a href='#SkRect_joinPossiblyEmptyRect'>joinPossiblyEmptyRect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r); 74 bool <a href='#SkRect_contains'>contains</a>(<a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y) const; 75 bool <a href='#SkRect_contains'>contains</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) const; 76 bool <a href='#SkRect_contains'>contains</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& r) const; 77 void <a href='#SkRect_round'>round</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* dst) const; 78 void <a href='#SkRect_roundOut'>roundOut</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* dst) const; 79 void <a href='#SkRect_roundOut'>roundOut</a>(<a href='SkRect_Reference#SkRect'>SkRect</a>* dst) const; 80 void <a href='#SkRect_roundIn'>roundIn</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* dst) const; 81 <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkRect_round'>round()</a> const; 82 <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkRect_roundOut'>roundOut</a>() const; 83 void <a href='#SkRect_sort'>sort()</a>; 84 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeSorted'>makeSorted</a>() const; 85 const <a href='undocumented#SkScalar'>SkScalar</a>* <a href='#SkRect_asScalars'>asScalars</a>() const; 86 void <a href='#SkRect_dump'>dump</a>(bool asHex) const; 87 void <a href='#SkRect_dump'>dump()</a> const; 88 void <a href='#SkRect_dumpHex'>dumpHex</a>() const; 89 }; 90 91 </pre> 92 93 <a href='SkRect_Reference#SkRect'>SkRect</a> holds four <a href='undocumented#SkScalar'>SkScalar</a> coordinates describing the upper and 94 lower bounds of a rectangle. <a href='SkRect_Reference#SkRect'>SkRect</a> may be created from outer bounds or 95 from position, width, and height. <a href='SkRect_Reference#SkRect'>SkRect</a> describes an area; if its right 96 is less than or equal to its left, or if its bottom is less than or equal to 97 its top, it is considered empty. 98 99 <a href='SkRect_Reference#SkRect'>SkRect</a> can be constructed from int values to avoid compiler warnings that 100 integer input cannot convert to <a href='undocumented#SkScalar'>SkScalar</a> without loss of precision.<table style='border-collapse: collapse; width: 62.5em'> 101 102 <tr><th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Type</th> 103 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Member</th> 104 <th style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>Description</th></tr> 105 <tr style='background-color: #f0f0f0; '> 106 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>SkScalar</td> 107 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRect_fLeft'><code>fLeft</code></a></td> 108 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 109 May contain any value, including infinities and NaN. The smaller of the 110 horizontal values when sorted. When equal to or greater than <a href='#SkRect_fRight'>fRight</a>, <a href='SkRect_Reference#Rect'>Rect</a> is empty. 111 </td> 112 </tr> 113 <tr> 114 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>SkScalar</td> 115 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRect_fTop'><code>fTop</code></a></td> 116 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 117 May contain any value, including infinities and NaN. The smaller of the 118 vertical values when sorted. When equal to or greater than <a href='#SkRect_fBottom'>fBottom</a>, <a href='SkRect_Reference#Rect'>Rect</a> is empty. 119 </td> 120 </tr> 121 <tr style='background-color: #f0f0f0; '> 122 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>SkScalar</td> 123 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRect_fRight'><code>fRight</code></a></td> 124 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 125 May contain any value, including infinities and NaN. The larger of the 126 horizontal values when sorted. When equal to or less than <a href='#SkRect_fLeft'>fLeft</a>, <a href='SkRect_Reference#Rect'>Rect</a> is empty. 127 </td> 128 </tr> 129 <tr> 130 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '>SkScalar</td> 131 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '><a name='SkRect_fBottom'><code>fBottom</code></a></td> 132 <td style='text-align: left; border: 2px solid #dddddd; padding: 8px; '> 133 May contain any value, including infinities and NaN. The larger of the 134 vertical values when sorted. When equal to or less than <a href='#SkRect_fTop'>fTop</a>, <a href='SkRect_Reference#Rect'>Rect</a> is empty. 135 </td> 136 </tr> 137 </table> 138 139 <a name='SkRect_MakeEmpty'></a> 140 141 --- 142 143 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 144 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeEmpty'>MakeEmpty</a>() 145 </pre> 146 147 Returns constructed <a href='SkRect_Reference#SkRect'>SkRect</a> set to (0, 0, 0, 0). 148 Many other rectangles are empty; if left is equal to or greater than right, 149 or if top is equal to or greater than bottom. Setting all members to zero 150 is a convenience, but does not designate a special empty rectangle. 151 152 ### Return Value 153 154 bounds (0, 0, 0, 0) 155 156 ### Example 157 158 <div><fiddle-embed name="2e262d0ac4b8ef51695e0525fc3ecdf6"> 159 160 #### Example Output 161 162 ~~~~ 163 MakeEmpty isEmpty: true 164 offset rect isEmpty: true 165 inset rect isEmpty: true 166 outset rect isEmpty: false 167 ~~~~ 168 169 </fiddle-embed></div> 170 171 ### See Also 172 173 <a href='#SkRect_isEmpty'>isEmpty</a> <a href='#SkRect_setEmpty'>setEmpty</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeEmpty'>MakeEmpty</a> 174 175 <a name='SkRect_MakeWH'></a> 176 177 --- 178 179 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 180 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeWH'>MakeWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> w, <a href='undocumented#SkScalar'>SkScalar</a> h) 181 </pre> 182 183 Returns constructed <a href='SkRect_Reference#SkRect'>SkRect</a> set to <a href='undocumented#SkScalar'>SkScalar</a> values (0, 0, <a href='#SkRect_MakeWH_w'>w</a>, <a href='#SkRect_MakeWH_h'>h</a>). Does not 184 validate input; <a href='#SkRect_MakeWH_w'>w</a> or <a href='#SkRect_MakeWH_h'>h</a> may be negative. 185 186 Passing integer values may generate a compiler warning since <a href='SkRect_Reference#SkRect'>SkRect</a> cannot 187 represent 32-bit integers exactly. Use <a href='SkIRect_Reference#SkIRect'>SkIRect</a> for an exact integer rectangle. 188 189 ### Parameters 190 191 <table> <tr> <td><a name='SkRect_MakeWH_w'><code><strong>w</strong></code></a></td> 192 <td><a href='undocumented#SkScalar'>SkScalar</a> width of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 193 </tr> 194 <tr> <td><a name='SkRect_MakeWH_h'><code><strong>h</strong></code></a></td> 195 <td><a href='undocumented#SkScalar'>SkScalar</a> height of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 196 </tr> 197 </table> 198 199 ### Return Value 200 201 bounds (0, 0, <a href='#SkRect_MakeWH_w'>w</a>, <a href='#SkRect_MakeWH_h'>h</a>) 202 203 ### Example 204 205 <div><fiddle-embed name="8009d30f431e01f8aea4808e9017d9bf"> 206 207 #### Example Output 208 209 ~~~~ 210 all equal 211 ~~~~ 212 213 </fiddle-embed></div> 214 215 ### See Also 216 217 <a href='#SkRect_MakeSize'>MakeSize</a> <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='#SkRect_MakeIWH'>MakeIWH</a> <a href='#SkRect_setWH'>setWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeWH'>MakeWH</a> 218 219 <a name='SkRect_MakeIWH'></a> 220 221 --- 222 223 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 224 static <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeIWH'>MakeIWH</a>(int w, int h) 225 </pre> 226 227 Returns constructed <a href='SkRect_Reference#SkRect'>SkRect</a> set to integer values (0, 0, <a href='#SkRect_MakeIWH_w'>w</a>, <a href='#SkRect_MakeIWH_h'>h</a>). Does not validate 228 input; <a href='#SkRect_MakeIWH_w'>w</a> or <a href='#SkRect_MakeIWH_h'>h</a> may be negative. 229 230 Use to avoid a compiler warning that input may lose precision when stored. 231 Use <a href='SkIRect_Reference#SkIRect'>SkIRect</a> for an exact integer rectangle. 232 233 ### Parameters 234 235 <table> <tr> <td><a name='SkRect_MakeIWH_w'><code><strong>w</strong></code></a></td> 236 <td>integer width of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 237 </tr> 238 <tr> <td><a name='SkRect_MakeIWH_h'><code><strong>h</strong></code></a></td> 239 <td>integer height of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 240 </tr> 241 </table> 242 243 ### Return Value 244 245 bounds (0, 0, <a href='#SkRect_MakeIWH_w'>w</a>, <a href='#SkRect_MakeIWH_h'>h</a>) 246 247 ### Example 248 249 <div><fiddle-embed name="faa660ac19eaddc3f3eab57a0bddfdcb"> 250 251 #### Example Output 252 253 ~~~~ 254 i_rect width: 25 f_rect width:25 255 i_rect width: 125000111 f_rect width:125000112 256 ~~~~ 257 258 </fiddle-embed></div> 259 260 ### See Also 261 262 <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='#SkRect_MakeWH'>MakeWH</a> <a href='#SkRect_isetWH'>isetWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeWH'>MakeWH</a> 263 264 <a name='SkRect_MakeSize'></a> 265 266 --- 267 268 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 269 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeSize'>MakeSize</a>(const <a href='undocumented#SkSize'>SkSize</a>& <a href='undocumented#Size'>size</a>) 270 </pre> 271 272 Returns constructed <a href='SkRect_Reference#SkRect'>SkRect</a> set to (0, 0, <a href='#SkRect_MakeSize_size'>size</a>.<a href='#SkSize_width'>width()</a>, <a href='#SkRect_MakeSize_size'>size</a>.<a href='#SkSize_height'>height()</a>). Does not 273 validate input; <a href='#SkRect_MakeSize_size'>size</a>.<a href='#SkSize_width'>width()</a> or <a href='#SkRect_MakeSize_size'>size</a>.<a href='#SkSize_height'>height()</a> may be negative. 274 275 ### Parameters 276 277 <table> <tr> <td><a name='SkRect_MakeSize_size'><code><strong>size</strong></code></a></td> 278 <td><a href='undocumented#SkScalar'>SkScalar</a> values for <a href='SkRect_Reference#SkRect'>SkRect</a> width and height</td> 279 </tr> 280 </table> 281 282 ### Return Value 283 284 bounds (0, 0, <a href='#SkRect_MakeSize_size'>size</a>.<a href='#SkSize_width'>width()</a>, <a href='#SkRect_MakeSize_size'>size</a>.<a href='#SkSize_height'>height()</a>) 285 286 ### Example 287 288 <div><fiddle-embed name="ab2c1a55016c8de9172b77fdf69e00a2"> 289 290 #### Example Output 291 292 ~~~~ 293 rect width: 25.5 height: 35.5 294 floor width: 25 height: 35 295 ~~~~ 296 297 </fiddle-embed></div> 298 299 ### See Also 300 301 <a href='#SkRect_MakeWH'>MakeWH</a> <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='#SkRect_MakeIWH'>MakeIWH</a> <a href='#SkRect_setWH'>setWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeWH'>MakeWH</a> 302 303 <a name='SkRect_MakeLTRB'></a> 304 305 --- 306 307 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 308 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeLTRB'>MakeLTRB</a>(<a href='undocumented#SkScalar'>SkScalar</a> l, <a href='undocumented#SkScalar'>SkScalar</a> t, <a href='undocumented#SkScalar'>SkScalar</a> r, <a href='undocumented#SkScalar'>SkScalar</a> b) 309 </pre> 310 311 Returns constructed <a href='SkRect_Reference#SkRect'>SkRect</a> set to (<a href='#SkRect_MakeLTRB_l'>l</a>, <a href='#SkRect_MakeLTRB_t'>t</a>, <a href='#SkRect_MakeLTRB_r'>r</a>, <a href='#SkRect_MakeLTRB_b'>b</a>). Does not sort input; <a href='SkRect_Reference#SkRect'>SkRect</a> may 312 result in <a href='#SkRect_fLeft'>fLeft</a> greater than <a href='#SkRect_fRight'>fRight</a>, or <a href='#SkRect_fTop'>fTop</a> greater than <a href='#SkRect_fBottom'>fBottom</a>. 313 314 ### Parameters 315 316 <table> <tr> <td><a name='SkRect_MakeLTRB_l'><code><strong>l</strong></code></a></td> 317 <td><a href='undocumented#SkScalar'>SkScalar</a> stored in <a href='#SkRect_fLeft'>fLeft</a></td> 318 </tr> 319 <tr> <td><a name='SkRect_MakeLTRB_t'><code><strong>t</strong></code></a></td> 320 <td><a href='undocumented#SkScalar'>SkScalar</a> stored in <a href='#SkRect_fTop'>fTop</a></td> 321 </tr> 322 <tr> <td><a name='SkRect_MakeLTRB_r'><code><strong>r</strong></code></a></td> 323 <td><a href='undocumented#SkScalar'>SkScalar</a> stored in <a href='#SkRect_fRight'>fRight</a></td> 324 </tr> 325 <tr> <td><a name='SkRect_MakeLTRB_b'><code><strong>b</strong></code></a></td> 326 <td><a href='undocumented#SkScalar'>SkScalar</a> stored in <a href='#SkRect_fBottom'>fBottom</a></td> 327 </tr> 328 </table> 329 330 ### Return Value 331 332 bounds (<a href='#SkRect_MakeLTRB_l'>l</a>, <a href='#SkRect_MakeLTRB_t'>t</a>, <a href='#SkRect_MakeLTRB_r'>r</a>, <a href='#SkRect_MakeLTRB_b'>b</a>) 333 334 ### Example 335 336 <div><fiddle-embed name="158b8dd9d02d65a5ae5ab7d1595a5b4c"> 337 338 #### Example Output 339 340 ~~~~ 341 rect: 5, 35, 15, 25 isEmpty: true 342 rect: 5, 25, 15, 35 isEmpty: false 343 ~~~~ 344 345 </fiddle-embed></div> 346 347 ### See Also 348 349 <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeLTRB'>MakeLTRB</a> 350 351 <a name='SkRect_MakeXYWH'></a> 352 353 --- 354 355 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 356 static constexpr <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_MakeXYWH'>MakeXYWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y, <a href='undocumented#SkScalar'>SkScalar</a> w, <a href='undocumented#SkScalar'>SkScalar</a> h) 357 </pre> 358 359 Returns constructed <a href='SkRect_Reference#Rect'>Rect</a> set to <code>(<a href='#SkRect_MakeXYWH_x'>x</a>, <a href='#SkRect_MakeXYWH_y'>y</a>, <a href='#SkRect_MakeXYWH_x'>x</a> + <a href='#SkRect_MakeXYWH_w'>w</a>, <a href='#SkRect_MakeXYWH_y'>y</a> + <a href='#SkRect_MakeXYWH_h'>h</a>)</code>. 360 Does not validate input; <a href='#SkRect_MakeXYWH_w'>w</a> or <a href='#SkRect_MakeXYWH_h'>h</a> may be negative. 361 362 ### Parameters 363 364 <table> <tr> <td><a name='SkRect_MakeXYWH_x'><code><strong>x</strong></code></a></td> 365 <td>stored in <a href='#SkRect_fLeft'>fLeft</a></td> 366 </tr> 367 <tr> <td><a name='SkRect_MakeXYWH_y'><code><strong>y</strong></code></a></td> 368 <td>stored in <a href='#SkRect_fTop'>fTop</a></td> 369 </tr> 370 <tr> <td><a name='SkRect_MakeXYWH_w'><code><strong>w</strong></code></a></td> 371 <td>added to <a href='#SkRect_MakeXYWH_x'>x</a> and stored in <a href='#SkRect_fRight'>fRight</a></td> 372 </tr> 373 <tr> <td><a name='SkRect_MakeXYWH_h'><code><strong>h</strong></code></a></td> 374 <td>added to <a href='#SkRect_MakeXYWH_y'>y</a> and stored in <a href='#SkRect_fBottom'>fBottom</a></td> 375 </tr> 376 </table> 377 378 ### Return Value 379 380 bounds at (<a href='#SkRect_MakeXYWH_x'>x</a>, <a href='#SkRect_MakeXYWH_y'>y</a>) with width <a href='#SkRect_MakeXYWH_w'>w</a> and height <a href='#SkRect_MakeXYWH_h'>h</a> 381 382 ### Example 383 384 <div><fiddle-embed name="38e464dba13be11ac21e210fbf3b5afc"> 385 386 #### Example Output 387 388 ~~~~ 389 rect: 5, 35, -10, 60 isEmpty: true 390 rect: -10, 35, 5, 60 isEmpty: false 391 ~~~~ 392 393 </fiddle-embed></div> 394 395 ### See Also 396 397 <a href='#SkRect_MakeLTRB'>MakeLTRB</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeXYWH'>MakeXYWH</a> 398 399 <a name='SkRect_Make'></a> 400 401 --- 402 403 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 404 static <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_Make'>Make</a>(const <a href='undocumented#SkISize'>SkISize</a>& <a href='undocumented#Size'>size</a>) 405 </pre> 406 407 Returns constructed <a href='SkIRect_Reference#SkIRect'>SkIRect</a> set to (0, 0, <a href='#SkRect_Make_size'>size</a>.<a href='#SkISize_width'>width()</a>, <a href='#SkRect_Make_size'>size</a>.<a href='#SkISize_height'>height()</a>). 408 Does not validate input; <a href='#SkRect_Make_size'>size</a>.<a href='#SkISize_width'>width()</a> or <a href='#SkRect_Make_size'>size</a>.<a href='#SkISize_height'>height()</a> may be negative. 409 410 ### Parameters 411 412 <table> <tr> <td><a name='SkRect_Make_size'><code><strong>size</strong></code></a></td> 413 <td>integer values for <a href='SkRect_Reference#SkRect'>SkRect</a> width and height</td> 414 </tr> 415 </table> 416 417 ### Return Value 418 419 bounds (0, 0, <a href='#SkRect_Make_size'>size</a>.<a href='#SkISize_width'>width()</a>, <a href='#SkRect_Make_size'>size</a>.<a href='#SkISize_height'>height()</a>) 420 421 ### Example 422 423 <div><fiddle-embed name="e866f5e4f6ac52e89acadf48e54ac8e0"> 424 425 #### Example Output 426 427 ~~~~ 428 rect1 == rect2 429 ~~~~ 430 431 </fiddle-embed></div> 432 433 ### See Also 434 435 <a href='#SkRect_MakeWH'>MakeWH</a> <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='SkRect_Reference#SkRect'>SkRect</a>::<a href='#SkRect_MakeIWH'>MakeIWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_MakeSize'>MakeSize</a> 436 437 <a name='SkRect_Make_2'></a> 438 439 --- 440 441 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 442 static <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_Make'>Make</a>(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& irect) 443 </pre> 444 445 Returns constructed <a href='SkIRect_Reference#SkIRect'>SkIRect</a> set to <a href='#SkRect_Make_2_irect'>irect</a>, promoting integers to <a href='undocumented#Scalar'>scalar</a>. 446 Does not validate input; <a href='#SkRect_fLeft'>fLeft</a> may be greater than <a href='#SkRect_fRight'>fRight</a>, <a href='#SkRect_fTop'>fTop</a> may be greater 447 than <a href='#SkRect_fBottom'>fBottom</a>. 448 449 ### Parameters 450 451 <table> <tr> <td><a name='SkRect_Make_2_irect'><code><strong>irect</strong></code></a></td> 452 <td>integer unsorted bounds</td> 453 </tr> 454 </table> 455 456 ### Return Value 457 458 <a href='#SkRect_Make_2_irect'>irect</a> members converted to <a href='undocumented#SkScalar'>SkScalar</a> 459 460 ### Example 461 462 <div><fiddle-embed name="dd801faa1e60a0fe9e0657674461e063"></fiddle-embed></div> 463 464 ### See Also 465 466 <a href='#SkRect_MakeLTRB'>MakeLTRB</a> 467 468 <a name='Property'></a> 469 470 <a name='SkRect_isEmpty'></a> 471 472 --- 473 474 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 475 bool <a href='#SkRect_isEmpty'>isEmpty</a>()const 476 </pre> 477 478 Returns true if <a href='#SkRect_fLeft'>fLeft</a> is equal to or greater than <a href='#SkRect_fRight'>fRight</a>, or if <a href='#SkRect_fTop'>fTop</a> is equal 479 to or greater than <a href='#SkRect_fBottom'>fBottom</a>. Call <a href='#SkRect_sort'>sort()</a> to reverse rectangles with negative 480 <a href='#SkRect_width'>width()</a> or <a href='#SkRect_height'>height()</a>. 481 482 ### Return Value 483 484 true if <a href='#SkRect_width'>width()</a> or <a href='#SkRect_height'>height()</a> are zero or negative 485 486 ### Example 487 488 <div><fiddle-embed name="1d7b924d6ca2a6aef09684a8a632439c"> 489 490 #### Example Output 491 492 ~~~~ 493 rect: {20, 40, 10, 50} is empty 494 sorted: {10, 40, 20, 50} is not empty 495 rect: {20, 40, 20, 50} is empty 496 sorted: {20, 40, 20, 50} is empty 497 ~~~~ 498 499 </fiddle-embed></div> 500 501 ### See Also 502 503 <a href='#SkRect_MakeEmpty'>MakeEmpty</a> <a href='#SkRect_sort'>sort</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_isEmpty'>isEmpty</a> 504 505 <a name='SkRect_isSorted'></a> 506 507 --- 508 509 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 510 bool <a href='#SkRect_isSorted'>isSorted</a>()const 511 </pre> 512 513 Returns true if <a href='#SkRect_fLeft'>fLeft</a> is equal to or less than <a href='#SkRect_fRight'>fRight</a>, or if <a href='#SkRect_fTop'>fTop</a> is equal 514 to or less than <a href='#SkRect_fBottom'>fBottom</a>. Call <a href='#SkRect_sort'>sort()</a> to reverse rectangles with negative 515 <a href='#SkRect_width'>width()</a> or <a href='#SkRect_height'>height()</a>. 516 517 ### Return Value 518 519 true if <a href='#SkRect_width'>width()</a> or <a href='#SkRect_height'>height()</a> are zero or positive 520 521 ### Example 522 523 <div><fiddle-embed name="c7065a83b220a96f903dbbb65906fe7b"> 524 525 #### Example Output 526 527 ~~~~ 528 rect: {20, 40, 10, 50} is not sorted 529 sorted: {10, 40, 20, 50} is sorted 530 rect: {20, 40, 20, 50} is sorted 531 sorted: {20, 40, 20, 50} is sorted 532 ~~~~ 533 534 </fiddle-embed></div> 535 536 ### See Also 537 538 <a href='#SkRect_sort'>sort</a> <a href='#SkRect_makeSorted'>makeSorted</a> <a href='#SkRect_isEmpty'>isEmpty</a> 539 540 <a name='SkRect_isFinite'></a> 541 542 --- 543 544 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 545 bool <a href='#SkRect_isFinite'>isFinite</a>()const 546 </pre> 547 548 Returns true if all values in the rectangle are finite: <a href='undocumented#SK_ScalarMin'>SK_ScalarMin</a> or larger, 549 and <a href='undocumented#SK_ScalarMax'>SK_ScalarMax</a> or smaller. 550 551 ### Return Value 552 553 true if no member is infinite or NaN 554 555 ### Example 556 557 <div><fiddle-embed name="443fe5f8296d4cdb19cc9862a9cf77a4"> 558 559 #### Example Output 560 561 ~~~~ 562 largest is finite: true 563 large width inf 564 widest is finite: false 565 ~~~~ 566 567 </fiddle-embed></div> 568 569 ### See Also 570 571 <a href='undocumented#SkScalarIsFinite'>SkScalarIsFinite</a> <a href='undocumented#SkScalarIsNaN'>SkScalarIsNaN</a> 572 573 <a name='SkRect_x'></a> 574 575 --- 576 577 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 578 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_x'>x()</a>const 579 </pre> 580 581 Returns left edge of <a href='SkRect_Reference#SkRect'>SkRect</a>, if sorted. Call <a href='#SkRect_isSorted'>isSorted</a>() to see if <a href='SkRect_Reference#SkRect'>SkRect</a> is valid. 582 Call <a href='#SkRect_sort'>sort()</a> to reverse <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a> if needed. 583 584 ### Return Value 585 586 <a href='#SkRect_fLeft'>fLeft</a> 587 588 ### Example 589 590 <div><fiddle-embed name="23c77a35ac54a439a2989f840aa5cb99"> 591 592 #### Example Output 593 594 ~~~~ 595 unsorted.fLeft: 15 unsorted.x(): 15 596 sorted.fLeft: 10 sorted.x(): 10 597 ~~~~ 598 599 </fiddle-embed></div> 600 601 ### See Also 602 603 <a href='#SkRect_fLeft'>fLeft</a> <a href='#SkRect_left'>left()</a> <a href='#SkRect_y'>y()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_x'>x()</a> 604 605 <a name='SkRect_y'></a> 606 607 --- 608 609 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 610 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_y'>y()</a>const 611 </pre> 612 613 Returns top edge of <a href='SkRect_Reference#SkRect'>SkRect</a>, if sorted. Call <a href='#SkRect_isEmpty'>isEmpty</a>() to see if <a href='SkRect_Reference#SkRect'>SkRect</a> may be invalid, 614 and <a href='#SkRect_sort'>sort()</a> to reverse <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a> if needed. 615 616 ### Return Value 617 618 <a href='#SkRect_fTop'>fTop</a> 619 620 ### Example 621 622 <div><fiddle-embed name="c653d9017983d2a047b1fee6a481d82b"> 623 624 #### Example Output 625 626 ~~~~ 627 unsorted.fTop: 25 unsorted.y(): 25 628 sorted.fTop: 5 sorted.y(): 5 629 ~~~~ 630 631 </fiddle-embed></div> 632 633 ### See Also 634 635 <a href='#SkRect_fTop'>fTop</a> <a href='#SkRect_top'>top()</a> <a href='#SkRect_x'>x()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_y'>y()</a> 636 637 <a name='SkRect_left'></a> 638 639 --- 640 641 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 642 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_left'>left()</a>const 643 </pre> 644 645 Returns left edge of <a href='SkRect_Reference#SkRect'>SkRect</a>, if sorted. Call <a href='#SkRect_isSorted'>isSorted</a>() to see if <a href='SkRect_Reference#SkRect'>SkRect</a> is valid. 646 Call <a href='#SkRect_sort'>sort()</a> to reverse <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a> if needed. 647 648 ### Return Value 649 650 <a href='#SkRect_fLeft'>fLeft</a> 651 652 ### Example 653 654 <div><fiddle-embed name="900dc96c3549795a87036d6458c4fde6"> 655 656 #### Example Output 657 658 ~~~~ 659 unsorted.fLeft: 15 unsorted.left(): 15 660 sorted.fLeft: 10 sorted.left(): 10 661 ~~~~ 662 663 </fiddle-embed></div> 664 665 ### See Also 666 667 <a href='#SkRect_fLeft'>fLeft</a> <a href='#SkRect_x'>x()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_left'>left()</a> 668 669 <a name='SkRect_top'></a> 670 671 --- 672 673 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 674 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_top'>top()</a>const 675 </pre> 676 677 Returns top edge of <a href='SkRect_Reference#SkRect'>SkRect</a>, if sorted. Call <a href='#SkRect_isEmpty'>isEmpty</a>() to see if <a href='SkRect_Reference#SkRect'>SkRect</a> may be invalid, 678 and <a href='#SkRect_sort'>sort()</a> to reverse <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a> if needed. 679 680 ### Return Value 681 682 <a href='#SkRect_fTop'>fTop</a> 683 684 ### Example 685 686 <div><fiddle-embed name="3cfc24b011aef1ca8ccb57c05711620c"> 687 688 #### Example Output 689 690 ~~~~ 691 unsorted.fTop: 25 unsorted.top(): 25 692 sorted.fTop: 5 sorted.top(): 5 693 ~~~~ 694 695 </fiddle-embed></div> 696 697 ### See Also 698 699 <a href='#SkRect_fTop'>fTop</a> <a href='#SkRect_y'>y()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_top'>top()</a> 700 701 <a name='SkRect_right'></a> 702 703 --- 704 705 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 706 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_right'>right()</a>const 707 </pre> 708 709 Returns right edge of <a href='SkRect_Reference#SkRect'>SkRect</a>, if sorted. Call <a href='#SkRect_isSorted'>isSorted</a>() to see if <a href='SkRect_Reference#SkRect'>SkRect</a> is valid. 710 Call <a href='#SkRect_sort'>sort()</a> to reverse <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a> if needed. 711 712 ### Return Value 713 714 <a href='#SkRect_fRight'>fRight</a> 715 716 ### Example 717 718 <div><fiddle-embed name="ca3de7e5e292b3ad3633b1c39a31d3ab"> 719 720 #### Example Output 721 722 ~~~~ 723 unsorted.fRight: 10 unsorted.right(): 10 724 sorted.fRight: 15 sorted.right(): 15 725 ~~~~ 726 727 </fiddle-embed></div> 728 729 ### See Also 730 731 <a href='#SkRect_fRight'>fRight</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_right'>right()</a> 732 733 <a name='SkRect_bottom'></a> 734 735 --- 736 737 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 738 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_bottom'>bottom()</a>const 739 </pre> 740 741 Returns bottom edge of <a href='SkRect_Reference#SkRect'>SkRect</a>, if sorted. Call <a href='#SkRect_isEmpty'>isEmpty</a>() to see if <a href='SkRect_Reference#SkRect'>SkRect</a> may be invalid, 742 and <a href='#SkRect_sort'>sort()</a> to reverse <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a> if needed. 743 744 ### Return Value 745 746 <a href='#SkRect_fBottom'>fBottom</a> 747 748 ### Example 749 750 <div><fiddle-embed name="a98993a66616ae406d8bdc54adfb1411"> 751 752 #### Example Output 753 754 ~~~~ 755 unsorted.fBottom: 5 unsorted.bottom(): 5 756 sorted.fBottom: 25 sorted.bottom(): 25 757 ~~~~ 758 759 </fiddle-embed></div> 760 761 ### See Also 762 763 <a href='#SkRect_fBottom'>fBottom</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_bottom'>bottom()</a> 764 765 <a name='SkRect_width'></a> 766 767 --- 768 769 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 770 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_width'>width()</a>const 771 </pre> 772 773 Returns span on the x-axis. This does not check if <a href='SkRect_Reference#SkRect'>SkRect</a> is sorted, or if 774 result fits in 32-bit float; result may be negative or infinity. 775 776 ### Return Value 777 778 <a href='#SkRect_fRight'>fRight</a> minus <a href='#SkRect_fLeft'>fLeft</a> 779 780 ### Example 781 782 <div><fiddle-embed name="11f8f0efe6291019fee0ac17844f6c1a"><div>Compare with <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_width'>width()</a> example. 783 </div> 784 785 #### Example Output 786 787 ~~~~ 788 unsorted width: -5 789 large width: 4294967296 790 ~~~~ 791 792 </fiddle-embed></div> 793 794 ### See Also 795 796 <a href='#SkRect_height'>height()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_width'>width()</a> 797 798 <a name='SkRect_height'></a> 799 800 --- 801 802 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 803 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_height'>height()</a>const 804 </pre> 805 806 Returns span on the y-axis. This does not check if <a href='SkRect_Reference#SkRect'>SkRect</a> is sorted, or if 807 result fits in 32-bit float; result may be negative or infinity. 808 809 ### Return Value 810 811 <a href='#SkRect_fBottom'>fBottom</a> minus <a href='#SkRect_fTop'>fTop</a> 812 813 ### Example 814 815 <div><fiddle-embed name="39429e45f05240218ecd511443ab3e44"><div>Compare with <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_height'>height()</a> example. 816 </div> 817 818 #### Example Output 819 820 ~~~~ 821 unsorted height: -5 822 large height: 4294967296 823 ~~~~ 824 825 </fiddle-embed></div> 826 827 ### See Also 828 829 <a href='#SkRect_width'>width()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_height'>height()</a> 830 831 <a name='SkRect_centerX'></a> 832 833 --- 834 835 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 836 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_centerX'>centerX</a>()const 837 </pre> 838 839 Returns average of left edge and right edge. Result does not change if <a href='SkRect_Reference#SkRect'>SkRect</a> 840 is sorted. Result may overflow to infinity if <a href='SkRect_Reference#SkRect'>SkRect</a> is far from the origin. 841 842 ### Return Value 843 844 midpoint on x-axis 845 846 ### Example 847 848 <div><fiddle-embed name="d8439ba8d23a424fa032fb97147fd2d2"> 849 850 #### Example Output 851 852 ~~~~ 853 left: 20 right: 41 centerX: 30.5 854 left: 20 right: 41 centerX: 30.5 855 left: -20 right: -41 centerX: -30.5 856 left: -41 right: -20 centerX: -30.5 857 ~~~~ 858 859 </fiddle-embed></div> 860 861 ### See Also 862 863 <a href='#SkRect_centerY'>centerY</a> 864 865 <a name='SkRect_centerY'></a> 866 867 --- 868 869 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 870 <a href='undocumented#SkScalar'>SkScalar</a> <a href='#SkRect_centerY'>centerY</a>()const 871 </pre> 872 873 Returns average of top edge and bottom edge. Result does not change if <a href='SkRect_Reference#SkRect'>SkRect</a> 874 is sorted. 875 876 ### Return Value 877 878 midpoint on y-axis 879 880 ### Example 881 882 <div><fiddle-embed name="ebeeafafeb8fe39d5ffc9115b02c2340"> 883 884 #### Example Output 885 886 ~~~~ 887 left: 2e+38 right: 3e+38 centerX: 2.5e+38 safe mid x: 2.5e+38 888 ~~~~ 889 890 </fiddle-embed></div> 891 892 ### See Also 893 894 <a href='#SkRect_centerX'>centerX</a> 895 896 <a name='Operators'></a> 897 898 <a name='SkRect_equal_operator'></a> 899 900 --- 901 902 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 903 bool <a href='#SkRect_equal_operator'>operator==</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b) 904 </pre> 905 906 Returns true if all members in <a href='#SkRect_equal_operator_a'>a</a>: <a href='#SkRect_fLeft'>fLeft</a>, <a href='#SkRect_fTop'>fTop</a>, <a href='#SkRect_fRight'>fRight</a>, and <a href='#SkRect_fBottom'>fBottom</a>; are 907 equal to the corresponding members in <a href='#SkRect_equal_operator_b'>b</a>. 908 909 <a href='#SkRect_equal_operator_a'>a</a> and <a href='#SkRect_equal_operator_b'>b</a> are not equal if either contain NaN. <a href='#SkRect_equal_operator_a'>a</a> and <a href='#SkRect_equal_operator_b'>b</a> are equal if members 910 contain zeroes with different signs. 911 912 ### Parameters 913 914 <table> <tr> <td><a name='SkRect_equal_operator_a'><code><strong>a</strong></code></a></td> 915 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to compare</td> 916 </tr> 917 <tr> <td><a name='SkRect_equal_operator_b'><code><strong>b</strong></code></a></td> 918 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to compare</td> 919 </tr> 920 </table> 921 922 ### Return Value 923 924 true if members are equal 925 926 ### Example 927 928 <div><fiddle-embed name="c6c5b40cad7c3a839fdf576b380391a6"> 929 930 #### Example Output 931 932 ~~~~ 933 tests are equal 934 {0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal 935 {0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal 936 {0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal 937 ~~~~ 938 939 </fiddle-embed></div> 940 941 ### See Also 942 943 <a href='#SkRect_notequal_operator'>operator!=</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRect_equal_operator_a'>a</a>, const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRect_equal_operator_b'>b</a>) 944 945 <a name='SkRect_notequal_operator'></a> 946 947 --- 948 949 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 950 bool <a href='#SkRect_notequal_operator'>operator!=</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b) 951 </pre> 952 953 Returns true if any in <a href='#SkRect_notequal_operator_a'>a</a>: <a href='#SkRect_fLeft'>fLeft</a>, <a href='#SkRect_fTop'>fTop</a>, <a href='#SkRect_fRight'>fRight</a>, and <a href='#SkRect_fBottom'>fBottom</a>; does not 954 equal the corresponding members in <a href='#SkRect_notequal_operator_b'>b</a>. 955 956 <a href='#SkRect_notequal_operator_a'>a</a> and <a href='#SkRect_notequal_operator_b'>b</a> are not equal if either contain NaN. <a href='#SkRect_notequal_operator_a'>a</a> and <a href='#SkRect_notequal_operator_b'>b</a> are equal if members 957 contain zeroes with different signs. 958 959 ### Parameters 960 961 <table> <tr> <td><a name='SkRect_notequal_operator_a'><code><strong>a</strong></code></a></td> 962 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to compare</td> 963 </tr> 964 <tr> <td><a name='SkRect_notequal_operator_b'><code><strong>b</strong></code></a></td> 965 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to compare</td> 966 </tr> 967 </table> 968 969 ### Return Value 970 971 true if members are not equal 972 973 ### Example 974 975 <div><fiddle-embed name="286072f8c27ff15be9eb945fa38dc9f7"> 976 977 #### Example Output 978 979 ~~~~ 980 test with NaN is not equal to itself 981 ~~~~ 982 983 </fiddle-embed></div> 984 985 ### See Also 986 987 <a href='#SkRect_equal_operator'>operator==</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRect_notequal_operator_a'>a</a>, const <a href='SkRect_Reference#SkRect'>SkRect</a>& <a href='#SkRect_notequal_operator_b'>b</a>) 988 989 <a name='As_Points'></a> 990 991 <a name='SkRect_toQuad'></a> 992 993 --- 994 995 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 996 void <a href='#SkRect_toQuad'>toQuad</a>(<a href='SkPoint_Reference#SkPoint'>SkPoint</a> <a href='SkPath_Reference#Quad'>quad</a>[4])const 997 </pre> 998 999 Returns four <a href='SkPoint_Reference#Point'>points</a> in <a href='#SkRect_toQuad_quad'>quad</a> that enclose <a href='SkRect_Reference#SkRect'>SkRect</a> ordered as: top-left, top-right, 1000 bottom-right, bottom-left. 1001 1002 ### Parameters 1003 1004 <table> <tr> <td><a name='SkRect_toQuad_quad'><code><strong>quad</strong></code></a></td> 1005 <td>storage for corners of <a href='SkRect_Reference#SkRect'>SkRect</a></td> 1006 </tr> 1007 </table> 1008 1009 ### Example 1010 1011 <div><fiddle-embed name="59a6e7d202ac17ab80ec21b233e51f59"> 1012 1013 #### Example Output 1014 1015 ~~~~ 1016 rect: {1, 2, 3, 4} 1017 corners: {1, 2} {3, 2} {3, 4} {1, 4} 1018 ~~~~ 1019 1020 </fiddle-embed></div> 1021 1022 ### See Also 1023 1024 <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_addRect'>addRect</a> 1025 1026 <a name='SkRect_setBounds'></a> 1027 1028 --- 1029 1030 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1031 void <a href='#SkRect_setBounds'>setBounds</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count) 1032 </pre> 1033 1034 Sets to bounds of <a href='SkPath_Reference#Point_Array'>SkPoint array</a> with <a href='#SkRect_setBounds_count'>count</a> entries. If <a href='#SkRect_setBounds_count'>count</a> is zero or smaller, 1035 or if <a href='SkPath_Reference#Point_Array'>SkPoint array</a> contains an infinity or NaN, sets to (0, 0, 0, 0). 1036 1037 Result is either empty or sorted: <a href='#SkRect_fLeft'>fLeft</a> is less than or equal to <a href='#SkRect_fRight'>fRight</a>, and 1038 <a href='#SkRect_fTop'>fTop</a> is less than or equal to <a href='#SkRect_fBottom'>fBottom</a>. 1039 1040 ### Parameters 1041 1042 <table> <tr> <td><a name='SkRect_setBounds_pts'><code><strong>pts</strong></code></a></td> 1043 <td><a href='SkPath_Reference#Point_Array'>SkPoint array</a></td> 1044 </tr> 1045 <tr> <td><a name='SkRect_setBounds_count'><code><strong>count</strong></code></a></td> 1046 <td>entries in array</td> 1047 </tr> 1048 </table> 1049 1050 ### Example 1051 1052 <div><fiddle-embed name="cf0da15f48aa54fd1889e7f913601710"> 1053 1054 #### Example Output 1055 1056 ~~~~ 1057 count: 0 rect: 0, 0, 0, 0 1058 added: 3, 4 count: 1 rect: 3, 4, 3, 4 1059 added: 1, 2 count: 2 rect: 1, 2, 3, 4 1060 added: 5, 6 count: 3 rect: 1, 2, 5, 6 1061 added: nan, 8 count: 4 rect: 0, 0, 0, 0 1062 ~~~~ 1063 1064 </fiddle-embed></div> 1065 1066 ### See Also 1067 1068 <a href='#SkRect_set'>set</a> <a href='#SkRect_setBoundsCheck'>setBoundsCheck</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_addPoly'>addPoly</a> 1069 1070 <a name='SkRect_setBoundsCheck'></a> 1071 1072 --- 1073 1074 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1075 bool <a href='#SkRect_setBoundsCheck'>setBoundsCheck</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count) 1076 </pre> 1077 1078 Sets to bounds of <a href='SkPath_Reference#Point_Array'>SkPoint array</a> with <a href='#SkRect_setBoundsCheck_count'>count</a> entries. Returns false if <a href='#SkRect_setBoundsCheck_count'>count</a> is 1079 zero or smaller, or if <a href='SkPath_Reference#Point_Array'>SkPoint array</a> contains an infinity or NaN; in these cases 1080 sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (0, 0, 0, 0). 1081 1082 Result is either empty or sorted: <a href='#SkRect_fLeft'>fLeft</a> is less than or equal to <a href='#SkRect_fRight'>fRight</a>, and 1083 <a href='#SkRect_fTop'>fTop</a> is less than or equal to <a href='#SkRect_fBottom'>fBottom</a>. 1084 1085 ### Parameters 1086 1087 <table> <tr> <td><a name='SkRect_setBoundsCheck_pts'><code><strong>pts</strong></code></a></td> 1088 <td><a href='SkPath_Reference#Point_Array'>SkPoint array</a></td> 1089 </tr> 1090 <tr> <td><a name='SkRect_setBoundsCheck_count'><code><strong>count</strong></code></a></td> 1091 <td>entries in array</td> 1092 </tr> 1093 </table> 1094 1095 ### Return Value 1096 1097 true if all <a href='SkPoint_Reference#SkPoint'>SkPoint</a> values are finite 1098 1099 ### Example 1100 1101 <div><fiddle-embed name="83d879b92683b15f9daaf0c9e71c5b35"> 1102 1103 #### Example Output 1104 1105 ~~~~ 1106 count: 0 rect: 0, 0, 0, 0 success: true 1107 added: 3, 4 count: 1 rect: 3, 4, 3, 4 success: true 1108 added: 1, 2 count: 2 rect: 1, 2, 3, 4 success: true 1109 added: 5, 6 count: 3 rect: 1, 2, 5, 6 success: true 1110 added: nan, 8 count: 4 rect: 0, 0, 0, 0 success: false 1111 ~~~~ 1112 1113 </fiddle-embed></div> 1114 1115 ### See Also 1116 1117 <a href='#SkRect_set'>set</a> <a href='#SkRect_setBounds'>setBounds</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_addPoly'>addPoly</a> 1118 1119 <a name='Set'></a> 1120 1121 <a name='SkRect_setBoundsNoCheck'></a> 1122 1123 --- 1124 1125 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1126 void <a href='#SkRect_setBoundsNoCheck'>setBoundsNoCheck</a>(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count) 1127 </pre> 1128 1129 Sets to bounds of <a href='SkPoint_Reference#SkPoint'>SkPoint</a> <a href='#SkRect_setBoundsNoCheck_pts'>pts</a> array with <a href='#SkRect_setBoundsNoCheck_count'>count</a> entries. If any <a href='SkPoint_Reference#SkPoint'>SkPoint</a> in <a href='#SkRect_setBoundsNoCheck_pts'>pts</a> 1130 contains infinity or NaN, all <a href='SkRect_Reference#SkRect'>SkRect</a> dimensions are set to NaN. 1131 1132 ### Parameters 1133 1134 <table> <tr> <td><a name='SkRect_setBoundsNoCheck_pts'><code><strong>pts</strong></code></a></td> 1135 <td><a href='SkPath_Reference#Point_Array'>SkPoint array</a></td> 1136 </tr> 1137 <tr> <td><a name='SkRect_setBoundsNoCheck_count'><code><strong>count</strong></code></a></td> 1138 <td>entries in array</td> 1139 </tr> 1140 </table> 1141 1142 ### Example 1143 1144 <div><fiddle-embed name="be10cb1411dbcf7e38e0198e8a9b8b0e"></fiddle-embed></div> 1145 1146 ### See Also 1147 1148 <a href='#SkRect_setBoundsCheck'>setBoundsCheck</a> 1149 1150 <a name='SkRect_setEmpty'></a> 1151 1152 --- 1153 1154 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1155 void <a href='#SkRect_setEmpty'>setEmpty</a>() 1156 </pre> 1157 1158 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (0, 0, 0, 0). 1159 1160 Many other rectangles are empty; if left is equal to or greater than right, 1161 or if top is equal to or greater than bottom. Setting all members to zero 1162 is a convenience, but does not designate a special empty rectangle. 1163 1164 ### Example 1165 1166 <div><fiddle-embed name="2cf67542d45ef5d7a7efb673b651ff54"> 1167 1168 #### Example Output 1169 1170 ~~~~ 1171 rect: {3, 4, 1, 2} is empty 1172 rect: {0, 0, 0, 0} is empty 1173 ~~~~ 1174 1175 </fiddle-embed></div> 1176 1177 ### See Also 1178 1179 <a href='#SkRect_MakeEmpty'>MakeEmpty</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_setEmpty'>setEmpty</a> 1180 1181 <a name='SkRect_set'></a> 1182 1183 --- 1184 1185 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1186 void set(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& src) 1187 </pre> 1188 1189 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to <a href='#SkRect_set_src'>src</a>, promoting <a href='#SkRect_set_src'>src</a> members from integer to <a href='undocumented#Scalar'>scalar</a>. 1190 Very large values in <a href='#SkRect_set_src'>src</a> may lose precision. 1191 1192 ### Parameters 1193 1194 <table> <tr> <td><a name='SkRect_set_src'><code><strong>src</strong></code></a></td> 1195 <td>integer <a href='SkRect_Reference#SkRect'>SkRect</a></td> 1196 </tr> 1197 </table> 1198 1199 ### Example 1200 1201 <div><fiddle-embed name="a10ad8d97062bc3f40942f47e5108917"> 1202 1203 #### Example Output 1204 1205 ~~~~ 1206 i_rect: {3, 4, 1, 2} 1207 f_rect: {3, 4, 1, 2} 1208 ~~~~ 1209 1210 </fiddle-embed></div> 1211 1212 ### See Also 1213 1214 <a href='#SkRect_setLTRB'>setLTRB</a> <a href='undocumented#SkIntToScalar'>SkIntToScalar</a> 1215 1216 <a name='SkRect_set_2'></a> 1217 1218 --- 1219 1220 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1221 void set(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom) 1222 </pre> 1223 1224 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (<a href='#SkRect_set_2_left'>left</a>, <a href='#SkRect_set_2_top'>top</a>, <a href='#SkRect_set_2_right'>right</a>, <a href='#SkRect_set_2_bottom'>bottom</a>). 1225 <a href='#SkRect_set_2_left'>left</a> and <a href='#SkRect_set_2_right'>right</a> are not sorted; <a href='#SkRect_set_2_left'>left</a> is not necessarily less than <a href='#SkRect_set_2_right'>right</a>. 1226 <a href='#SkRect_set_2_top'>top</a> and <a href='#SkRect_set_2_bottom'>bottom</a> are not sorted; <a href='#SkRect_set_2_top'>top</a> is not necessarily less than <a href='#SkRect_set_2_bottom'>bottom</a>. 1227 1228 ### Parameters 1229 1230 <table> <tr> <td><a name='SkRect_set_2_left'><code><strong>left</strong></code></a></td> 1231 <td>stored in <a href='#SkRect_fLeft'>fLeft</a></td> 1232 </tr> 1233 <tr> <td><a name='SkRect_set_2_top'><code><strong>top</strong></code></a></td> 1234 <td>stored in <a href='#SkRect_fTop'>fTop</a></td> 1235 </tr> 1236 <tr> <td><a name='SkRect_set_2_right'><code><strong>right</strong></code></a></td> 1237 <td>stored in <a href='#SkRect_fRight'>fRight</a></td> 1238 </tr> 1239 <tr> <td><a name='SkRect_set_2_bottom'><code><strong>bottom</strong></code></a></td> 1240 <td>stored in <a href='#SkRect_fBottom'>fBottom</a></td> 1241 </tr> 1242 </table> 1243 1244 ### Example 1245 1246 <div><fiddle-embed name="9b29ea460d69b4d47323fd9e3e17721e"> 1247 1248 #### Example Output 1249 1250 ~~~~ 1251 rect1: {3, 4, 1, 2} 1252 rect2: {3, 4, 1, 2} 1253 ~~~~ 1254 1255 </fiddle-embed></div> 1256 1257 ### See Also 1258 1259 <a href='#SkRect_setLTRB'>setLTRB</a> <a href='#SkRect_setXYWH'>setXYWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_set'>set</a> 1260 1261 <a name='SkRect_setLTRB'></a> 1262 1263 --- 1264 1265 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1266 void <a href='#SkRect_setLTRB'>setLTRB</a>(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom) 1267 </pre> 1268 1269 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (<a href='#SkRect_setLTRB_left'>left</a>, <a href='#SkRect_setLTRB_top'>top</a>, <a href='#SkRect_setLTRB_right'>right</a>, <a href='#SkRect_setLTRB_bottom'>bottom</a>). 1270 <a href='#SkRect_setLTRB_left'>left</a> and <a href='#SkRect_setLTRB_right'>right</a> are not sorted; <a href='#SkRect_setLTRB_left'>left</a> is not necessarily less than <a href='#SkRect_setLTRB_right'>right</a>. 1271 <a href='#SkRect_setLTRB_top'>top</a> and <a href='#SkRect_setLTRB_bottom'>bottom</a> are not sorted; <a href='#SkRect_setLTRB_top'>top</a> is not necessarily less than <a href='#SkRect_setLTRB_bottom'>bottom</a>. 1272 1273 ### Parameters 1274 1275 <table> <tr> <td><a name='SkRect_setLTRB_left'><code><strong>left</strong></code></a></td> 1276 <td>stored in <a href='#SkRect_fLeft'>fLeft</a></td> 1277 </tr> 1278 <tr> <td><a name='SkRect_setLTRB_top'><code><strong>top</strong></code></a></td> 1279 <td>stored in <a href='#SkRect_fTop'>fTop</a></td> 1280 </tr> 1281 <tr> <td><a name='SkRect_setLTRB_right'><code><strong>right</strong></code></a></td> 1282 <td>stored in <a href='#SkRect_fRight'>fRight</a></td> 1283 </tr> 1284 <tr> <td><a name='SkRect_setLTRB_bottom'><code><strong>bottom</strong></code></a></td> 1285 <td>stored in <a href='#SkRect_fBottom'>fBottom</a></td> 1286 </tr> 1287 </table> 1288 1289 ### Example 1290 1291 <div><fiddle-embed name="70692838793454c8e045d6eaf7edcbff"> 1292 1293 #### Example Output 1294 1295 ~~~~ 1296 rect1: {3, 4, 1, 2} 1297 rect2: {3, 4, 1, 2} 1298 ~~~~ 1299 1300 </fiddle-embed></div> 1301 1302 ### See Also 1303 1304 <a href='#SkRect_set'>set</a> <a href='#SkRect_setXYWH'>setXYWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_set'>set</a> 1305 1306 <a name='SkRect_set_3'></a> 1307 1308 --- 1309 1310 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1311 void set(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a> pts[], int count) 1312 </pre> 1313 1314 Sets to bounds of <a href='SkPath_Reference#Point_Array'>SkPoint array</a> with <a href='#SkRect_set_3_count'>count</a> entries. If <a href='#SkRect_set_3_count'>count</a> is zero or smaller, 1315 or if <a href='SkPath_Reference#Point_Array'>SkPoint array</a> contains an infinity or NaN, sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (0, 0, 0, 0). 1316 1317 Result is either empty or sorted: <a href='#SkRect_fLeft'>fLeft</a> is less than or equal to <a href='#SkRect_fRight'>fRight</a>, and 1318 <a href='#SkRect_fTop'>fTop</a> is less than or equal to <a href='#SkRect_fBottom'>fBottom</a>. 1319 1320 ### Parameters 1321 1322 <table> <tr> <td><a name='SkRect_set_3_pts'><code><strong>pts</strong></code></a></td> 1323 <td><a href='SkPath_Reference#Point_Array'>SkPoint array</a></td> 1324 </tr> 1325 <tr> <td><a name='SkRect_set_3_count'><code><strong>count</strong></code></a></td> 1326 <td>entries in array</td> 1327 </tr> 1328 </table> 1329 1330 ### Example 1331 1332 <div><fiddle-embed name="94295fa5197e21256171b99b4023dd48"> 1333 1334 #### Example Output 1335 1336 ~~~~ 1337 count: 0 rect: 0, 0, 0, 0 1338 added: 3, 4 count: 1 rect: 3, 4, 3, 4 1339 added: 1, 2 count: 2 rect: 1, 2, 3, 4 1340 added: 5, 6 count: 3 rect: 1, 2, 5, 6 1341 added: nan, 8 count: 4 rect: 0, 0, 0, 0 1342 ~~~~ 1343 1344 </fiddle-embed></div> 1345 1346 ### See Also 1347 1348 <a href='#SkRect_setBounds'>setBounds</a> <a href='#SkRect_setBoundsCheck'>setBoundsCheck</a> <a href='SkPath_Reference#SkPath'>SkPath</a>::<a href='#SkPath_addPoly'>addPoly</a> 1349 1350 <a name='SkRect_set_4'></a> 1351 1352 --- 1353 1354 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1355 void set(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a>& p0, const <a href='SkPoint_Reference#SkPoint'>SkPoint</a>& p1) 1356 </pre> 1357 1358 Sets bounds to the smallest <a href='SkRect_Reference#SkRect'>SkRect</a> enclosing <a href='SkPoint_Reference#SkPoint'>SkPoint</a> <a href='#SkRect_set_4_p0'>p0</a> and <a href='#SkRect_set_4_p1'>p1</a>. The result is 1359 sorted and may be empty. Does not check to see if values are finite. 1360 1361 ### Parameters 1362 1363 <table> <tr> <td><a name='SkRect_set_4_p0'><code><strong>p0</strong></code></a></td> 1364 <td>corner to include</td> 1365 </tr> 1366 <tr> <td><a name='SkRect_set_4_p1'><code><strong>p1</strong></code></a></td> 1367 <td>corner to include</td> 1368 </tr> 1369 </table> 1370 1371 ### Example 1372 1373 <div><fiddle-embed name="ee72450381f768f3869153cdbeccdc3e"><div><a href='#SkRect_set_4_p0'>p0</a> and <a href='#SkRect_set_4_p1'>p1</a> may be swapped and have the same effect unless one contains NaN. 1374 </div></fiddle-embed></div> 1375 1376 ### See Also 1377 1378 <a href='#SkRect_setBounds'>setBounds</a> <a href='#SkRect_setBoundsCheck'>setBoundsCheck</a> 1379 1380 <a name='SkRect_setXYWH'></a> 1381 1382 --- 1383 1384 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1385 void <a href='#SkRect_setXYWH'>setXYWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y, <a href='undocumented#SkScalar'>SkScalar</a> width, <a href='undocumented#SkScalar'>SkScalar</a> height) 1386 </pre> 1387 1388 Sets <a href='SkRect_Reference#Rect'>Rect</a> to <code>(<a href='#SkRect_setXYWH_x'>x</a>, <a href='#SkRect_setXYWH_y'>y</a>, <a href='#SkRect_setXYWH_x'>x</a> + <a href='#SkRect_setXYWH_width'>width</a>, <a href='#SkRect_setXYWH_y'>y</a> + <a href='#SkRect_setXYWH_height'>height</a>)</code>. 1389 Does not validate input; <a href='#SkRect_setXYWH_width'>width</a> or <a href='#SkRect_setXYWH_height'>height</a> may be negative. 1390 1391 ### Parameters 1392 1393 <table> <tr> <td><a name='SkRect_setXYWH_x'><code><strong>x</strong></code></a></td> 1394 <td>stored in <a href='#SkRect_fLeft'>fLeft</a></td> 1395 </tr> 1396 <tr> <td><a name='SkRect_setXYWH_y'><code><strong>y</strong></code></a></td> 1397 <td>stored in <a href='#SkRect_fTop'>fTop</a></td> 1398 </tr> 1399 <tr> <td><a name='SkRect_setXYWH_width'><code><strong>width</strong></code></a></td> 1400 <td>added to <a href='#SkRect_setXYWH_x'>x</a> and stored in <a href='#SkRect_fRight'>fRight</a></td> 1401 </tr> 1402 <tr> <td><a name='SkRect_setXYWH_height'><code><strong>height</strong></code></a></td> 1403 <td>added to <a href='#SkRect_setXYWH_y'>y</a> and stored in <a href='#SkRect_fBottom'>fBottom</a></td> 1404 </tr> 1405 </table> 1406 1407 ### Example 1408 1409 <div><fiddle-embed name="373cce4c61b9da0384b735b838765163"> 1410 1411 #### Example Output 1412 1413 ~~~~ 1414 rect: 5, 35, -10, 60 isEmpty: true 1415 rect: -10, 35, 5, 60 isEmpty: false 1416 ~~~~ 1417 1418 </fiddle-embed></div> 1419 1420 ### See Also 1421 1422 <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='#SkRect_setLTRB'>setLTRB</a> <a href='#SkRect_set'>set</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_setXYWH'>setXYWH</a> 1423 1424 <a name='SkRect_setWH'></a> 1425 1426 --- 1427 1428 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1429 void <a href='#SkRect_setWH'>setWH</a>(<a href='undocumented#SkScalar'>SkScalar</a> width, <a href='undocumented#SkScalar'>SkScalar</a> height) 1430 </pre> 1431 1432 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (0, 0, <a href='#SkRect_setWH_width'>width</a>, <a href='#SkRect_setWH_height'>height</a>). Does not validate input; 1433 <a href='#SkRect_setWH_width'>width</a> or <a href='#SkRect_setWH_height'>height</a> may be negative. 1434 1435 ### Parameters 1436 1437 <table> <tr> <td><a name='SkRect_setWH_width'><code><strong>width</strong></code></a></td> 1438 <td>stored in <a href='#SkRect_fRight'>fRight</a></td> 1439 </tr> 1440 <tr> <td><a name='SkRect_setWH_height'><code><strong>height</strong></code></a></td> 1441 <td>stored in <a href='#SkRect_fBottom'>fBottom</a></td> 1442 </tr> 1443 </table> 1444 1445 ### Example 1446 1447 <div><fiddle-embed name="9cb5fee17802fa49341f3707bdf5d235"> 1448 1449 #### Example Output 1450 1451 ~~~~ 1452 rect: 0, 0, -15, 25 isEmpty: true 1453 rect: -15, 0, 0, 25 isEmpty: false 1454 ~~~~ 1455 1456 </fiddle-embed></div> 1457 1458 ### See Also 1459 1460 <a href='#SkRect_MakeWH'>MakeWH</a> <a href='#SkRect_setXYWH'>setXYWH</a> <a href='#SkRect_isetWH'>isetWH</a> 1461 1462 <a name='From_Integers'></a> 1463 1464 <a name='SkRect_iset'></a> 1465 1466 --- 1467 1468 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1469 void <a href='#SkRect_iset'>iset</a>(int left, int top, int right, int bottom) 1470 </pre> 1471 1472 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (<a href='#SkRect_iset_left'>left</a>, <a href='#SkRect_iset_top'>top</a>, <a href='#SkRect_iset_right'>right</a>, <a href='#SkRect_iset_bottom'>bottom</a>). 1473 All parameters are promoted from integer to <a href='undocumented#Scalar'>scalar</a>. 1474 <a href='#SkRect_iset_left'>left</a> and <a href='#SkRect_iset_right'>right</a> are not sorted; <a href='#SkRect_iset_left'>left</a> is not necessarily less than <a href='#SkRect_iset_right'>right</a>. 1475 <a href='#SkRect_iset_top'>top</a> and <a href='#SkRect_iset_bottom'>bottom</a> are not sorted; <a href='#SkRect_iset_top'>top</a> is not necessarily less than <a href='#SkRect_iset_bottom'>bottom</a>. 1476 1477 ### Parameters 1478 1479 <table> <tr> <td><a name='SkRect_iset_left'><code><strong>left</strong></code></a></td> 1480 <td>promoted to <a href='undocumented#SkScalar'>SkScalar</a> and stored in <a href='#SkRect_fLeft'>fLeft</a></td> 1481 </tr> 1482 <tr> <td><a name='SkRect_iset_top'><code><strong>top</strong></code></a></td> 1483 <td>promoted to <a href='undocumented#SkScalar'>SkScalar</a> and stored in <a href='#SkRect_fTop'>fTop</a></td> 1484 </tr> 1485 <tr> <td><a name='SkRect_iset_right'><code><strong>right</strong></code></a></td> 1486 <td>promoted to <a href='undocumented#SkScalar'>SkScalar</a> and stored in <a href='#SkRect_fRight'>fRight</a></td> 1487 </tr> 1488 <tr> <td><a name='SkRect_iset_bottom'><code><strong>bottom</strong></code></a></td> 1489 <td>promoted to <a href='undocumented#SkScalar'>SkScalar</a> and stored in <a href='#SkRect_fBottom'>fBottom</a></td> 1490 </tr> 1491 </table> 1492 1493 ### Example 1494 1495 <div><fiddle-embed name="18532f1aa90b76364fb8d7ea072f1892"> 1496 1497 #### Example Output 1498 1499 ~~~~ 1500 rect1: {3, 4, 1, 2} 1501 rect2: {3, 4, 1, 2} 1502 ~~~~ 1503 1504 </fiddle-embed></div> 1505 1506 ### See Also 1507 1508 <a href='#SkRect_set'>set</a> <a href='#SkRect_setLTRB'>setLTRB</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_set'>set</a> <a href='undocumented#SkIntToScalar'>SkIntToScalar</a> 1509 1510 <a name='SkRect_isetWH'></a> 1511 1512 --- 1513 1514 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1515 void <a href='#SkRect_isetWH'>isetWH</a>(int width, int height) 1516 </pre> 1517 1518 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to (0, 0, <a href='#SkRect_isetWH_width'>width</a>, <a href='#SkRect_isetWH_height'>height</a>). 1519 <a href='#SkRect_isetWH_width'>width</a> and <a href='#SkRect_isetWH_height'>height</a> may be zero or negative. <a href='#SkRect_isetWH_width'>width</a> and <a href='#SkRect_isetWH_height'>height</a> are promoted from 1520 integer to <a href='undocumented#SkScalar'>SkScalar</a>, large values may lose precision. 1521 1522 ### Parameters 1523 1524 <table> <tr> <td><a name='SkRect_isetWH_width'><code><strong>width</strong></code></a></td> 1525 <td>promoted to <a href='undocumented#SkScalar'>SkScalar</a> and stored in <a href='#SkRect_fRight'>fRight</a></td> 1526 </tr> 1527 <tr> <td><a name='SkRect_isetWH_height'><code><strong>height</strong></code></a></td> 1528 <td>promoted to <a href='undocumented#SkScalar'>SkScalar</a> and stored in <a href='#SkRect_fBottom'>fBottom</a></td> 1529 </tr> 1530 </table> 1531 1532 ### Example 1533 1534 <div><fiddle-embed name="ee6000080fc7123214ea404018cf9176"> 1535 1536 #### Example Output 1537 1538 ~~~~ 1539 rect1: {0, 0, 1, 2} 1540 rect2: {0, 0, 1, 2} 1541 ~~~~ 1542 1543 </fiddle-embed></div> 1544 1545 ### See Also 1546 1547 <a href='#SkRect_MakeWH'>MakeWH</a> <a href='#SkRect_MakeXYWH'>MakeXYWH</a> <a href='#SkRect_iset'>iset()</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>:<a href='#SkRect_MakeWH'>MakeWH</a> 1548 1549 <a name='Inset_Outset_Offset'></a> 1550 1551 <a name='SkRect_makeOffset'></a> 1552 1553 --- 1554 1555 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1556 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeOffset'>makeOffset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy)const 1557 </pre> 1558 1559 Returns <a href='SkRect_Reference#SkRect'>SkRect</a> offset by (<a href='#SkRect_makeOffset_dx'>dx</a>, <a href='#SkRect_makeOffset_dy'>dy</a>). 1560 1561 If <a href='#SkRect_makeOffset_dx'>dx</a> is negative, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is moved to the left. 1562 If <a href='#SkRect_makeOffset_dx'>dx</a> is positive, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is moved to the right. 1563 If <a href='#SkRect_makeOffset_dy'>dy</a> is negative, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is moved upward. 1564 If <a href='#SkRect_makeOffset_dy'>dy</a> is positive, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is moved downward. 1565 1566 ### Parameters 1567 1568 <table> <tr> <td><a name='SkRect_makeOffset_dx'><code><strong>dx</strong></code></a></td> 1569 <td>added to <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a></td> 1570 </tr> 1571 <tr> <td><a name='SkRect_makeOffset_dy'><code><strong>dy</strong></code></a></td> 1572 <td>added to <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a></td> 1573 </tr> 1574 </table> 1575 1576 ### Return Value 1577 1578 <a href='SkRect_Reference#SkRect'>SkRect</a> offset on axes, with original width and height 1579 1580 ### Example 1581 1582 <div><fiddle-embed name="98841ab0a932f99cccd8e6a34d94ba05"> 1583 1584 #### Example Output 1585 1586 ~~~~ 1587 rect: 10, 50, 20, 60 isEmpty: false 1588 rect: 25, 82, 35, 92 isEmpty: false 1589 ~~~~ 1590 1591 </fiddle-embed></div> 1592 1593 ### See Also 1594 1595 <a href='#SkRect_offset'>offset()</a> <a href='#SkRect_makeInset'>makeInset</a> <a href='#SkRect_makeOutset'>makeOutset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_makeOffset'>makeOffset</a> 1596 1597 <a name='SkRect_makeInset'></a> 1598 1599 --- 1600 1601 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1602 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeInset'>makeInset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy)const 1603 </pre> 1604 1605 Returns <a href='SkRect_Reference#SkRect'>SkRect</a>, inset by (<a href='#SkRect_makeInset_dx'>dx</a>, <a href='#SkRect_makeInset_dy'>dy</a>). 1606 1607 If <a href='#SkRect_makeInset_dx'>dx</a> is negative, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is wider. 1608 If <a href='#SkRect_makeInset_dx'>dx</a> is positive, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is narrower. 1609 If <a href='#SkRect_makeInset_dy'>dy</a> is negative, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is taller. 1610 If <a href='#SkRect_makeInset_dy'>dy</a> is positive, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is shorter. 1611 1612 ### Parameters 1613 1614 <table> <tr> <td><a name='SkRect_makeInset_dx'><code><strong>dx</strong></code></a></td> 1615 <td>added to <a href='#SkRect_fLeft'>fLeft</a> and subtracted from <a href='#SkRect_fRight'>fRight</a></td> 1616 </tr> 1617 <tr> <td><a name='SkRect_makeInset_dy'><code><strong>dy</strong></code></a></td> 1618 <td>added to <a href='#SkRect_fTop'>fTop</a> and subtracted from <a href='#SkRect_fBottom'>fBottom</a></td> 1619 </tr> 1620 </table> 1621 1622 ### Return Value 1623 1624 <a href='SkRect_Reference#SkRect'>SkRect</a> inset symmetrically left and right, top and bottom 1625 1626 ### Example 1627 1628 <div><fiddle-embed name="b8d32ab2f7ea3d4d5fb5a4ea2156f1c5"> 1629 1630 #### Example Output 1631 1632 ~~~~ 1633 rect: 10, 50, 20, 60 isEmpty: false 1634 rect: 25, 82, 5, 28 isEmpty: true 1635 ~~~~ 1636 1637 </fiddle-embed></div> 1638 1639 ### See Also 1640 1641 <a href='#SkRect_inset'>inset()</a> <a href='#SkRect_makeOffset'>makeOffset</a> <a href='#SkRect_makeOutset'>makeOutset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_makeInset'>makeInset</a> 1642 1643 <a name='SkRect_makeOutset'></a> 1644 1645 --- 1646 1647 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1648 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeOutset'>makeOutset</a>(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy)const 1649 </pre> 1650 1651 Returns <a href='SkRect_Reference#SkRect'>SkRect</a>, outset by (<a href='#SkRect_makeOutset_dx'>dx</a>, <a href='#SkRect_makeOutset_dy'>dy</a>). 1652 1653 If <a href='#SkRect_makeOutset_dx'>dx</a> is negative, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is narrower. 1654 If <a href='#SkRect_makeOutset_dx'>dx</a> is positive, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is wider. 1655 If <a href='#SkRect_makeOutset_dy'>dy</a> is negative, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is shorter. 1656 If <a href='#SkRect_makeOutset_dy'>dy</a> is positive, <a href='SkRect_Reference#SkRect'>SkRect</a> returned is taller. 1657 1658 ### Parameters 1659 1660 <table> <tr> <td><a name='SkRect_makeOutset_dx'><code><strong>dx</strong></code></a></td> 1661 <td>subtracted to <a href='#SkRect_fLeft'>fLeft</a> and added from <a href='#SkRect_fRight'>fRight</a></td> 1662 </tr> 1663 <tr> <td><a name='SkRect_makeOutset_dy'><code><strong>dy</strong></code></a></td> 1664 <td>subtracted to <a href='#SkRect_fTop'>fTop</a> and added from <a href='#SkRect_fBottom'>fBottom</a></td> 1665 </tr> 1666 </table> 1667 1668 ### Return Value 1669 1670 <a href='SkRect_Reference#SkRect'>SkRect</a> outset symmetrically left and right, top and bottom 1671 1672 ### Example 1673 1674 <div><fiddle-embed name="87176fc60914cbca9c6a20998a033c24"> 1675 1676 #### Example Output 1677 1678 ~~~~ 1679 rect: 10, 50, 20, 60 isEmpty: false 1680 rect: -5, 18, 35, 92 isEmpty: false 1681 ~~~~ 1682 1683 </fiddle-embed></div> 1684 1685 ### See Also 1686 1687 <a href='#SkRect_outset'>outset()</a> <a href='#SkRect_makeOffset'>makeOffset</a> <a href='#SkRect_makeInset'>makeInset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_makeOutset'>makeOutset</a> 1688 1689 <a name='SkRect_offset'></a> 1690 1691 --- 1692 1693 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1694 void offset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) 1695 </pre> 1696 1697 Offsets <a href='SkRect_Reference#SkRect'>SkRect</a> by adding <a href='#SkRect_offset_dx'>dx</a> to <a href='#SkRect_fLeft'>fLeft</a>, <a href='#SkRect_fRight'>fRight</a>; and by adding <a href='#SkRect_offset_dy'>dy</a> to <a href='#SkRect_fTop'>fTop</a>, <a href='#SkRect_fBottom'>fBottom</a>. 1698 1699 If <a href='#SkRect_offset_dx'>dx</a> is negative, moves <a href='SkRect_Reference#SkRect'>SkRect</a> to the left. 1700 If <a href='#SkRect_offset_dx'>dx</a> is positive, moves <a href='SkRect_Reference#SkRect'>SkRect</a> to the right. 1701 If <a href='#SkRect_offset_dy'>dy</a> is negative, moves <a href='SkRect_Reference#SkRect'>SkRect</a> upward. 1702 If <a href='#SkRect_offset_dy'>dy</a> is positive, moves <a href='SkRect_Reference#SkRect'>SkRect</a> downward. 1703 1704 ### Parameters 1705 1706 <table> <tr> <td><a name='SkRect_offset_dx'><code><strong>dx</strong></code></a></td> 1707 <td>offset added to <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a></td> 1708 </tr> 1709 <tr> <td><a name='SkRect_offset_dy'><code><strong>dy</strong></code></a></td> 1710 <td>offset added to <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a></td> 1711 </tr> 1712 </table> 1713 1714 ### Example 1715 1716 <div><fiddle-embed name="04eb33f0fd376f2942ca5f1c7f6cbcfc"> 1717 1718 #### Example Output 1719 1720 ~~~~ 1721 rect: 15, 27, 55, 86 1722 ~~~~ 1723 1724 </fiddle-embed></div> 1725 1726 ### See Also 1727 1728 <a href='#SkRect_offsetTo'>offsetTo</a> <a href='#SkRect_makeOffset'>makeOffset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_offset'>offset</a> 1729 1730 <a name='SkRect_offset_2'></a> 1731 1732 --- 1733 1734 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1735 void offset(const <a href='SkPoint_Reference#SkPoint'>SkPoint</a>& delta) 1736 </pre> 1737 1738 Offsets <a href='SkRect_Reference#SkRect'>SkRect</a> by adding <a href='#SkRect_offset_2_delta'>delta</a>.<a href='#SkPoint_fX'>fX</a> to <a href='#SkRect_fLeft'>fLeft</a>, <a href='#SkRect_fRight'>fRight</a>; and by adding <a href='#SkRect_offset_2_delta'>delta</a>.<a href='#SkPoint_fY'>fY</a> to 1739 <a href='#SkRect_fTop'>fTop</a>, <a href='#SkRect_fBottom'>fBottom</a>. 1740 1741 If <a href='#SkRect_offset_2_delta'>delta</a>.<a href='#SkPoint_fX'>fX</a> is negative, moves <a href='SkRect_Reference#SkRect'>SkRect</a> to the left. 1742 If <a href='#SkRect_offset_2_delta'>delta</a>.<a href='#SkPoint_fX'>fX</a> is positive, moves <a href='SkRect_Reference#SkRect'>SkRect</a> to the right. 1743 If <a href='#SkRect_offset_2_delta'>delta</a>.<a href='#SkPoint_fY'>fY</a> is negative, moves <a href='SkRect_Reference#SkRect'>SkRect</a> upward. 1744 If <a href='#SkRect_offset_2_delta'>delta</a>.<a href='#SkPoint_fY'>fY</a> is positive, moves <a href='SkRect_Reference#SkRect'>SkRect</a> downward. 1745 1746 ### Parameters 1747 1748 <table> <tr> <td><a name='SkRect_offset_2_delta'><code><strong>delta</strong></code></a></td> 1749 <td>added to <a href='SkRect_Reference#SkRect'>SkRect</a></td> 1750 </tr> 1751 </table> 1752 1753 ### Example 1754 1755 <div><fiddle-embed name="b24cf65561c98c1858a06c39f10fb797"> 1756 1757 #### Example Output 1758 1759 ~~~~ 1760 rect: 15, 27, 55, 86 1761 ~~~~ 1762 1763 </fiddle-embed></div> 1764 1765 ### See Also 1766 1767 <a href='#SkRect_offsetTo'>offsetTo</a> <a href='#SkRect_makeOffset'>makeOffset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_offset'>offset</a> 1768 1769 <a name='SkRect_offsetTo'></a> 1770 1771 --- 1772 1773 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1774 void <a href='#SkRect_offsetTo'>offsetTo</a>(<a href='undocumented#SkScalar'>SkScalar</a> newX, <a href='undocumented#SkScalar'>SkScalar</a> newY) 1775 </pre> 1776 1777 Offsets <a href='SkRect_Reference#SkRect'>SkRect</a> so that <a href='#SkRect_fLeft'>fLeft</a> equals <a href='#SkRect_offsetTo_newX'>newX</a>, and <a href='#SkRect_fTop'>fTop</a> equals <a href='#SkRect_offsetTo_newY'>newY</a>. width and height 1778 are unchanged. 1779 1780 ### Parameters 1781 1782 <table> <tr> <td><a name='SkRect_offsetTo_newX'><code><strong>newX</strong></code></a></td> 1783 <td>stored in <a href='#SkRect_fLeft'>fLeft</a>, preserving <a href='#SkRect_width'>width()</a></td> 1784 </tr> 1785 <tr> <td><a name='SkRect_offsetTo_newY'><code><strong>newY</strong></code></a></td> 1786 <td>stored in <a href='#SkRect_fTop'>fTop</a>, preserving <a href='#SkRect_height'>height()</a></td> 1787 </tr> 1788 </table> 1789 1790 ### Example 1791 1792 <div><fiddle-embed name="bedb04b7b3e1af3e8039f9cffe66989e"> 1793 1794 #### Example Output 1795 1796 ~~~~ 1797 rect: 15, 27, 55, 86 1798 ~~~~ 1799 1800 </fiddle-embed></div> 1801 1802 ### See Also 1803 1804 <a href='#SkRect_offset'>offset</a> <a href='#SkRect_makeOffset'>makeOffset</a> <a href='#SkRect_setXYWH'>setXYWH</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_offsetTo'>offsetTo</a> 1805 1806 <a name='SkRect_inset'></a> 1807 1808 --- 1809 1810 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1811 void inset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) 1812 </pre> 1813 1814 Insets <a href='SkRect_Reference#SkRect'>SkRect</a> by (<a href='#SkRect_inset_dx'>dx</a>, <a href='#SkRect_inset_dy'>dy</a>). 1815 1816 If <a href='#SkRect_inset_dx'>dx</a> is positive, makes <a href='SkRect_Reference#SkRect'>SkRect</a> narrower. 1817 If <a href='#SkRect_inset_dx'>dx</a> is negative, makes <a href='SkRect_Reference#SkRect'>SkRect</a> wider. 1818 If <a href='#SkRect_inset_dy'>dy</a> is positive, makes <a href='SkRect_Reference#SkRect'>SkRect</a> shorter. 1819 If <a href='#SkRect_inset_dy'>dy</a> is negative, makes <a href='SkRect_Reference#SkRect'>SkRect</a> taller. 1820 1821 ### Parameters 1822 1823 <table> <tr> <td><a name='SkRect_inset_dx'><code><strong>dx</strong></code></a></td> 1824 <td>added to <a href='#SkRect_fLeft'>fLeft</a> and subtracted from <a href='#SkRect_fRight'>fRight</a></td> 1825 </tr> 1826 <tr> <td><a name='SkRect_inset_dy'><code><strong>dy</strong></code></a></td> 1827 <td>added to <a href='#SkRect_fTop'>fTop</a> and subtracted from <a href='#SkRect_fBottom'>fBottom</a></td> 1828 </tr> 1829 </table> 1830 1831 ### Example 1832 1833 <div><fiddle-embed name="dae21340941dc6e4d048816dfd9f204c"> 1834 1835 #### Example Output 1836 1837 ~~~~ 1838 rect: 15, 27, 45, 60 1839 ~~~~ 1840 1841 </fiddle-embed></div> 1842 1843 ### See Also 1844 1845 <a href='#SkRect_outset'>outset</a> <a href='#SkRect_makeInset'>makeInset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_inset'>inset</a> 1846 1847 <a name='SkRect_outset'></a> 1848 1849 --- 1850 1851 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1852 void outset(<a href='undocumented#SkScalar'>SkScalar</a> dx, <a href='undocumented#SkScalar'>SkScalar</a> dy) 1853 </pre> 1854 1855 Outsets <a href='SkRect_Reference#SkRect'>SkRect</a> by (<a href='#SkRect_outset_dx'>dx</a>, <a href='#SkRect_outset_dy'>dy</a>). 1856 1857 If <a href='#SkRect_outset_dx'>dx</a> is positive, makes <a href='SkRect_Reference#SkRect'>SkRect</a> wider. 1858 If <a href='#SkRect_outset_dx'>dx</a> is negative, makes <a href='SkRect_Reference#SkRect'>SkRect</a> narrower. 1859 If <a href='#SkRect_outset_dy'>dy</a> is positive, makes <a href='SkRect_Reference#SkRect'>SkRect</a> taller. 1860 If <a href='#SkRect_outset_dy'>dy</a> is negative, makes <a href='SkRect_Reference#SkRect'>SkRect</a> shorter. 1861 1862 ### Parameters 1863 1864 <table> <tr> <td><a name='SkRect_outset_dx'><code><strong>dx</strong></code></a></td> 1865 <td>subtracted to <a href='#SkRect_fLeft'>fLeft</a> and added from <a href='#SkRect_fRight'>fRight</a></td> 1866 </tr> 1867 <tr> <td><a name='SkRect_outset_dy'><code><strong>dy</strong></code></a></td> 1868 <td>subtracted to <a href='#SkRect_fTop'>fTop</a> and added from <a href='#SkRect_fBottom'>fBottom</a></td> 1869 </tr> 1870 </table> 1871 1872 ### Example 1873 1874 <div><fiddle-embed name="861f873ba660af8c8bf8b0b83d829cf4"> 1875 1876 #### Example Output 1877 1878 ~~~~ 1879 rect: 5, 1, 55, 86 1880 ~~~~ 1881 1882 </fiddle-embed></div> 1883 1884 ### See Also 1885 1886 <a href='#SkRect_inset'>inset</a> <a href='#SkRect_makeOutset'>makeOutset</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_outset'>outset</a> 1887 1888 <a name='Intersection'></a> 1889 1890 <a href='SkRect_Reference#Rect'>Rects</a> intersect when they enclose a common area. To intersect, each of the pair 1891 must describe area; <a href='#SkRect_fLeft'>fLeft</a> is less than <a href='#SkRect_fRight'>fRight</a>, and <a href='#SkRect_fTop'>fTop</a> is less than <a href='#SkRect_fBottom'>fBottom</a>; 1892 <a href='#SkRect_isEmpty'>isEmpty</a>() returns false. The intersection of <a href='SkRect_Reference#Rect'>Rect</a> pair can be described by: 1893 <code>(<a href='undocumented#max()'>max</a>(a.<a href='#SkRect_fLeft'>fLeft</a>, b.<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#max()'>max</a>(a.<a href='#SkRect_fTop'>fTop</a>, b.<a href='#SkRect_fTop'>fTop</a>), 1894 <a href='undocumented#min()'>min</a>(a.<a href='#SkRect_fRight'>fRight</a>, b.<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#min()'>min</a>(a.<a href='#SkRect_fBottom'>fBottom</a>, b.<a href='#SkRect_fBottom'>fBottom</a>))</code>. 1895 1896 The intersection is only meaningful if the resulting <a href='SkRect_Reference#Rect'>Rect</a> is not empty and 1897 describes an area: <a href='#SkRect_fLeft'>fLeft</a> is less than <a href='#SkRect_fRight'>fRight</a>, and <a href='#SkRect_fTop'>fTop</a> is less than <a href='#SkRect_fBottom'>fBottom</a>. 1898 1899 <a name='SkRect_contains'></a> 1900 1901 --- 1902 1903 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1904 bool contains(<a href='undocumented#SkScalar'>SkScalar</a> x, <a href='undocumented#SkScalar'>SkScalar</a> y)const 1905 </pre> 1906 1907 Returns true if: <a href='#SkRect_fLeft'>fLeft</a> <= <a href='#SkRect_contains_x'>x</a> < <a href='#SkRect_fRight'>fRight</a> && <a href='#SkRect_fTop'>fTop</a> <= <a href='#SkRect_contains_y'>y</a> < <a href='#SkRect_fBottom'>fBottom</a>. 1908 Returns false if <a href='SkRect_Reference#SkRect'>SkRect</a> is empty. 1909 1910 ### Parameters 1911 1912 <table> <tr> <td><a name='SkRect_contains_x'><code><strong>x</strong></code></a></td> 1913 <td>test <a href='SkPoint_Reference#SkPoint'>SkPoint</a> x-coordinate</td> 1914 </tr> 1915 <tr> <td><a name='SkRect_contains_y'><code><strong>y</strong></code></a></td> 1916 <td>test <a href='SkPoint_Reference#SkPoint'>SkPoint</a> y-coordinate</td> 1917 </tr> 1918 </table> 1919 1920 ### Return Value 1921 1922 true if (<a href='#SkRect_contains_x'>x</a>, <a href='#SkRect_contains_y'>y</a>) is inside <a href='SkRect_Reference#SkRect'>SkRect</a> 1923 1924 ### Example 1925 1926 <div><fiddle-embed name="85be528a78945a6dc4f7dccb80a80746"> 1927 1928 #### Example Output 1929 1930 ~~~~ 1931 rect: (30, 50, 40, 60) contains (30, 50) 1932 rect: (30, 50, 40, 60) does not contain (39, 49) 1933 rect: (30, 50, 40, 60) does not contain (29, 59) 1934 ~~~~ 1935 1936 </fiddle-embed></div> 1937 1938 ### See Also 1939 1940 <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_contains'>contains</a> <a href='SkRRect_Reference#SkRRect'>SkRRect</a>::<a href='#SkRRect_contains'>contains</a> 1941 1942 <a name='SkRect_contains_2'></a> 1943 1944 --- 1945 1946 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1947 bool contains(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r)const 1948 </pre> 1949 1950 Returns true if <a href='SkRect_Reference#SkRect'>SkRect</a> contains <a href='#SkRect_contains_2_r'>r</a>. 1951 Returns false if <a href='SkRect_Reference#SkRect'>SkRect</a> is empty or <a href='#SkRect_contains_2_r'>r</a> is empty. 1952 1953 <a href='SkRect_Reference#SkRect'>SkRect</a> contains <a href='#SkRect_contains_2_r'>r</a> when <a href='SkRect_Reference#SkRect'>SkRect</a> area completely includes <a href='#SkRect_contains_2_r'>r</a> area. 1954 1955 ### Parameters 1956 1957 <table> <tr> <td><a name='SkRect_contains_2_r'><code><strong>r</strong></code></a></td> 1958 <td><a href='SkRect_Reference#SkRect'>SkRect</a> contained</td> 1959 </tr> 1960 </table> 1961 1962 ### Return Value 1963 1964 true if all sides of <a href='SkRect_Reference#SkRect'>SkRect</a> are outside <a href='#SkRect_contains_2_r'>r</a> 1965 1966 ### Example 1967 1968 <div><fiddle-embed name="92f9e6aa5bb76791139a24cf7d8df99e"> 1969 1970 #### Example Output 1971 1972 ~~~~ 1973 rect: (30, 50, 40, 60) contains (30, 50, 31, 51) 1974 rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50) 1975 rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60) 1976 ~~~~ 1977 1978 </fiddle-embed></div> 1979 1980 ### See Also 1981 1982 <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_contains'>contains</a> 1983 1984 <a name='SkRect_contains_3'></a> 1985 1986 --- 1987 1988 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 1989 bool contains(const <a href='SkIRect_Reference#SkIRect'>SkIRect</a>& r)const 1990 </pre> 1991 1992 Returns true if <a href='SkRect_Reference#SkRect'>SkRect</a> contains <a href='#SkRect_contains_3_r'>r</a>. 1993 Returns false if <a href='SkRect_Reference#SkRect'>SkRect</a> is empty or <a href='#SkRect_contains_3_r'>r</a> is empty. 1994 1995 <a href='SkRect_Reference#SkRect'>SkRect</a> contains <a href='#SkRect_contains_3_r'>r</a> when <a href='SkRect_Reference#SkRect'>SkRect</a> area completely includes <a href='#SkRect_contains_3_r'>r</a> area. 1996 1997 ### Parameters 1998 1999 <table> <tr> <td><a name='SkRect_contains_3_r'><code><strong>r</strong></code></a></td> 2000 <td><a href='SkIRect_Reference#SkIRect'>SkIRect</a> contained</td> 2001 </tr> 2002 </table> 2003 2004 ### Return Value 2005 2006 true if all sides of <a href='SkRect_Reference#SkRect'>SkRect</a> are outside <a href='#SkRect_contains_3_r'>r</a> 2007 2008 ### Example 2009 2010 <div><fiddle-embed name="dd58b699551dd44026a2c6386be27d88"> 2011 2012 #### Example Output 2013 2014 ~~~~ 2015 rect: (30, 50, 40, 60) contains (30, 50, 31, 51) 2016 rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50) 2017 rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60) 2018 ~~~~ 2019 2020 </fiddle-embed></div> 2021 2022 ### See Also 2023 2024 <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_contains'>contains</a> 2025 2026 <a name='SkRect_intersect'></a> 2027 2028 --- 2029 2030 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2031 bool intersect(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) 2032 </pre> 2033 2034 Returns true if <a href='SkRect_Reference#SkRect'>SkRect</a> intersects <a href='#SkRect_intersect_r'>r</a>, and sets <a href='SkRect_Reference#SkRect'>SkRect</a> to intersection. 2035 Returns false if <a href='SkRect_Reference#SkRect'>SkRect</a> does not intersect <a href='#SkRect_intersect_r'>r</a>, and leaves <a href='SkRect_Reference#SkRect'>SkRect</a> unchanged. 2036 2037 Returns false if either <a href='#SkRect_intersect_r'>r</a> or <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, leaving <a href='SkRect_Reference#SkRect'>SkRect</a> unchanged. 2038 2039 ### Parameters 2040 2041 <table> <tr> <td><a name='SkRect_intersect_r'><code><strong>r</strong></code></a></td> 2042 <td>limit of result</td> 2043 </tr> 2044 </table> 2045 2046 ### Return Value 2047 2048 true if <a href='#SkRect_intersect_r'>r</a> and <a href='SkRect_Reference#SkRect'>SkRect</a> have area in common 2049 2050 ### Example 2051 2052 <div><fiddle-embed name="5d0b12e0ef6f1c181dddded4274230ca"><div>Two <a href='undocumented#SkDebugf'>SkDebugf</a> calls are required. If the calls are combined, their arguments 2053 may not be evaluated in left to right order: the printed intersection may 2054 be before or after the call to intersect. 2055 </div> 2056 2057 #### Example Output 2058 2059 ~~~~ 2060 intersection: 30, 60, 50, 80 2061 ~~~~ 2062 2063 </fiddle-embed></div> 2064 2065 ### See Also 2066 2067 <a href='#SkRect_intersects'>intersects</a> <a href='#SkRect_Intersects'>Intersects</a> <a href='#SkRect_join'>join</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_intersect'>intersect</a> 2068 2069 <a name='SkRect_intersect_2'></a> 2070 2071 --- 2072 2073 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2074 bool intersect(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom) 2075 </pre> 2076 2077 Constructs <a href='SkRect_Reference#SkRect'>SkRect</a> to intersect from (<a href='#SkRect_intersect_2_left'>left</a>, <a href='#SkRect_intersect_2_top'>top</a>, <a href='#SkRect_intersect_2_right'>right</a>, <a href='#SkRect_intersect_2_bottom'>bottom</a>). Does not sort 2078 construction. 2079 2080 Returns true if <a href='SkRect_Reference#SkRect'>SkRect</a> intersects construction, and sets <a href='SkRect_Reference#SkRect'>SkRect</a> to intersection. 2081 Returns false if <a href='SkRect_Reference#SkRect'>SkRect</a> does not intersect construction, and leaves <a href='SkRect_Reference#SkRect'>SkRect</a> unchanged. 2082 2083 Returns false if either construction or <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, leaving <a href='SkRect_Reference#SkRect'>SkRect</a> unchanged. 2084 2085 ### Parameters 2086 2087 <table> <tr> <td><a name='SkRect_intersect_2_left'><code><strong>left</strong></code></a></td> 2088 <td>x-axis minimum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2089 </tr> 2090 <tr> <td><a name='SkRect_intersect_2_top'><code><strong>top</strong></code></a></td> 2091 <td>y-axis minimum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2092 </tr> 2093 <tr> <td><a name='SkRect_intersect_2_right'><code><strong>right</strong></code></a></td> 2094 <td>x-axis maximum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2095 </tr> 2096 <tr> <td><a name='SkRect_intersect_2_bottom'><code><strong>bottom</strong></code></a></td> 2097 <td>y-axis maximum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2098 </tr> 2099 </table> 2100 2101 ### Return Value 2102 2103 true if construction and <a href='SkRect_Reference#SkRect'>SkRect</a> have area in common 2104 2105 ### Example 2106 2107 <div><fiddle-embed name="5002f65a72def2787086a33131933e70"><div>Two <a href='undocumented#SkDebugf'>SkDebugf</a> calls are required. If the calls are combined, their arguments 2108 may not be evaluated in <a href='#SkRect_intersect_2_left'>left</a> to <a href='#SkRect_intersect_2_right'>right</a> order: the printed intersection may 2109 be before or after the call to intersect. 2110 </div> 2111 2112 #### Example Output 2113 2114 ~~~~ 2115 intersection: 30, 60, 50, 80 2116 ~~~~ 2117 2118 </fiddle-embed></div> 2119 2120 ### See Also 2121 2122 <a href='#SkRect_intersects'>intersects</a> <a href='#SkRect_Intersects'>Intersects</a> <a href='#SkRect_join'>join</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_intersect'>intersect</a> 2123 2124 <a name='SkRect_intersect_3'></a> 2125 2126 --- 2127 2128 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2129 bool intersect(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b) 2130 </pre> 2131 2132 Returns true if <a href='#SkRect_intersect_3_a'>a</a> intersects <a href='#SkRect_intersect_3_b'>b</a>, and sets <a href='SkRect_Reference#SkRect'>SkRect</a> to intersection. 2133 Returns false if <a href='#SkRect_intersect_3_a'>a</a> does not intersect <a href='#SkRect_intersect_3_b'>b</a>, and leaves <a href='SkRect_Reference#SkRect'>SkRect</a> unchanged. 2134 2135 Returns false if either <a href='#SkRect_intersect_3_a'>a</a> or <a href='#SkRect_intersect_3_b'>b</a> is empty, leaving <a href='SkRect_Reference#SkRect'>SkRect</a> unchanged. 2136 2137 ### Parameters 2138 2139 <table> <tr> <td><a name='SkRect_intersect_3_a'><code><strong>a</strong></code></a></td> 2140 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to intersect</td> 2141 </tr> 2142 <tr> <td><a name='SkRect_intersect_3_b'><code><strong>b</strong></code></a></td> 2143 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to intersect</td> 2144 </tr> 2145 </table> 2146 2147 ### Return Value 2148 2149 true if <a href='#SkRect_intersect_3_a'>a</a> and <a href='#SkRect_intersect_3_b'>b</a> have area in common 2150 2151 ### Example 2152 2153 <div><fiddle-embed name="d610437a65dd3e952719efe605cbd0c7"> 2154 2155 #### Example Output 2156 2157 ~~~~ 2158 intersection: 30, 60, 50, 80 2159 ~~~~ 2160 2161 </fiddle-embed></div> 2162 2163 ### See Also 2164 2165 <a href='#SkRect_intersects'>intersects</a> <a href='#SkRect_Intersects'>Intersects</a> <a href='#SkRect_join'>join</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_intersect'>intersect</a> 2166 2167 <a name='SkRect_intersects'></a> 2168 2169 --- 2170 2171 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2172 bool intersects(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom)const 2173 </pre> 2174 2175 Constructs <a href='SkRect_Reference#SkRect'>SkRect</a> to intersect from (<a href='#SkRect_intersects_left'>left</a>, <a href='#SkRect_intersects_top'>top</a>, <a href='#SkRect_intersects_right'>right</a>, <a href='#SkRect_intersects_bottom'>bottom</a>). Does not sort 2176 construction. 2177 2178 Returns true if <a href='SkRect_Reference#SkRect'>SkRect</a> intersects construction. 2179 Returns false if either construction or <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, or do not intersect. 2180 2181 ### Parameters 2182 2183 <table> <tr> <td><a name='SkRect_intersects_left'><code><strong>left</strong></code></a></td> 2184 <td>x-axis minimum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2185 </tr> 2186 <tr> <td><a name='SkRect_intersects_top'><code><strong>top</strong></code></a></td> 2187 <td>y-axis minimum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2188 </tr> 2189 <tr> <td><a name='SkRect_intersects_right'><code><strong>right</strong></code></a></td> 2190 <td>x-axis maximum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2191 </tr> 2192 <tr> <td><a name='SkRect_intersects_bottom'><code><strong>bottom</strong></code></a></td> 2193 <td>y-axis maximum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2194 </tr> 2195 </table> 2196 2197 ### Return Value 2198 2199 true if construction and <a href='SkRect_Reference#SkRect'>SkRect</a> have area in common 2200 2201 ### Example 2202 2203 <div><fiddle-embed name="7145dc17ebce4f54e892102f6c98e811"> 2204 2205 #### Example Output 2206 2207 ~~~~ 2208 intersection 2209 ~~~~ 2210 2211 </fiddle-embed></div> 2212 2213 ### See Also 2214 2215 <a href='#SkRect_intersect'>intersect</a> <a href='#SkRect_Intersects'>Intersects</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_Intersects'>Intersects</a> 2216 2217 <a name='SkRect_intersects_2'></a> 2218 2219 --- 2220 2221 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2222 bool intersects(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r)const 2223 </pre> 2224 2225 Returns true if <a href='SkRect_Reference#SkRect'>SkRect</a> intersects <a href='#SkRect_intersects_2_r'>r</a>. 2226 Returns false if either <a href='#SkRect_intersects_2_r'>r</a> or <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, or do not intersect. 2227 2228 ### Parameters 2229 2230 <table> <tr> <td><a name='SkRect_intersects_2_r'><code><strong>r</strong></code></a></td> 2231 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to intersect</td> 2232 </tr> 2233 </table> 2234 2235 ### Return Value 2236 2237 true if <a href='#SkRect_intersects_2_r'>r</a> and <a href='SkRect_Reference#SkRect'>SkRect</a> have area in common 2238 2239 ### Example 2240 2241 <div><fiddle-embed name="ca37b4231b21eb8296cb19ba9e0c781b"> 2242 2243 #### Example Output 2244 2245 ~~~~ 2246 intersection 2247 ~~~~ 2248 2249 </fiddle-embed></div> 2250 2251 ### See Also 2252 2253 <a href='#SkRect_intersect'>intersect</a> <a href='#SkRect_Intersects'>Intersects</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_Intersects'>Intersects</a> 2254 2255 <a name='SkRect_Intersects'></a> 2256 2257 --- 2258 2259 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2260 static bool <a href='#SkRect_Intersects'>Intersects</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& a, const <a href='SkRect_Reference#SkRect'>SkRect</a>& b) 2261 </pre> 2262 2263 Returns true if <a href='#SkRect_Intersects_a'>a</a> intersects <a href='#SkRect_Intersects_b'>b</a>. 2264 Returns false if either <a href='#SkRect_Intersects_a'>a</a> or <a href='#SkRect_Intersects_b'>b</a> is empty, or do not intersect. 2265 2266 ### Parameters 2267 2268 <table> <tr> <td><a name='SkRect_Intersects_a'><code><strong>a</strong></code></a></td> 2269 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to intersect</td> 2270 </tr> 2271 <tr> <td><a name='SkRect_Intersects_b'><code><strong>b</strong></code></a></td> 2272 <td><a href='SkRect_Reference#SkRect'>SkRect</a> to intersect</td> 2273 </tr> 2274 </table> 2275 2276 ### Return Value 2277 2278 true if <a href='#SkRect_Intersects_a'>a</a> and <a href='#SkRect_Intersects_b'>b</a> have area in common 2279 2280 ### Example 2281 2282 <div><fiddle-embed name="795061764b10c9e05efb466c9cb60644"> 2283 2284 #### Example Output 2285 2286 ~~~~ 2287 intersection 2288 ~~~~ 2289 2290 </fiddle-embed></div> 2291 2292 ### See Also 2293 2294 <a href='#SkRect_intersect'>intersect</a> <a href='#SkRect_intersects'>intersects</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_Intersects'>Intersects</a> 2295 2296 <a name='Join'></a> 2297 2298 <a name='SkRect_join'></a> 2299 2300 --- 2301 2302 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2303 void join(<a href='undocumented#SkScalar'>SkScalar</a> left, <a href='undocumented#SkScalar'>SkScalar</a> top, <a href='undocumented#SkScalar'>SkScalar</a> right, <a href='undocumented#SkScalar'>SkScalar</a> bottom) 2304 </pre> 2305 2306 Constructs <a href='SkRect_Reference#SkRect'>SkRect</a> to intersect from (<a href='#SkRect_join_left'>left</a>, <a href='#SkRect_join_top'>top</a>, <a href='#SkRect_join_right'>right</a>, <a href='#SkRect_join_bottom'>bottom</a>). Does not sort 2307 construction. 2308 2309 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to the union of itself and the construction. 2310 2311 Has no effect if construction is empty. Otherwise, if <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, sets 2312 <a href='SkRect_Reference#SkRect'>SkRect</a> to construction. 2313 2314 ### Parameters 2315 2316 <table> <tr> <td><a name='SkRect_join_left'><code><strong>left</strong></code></a></td> 2317 <td>x-axis minimum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2318 </tr> 2319 <tr> <td><a name='SkRect_join_top'><code><strong>top</strong></code></a></td> 2320 <td>y-axis minimum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2321 </tr> 2322 <tr> <td><a name='SkRect_join_right'><code><strong>right</strong></code></a></td> 2323 <td>x-axis maximum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2324 </tr> 2325 <tr> <td><a name='SkRect_join_bottom'><code><strong>bottom</strong></code></a></td> 2326 <td>y-axis maximum of constructed <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2327 </tr> 2328 </table> 2329 2330 ### Example 2331 2332 <div><fiddle-embed name="afa9c6b4d05bb669db07fe0b7b97e6aa"> 2333 2334 #### Example Output 2335 2336 ~~~~ 2337 join: 10, 20, 55, 65 2338 ~~~~ 2339 2340 </fiddle-embed></div> 2341 2342 ### See Also 2343 2344 <a href='#SkRect_joinNonEmptyArg'>joinNonEmptyArg</a> <a href='#SkRect_joinPossiblyEmptyRect'>joinPossiblyEmptyRect</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_join'>join</a> 2345 2346 <a name='SkRect_join_2'></a> 2347 2348 --- 2349 2350 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2351 void join(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) 2352 </pre> 2353 2354 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to the union of itself and <a href='#SkRect_join_2_r'>r</a>. 2355 2356 Has no effect if <a href='#SkRect_join_2_r'>r</a> is empty. Otherwise, if <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, sets 2357 <a href='SkRect_Reference#SkRect'>SkRect</a> to <a href='#SkRect_join_2_r'>r</a>. 2358 2359 ### Parameters 2360 2361 <table> <tr> <td><a name='SkRect_join_2_r'><code><strong>r</strong></code></a></td> 2362 <td>expansion <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2363 </tr> 2364 </table> 2365 2366 ### Example 2367 2368 <div><fiddle-embed name="26500032494cf93c5fa3423110fe82af"> 2369 2370 #### Example Output 2371 2372 ~~~~ 2373 join: 10, 20, 55, 65 2374 ~~~~ 2375 2376 </fiddle-embed></div> 2377 2378 ### See Also 2379 2380 <a href='#SkRect_joinNonEmptyArg'>joinNonEmptyArg</a> <a href='#SkRect_joinPossiblyEmptyRect'>joinPossiblyEmptyRect</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_join'>join</a> 2381 2382 <a name='SkRect_joinNonEmptyArg'></a> 2383 2384 --- 2385 2386 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2387 void <a href='#SkRect_joinNonEmptyArg'>joinNonEmptyArg</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) 2388 </pre> 2389 2390 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to the union of itself and <a href='#SkRect_joinNonEmptyArg_r'>r</a>. 2391 2392 Asserts if <a href='#SkRect_joinNonEmptyArg_r'>r</a> is empty and SK_DEBUG is defined. 2393 If <a href='SkRect_Reference#SkRect'>SkRect</a> is empty, sets <a href='SkRect_Reference#SkRect'>SkRect</a> to <a href='#SkRect_joinNonEmptyArg_r'>r</a>. 2394 2395 May produce incorrect results if <a href='#SkRect_joinNonEmptyArg_r'>r</a> is empty. 2396 2397 ### Parameters 2398 2399 <table> <tr> <td><a name='SkRect_joinNonEmptyArg_r'><code><strong>r</strong></code></a></td> 2400 <td>expansion <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2401 </tr> 2402 </table> 2403 2404 ### Example 2405 2406 <div><fiddle-embed name="88439de2aa0911262c60c0eb506396cb"><div>Since <a href='SkRect_Reference#Rect'>Rect</a> is not sorted, first result is copy of toJoin. 2407 </div> 2408 2409 #### Example Output 2410 2411 ~~~~ 2412 rect: 50, 60, 55, 65 2413 sorted: 10, 0, 55, 100 2414 ~~~~ 2415 2416 </fiddle-embed></div> 2417 2418 ### See Also 2419 2420 <a href='#SkRect_join'>join</a> <a href='#SkRect_joinPossiblyEmptyRect'>joinPossiblyEmptyRect</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_join'>join</a> 2421 2422 <a name='SkRect_joinPossiblyEmptyRect'></a> 2423 2424 --- 2425 2426 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2427 void <a href='#SkRect_joinPossiblyEmptyRect'>joinPossiblyEmptyRect</a>(const <a href='SkRect_Reference#SkRect'>SkRect</a>& r) 2428 </pre> 2429 2430 Sets <a href='SkRect_Reference#SkRect'>SkRect</a> to the union of itself and the construction. 2431 2432 May produce incorrect results if <a href='SkRect_Reference#SkRect'>SkRect</a> or <a href='#SkRect_joinPossiblyEmptyRect_r'>r</a> is empty. 2433 2434 ### Parameters 2435 2436 <table> <tr> <td><a name='SkRect_joinPossiblyEmptyRect_r'><code><strong>r</strong></code></a></td> 2437 <td>expansion <a href='SkRect_Reference#SkRect'>SkRect</a></td> 2438 </tr> 2439 </table> 2440 2441 ### Example 2442 2443 <div><fiddle-embed name="a476548d0001296afd8e58c1eba1b70b"><div>Since <a href='SkRect_Reference#Rect'>Rect</a> is not sorted, first result is not useful. 2444 </div> 2445 2446 #### Example Output 2447 2448 ~~~~ 2449 rect: 10, 60, 55, 65 2450 sorted: 10, 0, 55, 100 2451 ~~~~ 2452 2453 </fiddle-embed></div> 2454 2455 ### See Also 2456 2457 <a href='#SkRect_joinNonEmptyArg'>joinNonEmptyArg</a> <a href='#SkRect_join'>join</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_join'>join</a> 2458 2459 <a name='Rounding'></a> 2460 2461 <a name='SkRect_round'></a> 2462 2463 --- 2464 2465 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2466 void round(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* dst)const 2467 </pre> 2468 2469 Sets <a href='SkIRect_Reference#IRect'>IRect</a> by adding 0.5 and discarding the fractional portion of <a href='SkRect_Reference#Rect'>Rect</a> 2470 members, using <code>(<a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fTop'>fTop</a>), 2471 <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fBottom'>fBottom</a>))</code>. 2472 2473 ### Parameters 2474 2475 <table> <tr> <td><a name='SkRect_round_dst'><code><strong>dst</strong></code></a></td> 2476 <td>storage for <a href='SkIRect_Reference#IRect'>IRect</a></td> 2477 </tr> 2478 </table> 2479 2480 ### Example 2481 2482 <div><fiddle-embed name="8b9e5a9af0a9b878f76919534d88f41e"> 2483 2484 #### Example Output 2485 2486 ~~~~ 2487 round: 31, 51, 41, 61 2488 ~~~~ 2489 2490 </fiddle-embed></div> 2491 2492 ### See Also 2493 2494 <a href='#SkRect_roundIn'>roundIn</a> <a href='#SkRect_roundOut'>roundOut</a> <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a> 2495 2496 <a name='SkRect_roundOut'></a> 2497 2498 --- 2499 2500 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2501 void <a href='#SkRect_roundOut'>roundOut</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* dst)const 2502 </pre> 2503 2504 Sets <a href='SkIRect_Reference#IRect'>IRect</a> by discarding the fractional portion of <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fTop'>fTop</a>; and rounding 2505 up <a href='#SkRect_fRight'>fRight</a> and <a href='#SkRect_fBottom'>fBottom</a>, using 2506 <code>(<a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fTop'>fTop</a>), 2507 <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fBottom'>fBottom</a>))</code>. 2508 2509 ### Parameters 2510 2511 <table> <tr> <td><a name='SkRect_roundOut_dst'><code><strong>dst</strong></code></a></td> 2512 <td>storage for <a href='SkIRect_Reference#IRect'>IRect</a></td> 2513 </tr> 2514 </table> 2515 2516 ### Example 2517 2518 <div><fiddle-embed name="0bd13d7e6426ae7a3befa2ab151ac5fc"> 2519 2520 #### Example Output 2521 2522 ~~~~ 2523 round: 30, 50, 41, 61 2524 ~~~~ 2525 2526 </fiddle-embed></div> 2527 2528 ### See Also 2529 2530 <a href='#SkRect_roundIn'>roundIn</a> <a href='#SkRect_round'>round</a> <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a> 2531 2532 <a name='SkRect_roundOut_2'></a> 2533 2534 --- 2535 2536 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2537 void <a href='#SkRect_roundOut'>roundOut</a>(<a href='SkRect_Reference#SkRect'>SkRect</a>* dst)const 2538 </pre> 2539 2540 Sets <a href='SkRect_Reference#Rect'>Rect</a> by discarding the fractional portion of <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fTop'>fTop</a>; and rounding 2541 up <a href='#SkRect_fRight'>fRight</a> and <a href='#SkRect_fBottom'>fBottom</a>, using 2542 <code>(<a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fTop'>fTop</a>), 2543 <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fBottom'>fBottom</a>))</code>. 2544 2545 ### Parameters 2546 2547 <table> <tr> <td><a name='SkRect_roundOut_2_dst'><code><strong>dst</strong></code></a></td> 2548 <td>storage for <a href='SkRect_Reference#Rect'>Rect</a></td> 2549 </tr> 2550 </table> 2551 2552 ### Example 2553 2554 <div><fiddle-embed name="e09a6a12869a8ac21e9c2af98a5bb686"> 2555 2556 #### Example Output 2557 2558 ~~~~ 2559 round: 30, 50, 41, 61 2560 ~~~~ 2561 2562 </fiddle-embed></div> 2563 2564 ### See Also 2565 2566 <a href='#SkRect_roundIn'>roundIn</a> <a href='#SkRect_round'>round</a> <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a> 2567 2568 <a name='SkRect_roundIn'></a> 2569 2570 --- 2571 2572 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2573 void <a href='#SkRect_roundIn'>roundIn</a>(<a href='SkIRect_Reference#SkIRect'>SkIRect</a>* dst)const 2574 </pre> 2575 2576 Sets <a href='SkRect_Reference#Rect'>Rect</a> by rounding up <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fTop'>fTop</a>; and discarding the fractional portion 2577 of <a href='#SkRect_fRight'>fRight</a> and <a href='#SkRect_fBottom'>fBottom</a>, using 2578 <code>(<a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fTop'>fTop</a>), 2579 <a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fBottom'>fBottom</a>))</code>. 2580 2581 ### Parameters 2582 2583 <table> <tr> <td><a name='SkRect_roundIn_dst'><code><strong>dst</strong></code></a></td> 2584 <td>storage for <a href='SkIRect_Reference#IRect'>IRect</a></td> 2585 </tr> 2586 </table> 2587 2588 ### Example 2589 2590 <div><fiddle-embed name="abb337da8fc1891f016c61258681c64c"> 2591 2592 #### Example Output 2593 2594 ~~~~ 2595 round: 31, 51, 40, 60 2596 ~~~~ 2597 2598 </fiddle-embed></div> 2599 2600 ### See Also 2601 2602 <a href='#SkRect_roundOut'>roundOut</a> <a href='#SkRect_round'>round</a> <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a> 2603 2604 <a name='SkRect_round_2'></a> 2605 2606 --- 2607 2608 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2609 <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkRect_round'>round()</a>const 2610 </pre> 2611 2612 Returns <a href='SkIRect_Reference#IRect'>IRect</a> by adding 0.5 and discarding the fractional portion of <a href='SkRect_Reference#Rect'>Rect</a> 2613 members, using <code>(<a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fTop'>fTop</a>), 2614 <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a>(<a href='#SkRect_fBottom'>fBottom</a>))</code>. 2615 2616 ### Return Value 2617 2618 rounded <a href='SkIRect_Reference#IRect'>IRect</a> 2619 2620 ### Example 2621 2622 <div><fiddle-embed name="ef7ae1dd522c235b0afe41b55a624f46"> 2623 2624 #### Example Output 2625 2626 ~~~~ 2627 round: 31, 51, 41, 61 2628 ~~~~ 2629 2630 </fiddle-embed></div> 2631 2632 ### See Also 2633 2634 <a href='#SkRect_roundOut'>roundOut</a> <a href='#SkRect_roundIn'>roundIn</a> <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a> 2635 2636 <a name='SkRect_roundOut_3'></a> 2637 2638 --- 2639 2640 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2641 <a href='SkIRect_Reference#SkIRect'>SkIRect</a> <a href='#SkRect_roundOut'>roundOut</a>()const 2642 </pre> 2643 2644 Sets <a href='SkIRect_Reference#IRect'>IRect</a> by discarding the fractional portion of <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fTop'>fTop</a>; and rounding 2645 up <a href='#SkRect_fRight'>fRight</a> and <a href='#SkRect_fBottom'>fBottom</a>, using 2646 <code>(<a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fLeft'>fLeft</a>), <a href='undocumented#SkScalarFloorToInt'>SkScalarFloorToInt</a>(<a href='#SkRect_fTop'>fTop</a>), 2647 <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fRight'>fRight</a>), <a href='undocumented#SkScalarCeilToInt'>SkScalarCeilToInt</a>(<a href='#SkRect_fBottom'>fBottom</a>))</code>. 2648 2649 ### Return Value 2650 2651 rounded <a href='SkIRect_Reference#IRect'>IRect</a> 2652 2653 ### Example 2654 2655 <div><fiddle-embed name="05f0f65ae148f192656cd87df90f1d57"> 2656 2657 #### Example Output 2658 2659 ~~~~ 2660 round: 30, 50, 41, 61 2661 ~~~~ 2662 2663 </fiddle-embed></div> 2664 2665 ### See Also 2666 2667 <a href='#SkRect_round'>round</a> <a href='#SkRect_roundIn'>roundIn</a> <a href='undocumented#SkScalarRoundToInt'>SkScalarRoundToInt</a> 2668 2669 <a name='Sorting'></a> 2670 2671 <a name='SkRect_sort'></a> 2672 2673 --- 2674 2675 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2676 void <a href='#SkRect_sort'>sort()</a> 2677 </pre> 2678 2679 Swaps <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a> if <a href='#SkRect_fLeft'>fLeft</a> is greater than <a href='#SkRect_fRight'>fRight</a>; and swaps 2680 <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a> if <a href='#SkRect_fTop'>fTop</a> is greater than <a href='#SkRect_fBottom'>fBottom</a>. Result may be empty; 2681 and <a href='#SkRect_width'>width()</a> and <a href='#SkRect_height'>height()</a> will be zero or positive. 2682 2683 ### Example 2684 2685 <div><fiddle-embed name="e624fe398e3d770b573c09fc74c0c400"> 2686 2687 #### Example Output 2688 2689 ~~~~ 2690 rect: 30.5, 50.5, 20.5, 10.5 2691 sorted: 20.5, 10.5, 30.5, 50.5 2692 ~~~~ 2693 2694 </fiddle-embed></div> 2695 2696 ### See Also 2697 2698 <a href='#SkRect_makeSorted'>makeSorted</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_sort'>sort</a> <a href='#SkRect_isSorted'>isSorted</a> 2699 2700 <a name='SkRect_makeSorted'></a> 2701 2702 --- 2703 2704 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2705 <a href='SkRect_Reference#SkRect'>SkRect</a> <a href='#SkRect_makeSorted'>makeSorted</a>()const 2706 </pre> 2707 2708 Returns <a href='SkRect_Reference#SkRect'>SkRect</a> with <a href='#SkRect_fLeft'>fLeft</a> and <a href='#SkRect_fRight'>fRight</a> swapped if <a href='#SkRect_fLeft'>fLeft</a> is greater than <a href='#SkRect_fRight'>fRight</a>; and 2709 with <a href='#SkRect_fTop'>fTop</a> and <a href='#SkRect_fBottom'>fBottom</a> swapped if <a href='#SkRect_fTop'>fTop</a> is greater than <a href='#SkRect_fBottom'>fBottom</a>. Result may be empty; 2710 and <a href='#SkRect_width'>width()</a> and <a href='#SkRect_height'>height()</a> will be zero or positive. 2711 2712 ### Return Value 2713 2714 sorted <a href='SkRect_Reference#SkRect'>SkRect</a> 2715 2716 ### Example 2717 2718 <div><fiddle-embed name="f59567042b87f6b26f9bfeeb04468032"> 2719 2720 #### Example Output 2721 2722 ~~~~ 2723 rect: 30.5, 50.5, 20.5, 10.5 2724 sorted: 20.5, 10.5, 30.5, 50.5 2725 ~~~~ 2726 2727 </fiddle-embed></div> 2728 2729 ### See Also 2730 2731 <a href='#SkRect_sort'>sort</a> <a href='SkIRect_Reference#SkIRect'>SkIRect</a>::<a href='#SkIRect_makeSorted'>makeSorted</a> <a href='#SkRect_isSorted'>isSorted</a> 2732 2733 <a name='SkRect_asScalars'></a> 2734 2735 --- 2736 2737 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2738 const <a href='undocumented#SkScalar'>SkScalar</a>* <a href='#SkRect_asScalars'>asScalars</a>()const 2739 </pre> 2740 2741 Returns pointer to first <a href='undocumented#Scalar'>scalar</a> in <a href='SkRect_Reference#SkRect'>SkRect</a>, to treat it as an array with four 2742 entries. 2743 2744 ### Return Value 2745 2746 pointer to <a href='#SkRect_fLeft'>fLeft</a> 2747 2748 ### Example 2749 2750 <div><fiddle-embed name="e1ea5f949d80276f3637931eae93a07c"> 2751 2752 #### Example Output 2753 2754 ~~~~ 2755 rect.asScalars() == &rect.fLeft 2756 ~~~~ 2757 2758 </fiddle-embed></div> 2759 2760 ### See Also 2761 2762 <a href='#SkRect_toQuad'>toQuad</a> 2763 2764 <a name='SkRect_dump'></a> 2765 2766 --- 2767 2768 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2769 void <a href='#SkRect_dump'>dump</a>(bool asHex)const 2770 </pre> 2771 2772 Writes <a href='undocumented#Text'>text</a> representation of <a href='SkRect_Reference#SkRect'>SkRect</a> to standard output. Set <a href='#SkRect_dump_asHex'>asHex</a> to true to 2773 generate exact binary representations of floating <a href='SkPoint_Reference#Point'>point</a> numbers. 2774 2775 ### Parameters 2776 2777 <table> <tr> <td><a name='SkRect_dump_asHex'><code><strong>asHex</strong></code></a></td> 2778 <td>true if <a href='undocumented#SkScalar'>SkScalar</a> values are written as hexadecimal</td> 2779 </tr> 2780 </table> 2781 2782 ### Example 2783 2784 <div><fiddle-embed name="cea049ffff702a5923da41fe0ae0763b"> 2785 2786 #### Example Output 2787 2788 ~~~~ 2789 SkRect::MakeLTRB(20, 30, 40, 50); 2790 SkRect::MakeLTRB(SkBits2Float(0x41a00000), /* 20.000000 */ 2791 SkBits2Float(0x41f00000), /* 30.000000 */ 2792 SkBits2Float(0x42200000), /* 40.000000 */ 2793 SkBits2Float(0x42480000) /* 50.000000 */); 2794 ~~~~ 2795 2796 </fiddle-embed></div> 2797 2798 ### See Also 2799 2800 <a href='#SkRect_dumpHex'>dumpHex</a> 2801 2802 <a name='SkRect_dump_2'></a> 2803 2804 --- 2805 2806 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2807 void <a href='#SkRect_dump'>dump()</a>const 2808 </pre> 2809 2810 Writes <a href='undocumented#Text'>text</a> representation of <a href='SkRect_Reference#SkRect'>SkRect</a> to standard output. The representation may be 2811 directly compiled as C++ code. Floating <a href='SkPoint_Reference#Point'>point</a> values are written 2812 with limited precision; it may not be possible to reconstruct original <a href='SkRect_Reference#SkRect'>SkRect</a> 2813 from output. 2814 2815 ### Example 2816 2817 <div><fiddle-embed name="9fb76971b1a104a2a59816e0392267a7"> 2818 2819 #### Example Output 2820 2821 ~~~~ 2822 SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7); 2823 rect is not equal to copy 2824 ~~~~ 2825 2826 </fiddle-embed></div> 2827 2828 ### See Also 2829 2830 <a href='#SkRect_dumpHex'>dumpHex</a> 2831 2832 <a name='SkRect_dumpHex'></a> 2833 2834 --- 2835 2836 <pre style="padding: 1em 1em 1em 1em; width: 62.5em;background-color: #f0f0f0"> 2837 void <a href='#SkRect_dumpHex'>dumpHex</a>()const 2838 </pre> 2839 2840 Writes <a href='undocumented#Text'>text</a> representation of <a href='SkRect_Reference#Rect'>Rect</a> to standard output. The representation may be 2841 directly compiled as C++ code. Floating <a href='SkPoint_Reference#Point'>point</a> values are written 2842 in hexadecimal to preserve their exact bit pattern. The output reconstructs the 2843 original <a href='SkRect_Reference#Rect'>Rect</a>. 2844 2845 Use instead of <a href='#SkRect_dump'>dump()</a> when submitting 2846 <a href='https://bug.skia.org'>bug reports against Skia</a></a> . 2847 2848 ### Example 2849 2850 <div><fiddle-embed name="824b5a3fcfd46a7e1c5f9e3c16e6bb39"> 2851 2852 #### Example Output 2853 2854 ~~~~ 2855 SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ 2856 SkBits2Float(0x3f2aaaab), /* 0.666667 */ 2857 SkBits2Float(0x40266666), /* 2.600000 */ 2858 SkBits2Float(0x40e00000) /* 7.000000 */); 2859 rect is equal to copy 2860 ~~~~ 2861 2862 </fiddle-embed></div> 2863 2864 ### See Also 2865 2866 <a href='#SkRect_dump'>dump</a> 2867 2868