Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1 | #Topic Rect |
| 2 | #Alias Rects |
| 3 | #Alias Rect_Reference |
| 4 | |
| 5 | #Struct SkRect |
| 6 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 7 | SkRect holds four SkScalar coordinates describing the upper and |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 8 | lower bounds of a rectangle. SkRect may be created from outer bounds or |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 9 | from position, width, and height. SkRect describes an area; if its right |
| 10 | is less than or equal to its left, or if its bottom is less than or equal to |
| 11 | its top, it is considered empty. |
| 12 | |
| 13 | # move to topic about MakeIWH and friends |
| 14 | SkRect can be constructed from int values to avoid compiler warnings that |
| 15 | integer input cannot convert to SkScalar without loss of precision. |
| 16 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 17 | #Subtopic Overview |
| 18 | #Populate |
| 19 | ## |
| 20 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 21 | #Subtopic Related_Function |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 22 | #Populate |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 23 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 24 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 25 | #Subtopic Member_Function |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 26 | #Populate |
| 27 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 28 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 29 | #Subtopic Member |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 30 | #Populate |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 31 | |
| 32 | #Member SkScalar fLeft |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 33 | #Line # smaller x-axis bounds ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 34 | May contain any value, including infinities and NaN. The smaller of the |
| 35 | horizontal values when sorted. When equal to or greater than fRight, Rect is empty. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 36 | ## |
| 37 | |
| 38 | #Member SkScalar fTop |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 39 | #Line # smaller y-axis bounds ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 40 | May contain any value, including infinities and NaN. The smaller of the |
| 41 | vertical values when sorted. When equal to or greater than fBottom, Rect is empty. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 42 | ## |
| 43 | |
| 44 | #Member SkScalar fRight |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 45 | #Line # larger x-axis bounds ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 46 | May contain any value, including infinities and NaN. The larger of the |
| 47 | horizontal values when sorted. When equal to or less than fLeft, Rect is empty. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 48 | ## |
| 49 | |
| 50 | #Member SkScalar fBottom |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 51 | #Line # larger y-axis bounds ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 52 | May contain any value, including infinities and NaN. The larger of the |
| 53 | vertical values when sorted. When equal to or less than fTop, Rect is empty. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 54 | ## |
| 55 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 56 | #Subtopic Member ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 57 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 58 | #Subtopic Constructor |
| 59 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 60 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 61 | # ------------------------------------------------------------------------------ |
| 62 | |
| 63 | #Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty() |
| 64 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 65 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 66 | #Line # constructs from bounds of (0, 0, 0, 0) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 67 | Returns constructed Rect set to (0, 0, 0, 0). |
| 68 | Many other rectangles are empty; if left is equal to or greater than right, |
| 69 | or if top is equal to or greater than bottom. Setting all members to zero |
| 70 | is a convenience, but does not designate a special empty rectangle. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 71 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 72 | #Return bounds (0, 0, 0, 0) ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 73 | |
| 74 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 75 | SkRect rect = SkRect::MakeEmpty(); |
| 76 | SkDebugf("MakeEmpty isEmpty: %s\n", rect.isEmpty() ? "true" : "false"); |
| 77 | rect.offset(10, 10); |
| 78 | SkDebugf("offset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false"); |
| 79 | rect.inset(10, 10); |
| 80 | SkDebugf("inset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false"); |
| 81 | rect.outset(20, 20); |
| 82 | SkDebugf("outset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false"); |
| 83 | #StdOut |
| 84 | MakeEmpty isEmpty: true |
| 85 | offset rect isEmpty: true |
| 86 | inset rect isEmpty: true |
| 87 | outset rect isEmpty: false |
| 88 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 89 | ## |
| 90 | |
Mike Reed | 274218e | 2018-01-08 15:05:02 -0500 | [diff] [blame] | 91 | #SeeAlso isEmpty setEmpty SkIRect::MakeEmpty |
Cary Clark | 884dd7d | 2017-10-11 10:37:52 -0400 | [diff] [blame] | 92 | |
| 93 | ## |
| 94 | |
| 95 | # ------------------------------------------------------------------------------ |
| 96 | |
| 97 | #Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 98 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 99 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 100 | #Line # constructs from SkScalar input returning (0, 0, width, height) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 101 | Returns constructed Rect set to SkScalar values (0, 0, w, h). Does not |
| 102 | validate input; w or h may be negative. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 103 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 104 | Passing integer values may generate a compiler warning since Rect cannot |
| 105 | represent 32-bit integers exactly. Use SkIRect for an exact integer rectangle. |
| 106 | |
| 107 | #Param w SkScalar width of constructed Rect ## |
| 108 | #Param h SkScalar height of constructed Rect ## |
| 109 | |
| 110 | #Return bounds (0, 0, w, h) ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 111 | |
| 112 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 113 | SkRect rect1 = SkRect::MakeWH(25, 35); |
| 114 | SkRect rect2 = SkRect::MakeIWH(25, 35); |
| 115 | SkRect rect3 = SkRect::MakeXYWH(0, 0, 25, 35); |
| 116 | SkRect rect4 = SkRect::MakeLTRB(0, 0, 25, 35); |
| 117 | SkDebugf("all %s" "equal\n", rect1 == rect2 && rect2 == rect3 && rect3 == rect4 ? |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 118 | "" : "not "); |
| 119 | #StdOut |
| 120 | all equal |
| 121 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 122 | ## |
| 123 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 124 | #SeeAlso MakeSize MakeXYWH MakeIWH setWH SkIRect::MakeWH |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 125 | |
| 126 | ## |
| 127 | |
| 128 | # ------------------------------------------------------------------------------ |
| 129 | |
| 130 | #Method static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h) |
| 131 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 132 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 133 | #Line # constructs from int input returning (0, 0, width, height) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 134 | Returns constructed Rect set to integer values (0, 0, w, h). Does not validate |
| 135 | input; w or h may be negative. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 136 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 137 | Use to avoid a compiler warning that input may lose precision when stored. |
| 138 | Use SkIRect for an exact integer rectangle. |
| 139 | |
| 140 | #Param w integer width of constructed Rect ## |
| 141 | #Param h integer height of constructed Rect ## |
| 142 | |
| 143 | #Return bounds (0, 0, w, h) ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 144 | |
| 145 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 146 | SkIRect i_rect = SkIRect::MakeWH(25, 35); |
| 147 | SkRect f_rect = SkRect::MakeIWH(25, 35); |
| 148 | SkDebugf("i_rect width: %d f_rect width:%g\n", i_rect.width(), f_rect.width()); |
| 149 | i_rect = SkIRect::MakeWH(125000111, 0); |
| 150 | f_rect = SkRect::MakeIWH(125000111, 0); |
| 151 | SkDebugf("i_rect width: %d f_rect width:%.0f\n", i_rect.width(), f_rect.width()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 152 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 153 | i_rect width: 25 f_rect width:25 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 154 | i_rect width: 125000111 f_rect width:125000112 |
| 155 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 156 | ## |
| 157 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 158 | #SeeAlso MakeXYWH MakeWH isetWH SkIRect::MakeWH |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 159 | |
| 160 | ## |
| 161 | |
| 162 | # ------------------------------------------------------------------------------ |
| 163 | |
Cary Clark | 884dd7d | 2017-10-11 10:37:52 -0400 | [diff] [blame] | 164 | #Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 165 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 166 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 167 | #Line # constructs from Size returning (0, 0, width, height) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 168 | Returns constructed Rect set to (0, 0, size.width(), size.height()). Does not |
| 169 | validate input; size.width() or size.height() may be negative. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 170 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 171 | #Param size SkScalar values for Rect width and height ## |
| 172 | |
| 173 | #Return bounds (0, 0, size.width(), size.height()) ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 174 | |
| 175 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 176 | SkSize size = {25.5f, 35.5f}; |
| 177 | SkRect rect = SkRect::MakeSize(size); |
| 178 | SkDebugf("rect width: %g height: %g\n", rect.width(), rect.height()); |
| 179 | SkISize floor = size.toFloor(); |
| 180 | rect = SkRect::MakeSize(SkSize::Make(floor)); |
| 181 | SkDebugf("floor width: %g height: %g\n", rect.width(), rect.height()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 182 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 183 | rect width: 25.5 height: 35.5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 184 | floor width: 25 height: 35 |
| 185 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 186 | ## |
| 187 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 188 | #SeeAlso MakeWH MakeXYWH MakeIWH setWH SkIRect::MakeWH |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 189 | |
| 190 | ## |
| 191 | |
| 192 | # ------------------------------------------------------------------------------ |
| 193 | |
| 194 | #Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScalar r, |
| 195 | SkScalar b) |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 196 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 197 | #Line # constructs from SkScalar left, top, right, bottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 198 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 199 | Returns constructed Rect set to (l, t, r, b). Does not sort input; Rect may |
| 200 | result in fLeft greater than fRight, or fTop greater than fBottom. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 201 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 202 | #Param l SkScalar stored in fLeft ## |
| 203 | #Param t SkScalar stored in fTop ## |
| 204 | #Param r SkScalar stored in fRight ## |
| 205 | #Param b SkScalar stored in fBottom ## |
| 206 | |
| 207 | #Return bounds (l, t, r, b) ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 208 | |
| 209 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 210 | SkRect rect = SkRect::MakeLTRB(5, 35, 15, 25); |
| 211 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 212 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 213 | rect.sort(); |
| 214 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 215 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 216 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 217 | rect: 5, 35, 15, 25 isEmpty: true |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 218 | rect: 5, 25, 15, 35 isEmpty: false |
| 219 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 220 | ## |
| 221 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 222 | #SeeAlso MakeXYWH SkIRect::MakeLTRB |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 223 | |
| 224 | ## |
| 225 | |
| 226 | # ------------------------------------------------------------------------------ |
| 227 | |
Cary Clark | 884dd7d | 2017-10-11 10:37:52 -0400 | [diff] [blame] | 228 | #Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w, SkScalar h) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 229 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 230 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 231 | #Line # constructs from SkScalar input returning (x, y, width, height) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 232 | Returns constructed Rect set to |
| 233 | #Formula |
| 234 | (x, y, x + w, y + h) |
| 235 | ## |
| 236 | . Does not validate input; |
| 237 | w or h may be negative. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 238 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 239 | #Param x stored in fLeft ## |
| 240 | #Param y stored in fTop ## |
| 241 | #Param w added to x and stored in fRight ## |
| 242 | #Param h added to y and stored in fBottom ## |
| 243 | |
Cary Clark | 884dd7d | 2017-10-11 10:37:52 -0400 | [diff] [blame] | 244 | #Return bounds at (x, y) with width w and height h ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 245 | |
| 246 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 247 | SkRect rect = SkRect::MakeXYWH(5, 35, -15, 25); |
| 248 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 249 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 250 | rect.sort(); |
| 251 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 252 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 253 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 254 | rect: 5, 35, -10, 60 isEmpty: true |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 255 | rect: -10, 35, 5, 60 isEmpty: false |
| 256 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 257 | ## |
| 258 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 259 | #SeeAlso MakeLTRB SkIRect::MakeXYWH |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 260 | |
| 261 | ## |
| 262 | |
| 263 | # ------------------------------------------------------------------------------ |
| 264 | |
| 265 | #Method static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect) |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 266 | #Deprecated |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 267 | ## |
| 268 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 269 | # ------------------------------------------------------------------------------ |
| 270 | |
| 271 | #Method static SkRect Make(const SkISize& size) |
| 272 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 273 | #In Constructor |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 274 | #Line # constructs from ISize returning (0, 0, width, height) ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 275 | Returns constructed IRect set to (0, 0, size.width(), size.height()). |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 276 | Does not validate input; size.width() or size.height() may be negative. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 277 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 278 | #Param size integer values for Rect width and height ## |
| 279 | |
| 280 | #Return bounds (0, 0, size.width(), size.height()) ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 281 | |
| 282 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 283 | SkRect rect1 = SkRect::MakeSize({2, 35}); |
| 284 | SkRect rect2 = SkRect::MakeIWH(2, 35); |
| 285 | SkDebugf("rect1 %c= rect2\n", rect1 == rect2 ? '=' : '!'); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 286 | #StdOut |
| 287 | rect1 == rect2 |
| 288 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 289 | ## |
| 290 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 291 | #SeeAlso MakeWH MakeXYWH SkRect::MakeIWH SkIRect::MakeSize |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 292 | |
| 293 | ## |
| 294 | |
| 295 | # ------------------------------------------------------------------------------ |
| 296 | |
| 297 | #Method static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) |
| 298 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 299 | #In Constructor |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 300 | Returns constructed IRect set to irect, promoting integers to Scalar. |
| 301 | Does not validate input; fLeft may be greater than fRight, fTop may be greater |
| 302 | than fBottom. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 303 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 304 | #Param irect integer unsorted bounds ## |
| 305 | |
| 306 | #Return irect members converted to SkScalar ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 307 | |
| 308 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 309 | SkIRect i_rect1 = {2, 35, 22, 53}; |
| 310 | SkRect f_rect = SkRect::Make(i_rect1); |
| 311 | f_rect.offset(0.49f, 0.49f); |
| 312 | SkIRect i_rect2; |
| 313 | f_rect.round(&i_rect2); |
| 314 | SkDebugf("i_rect1 %c= i_rect2\n", i_rect1 == i_rect2? '=' : '!'); |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 315 | ## |
| 316 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 317 | #SeeAlso MakeLTRB |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 318 | |
| 319 | ## |
| 320 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 321 | #Subtopic Constructor ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 322 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 323 | #Subtopic Property |
| 324 | #Line # member values, center, validity ## |
| 325 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 326 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 327 | # ------------------------------------------------------------------------------ |
| 328 | |
| 329 | #Method bool isEmpty() const |
| 330 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 331 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 332 | #Line # returns true if width or height are zero or negative ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 333 | Returns true if fLeft is equal to or greater than fRight, or if fTop is equal |
| 334 | to or greater than fBottom. Call sort() to reverse rectangles with negative |
| 335 | width() or height(). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 336 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 337 | #Return true if width() or height() are zero or negative ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 338 | |
| 339 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 340 | SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}}; |
| 341 | for (auto rect : tests) { |
| 342 | SkDebugf("rect: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(), |
| 343 | rect.bottom(), rect.isEmpty() ? "" : " not"); |
| 344 | rect.sort(); |
| 345 | SkDebugf("sorted: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(), |
| 346 | rect.bottom(), rect.isEmpty() ? "" : " not"); |
| 347 | } |
| 348 | #StdOut |
| 349 | rect: {20, 40, 10, 50} is empty |
| 350 | sorted: {10, 40, 20, 50} is not empty |
| 351 | rect: {20, 40, 20, 50} is empty |
| 352 | sorted: {20, 40, 20, 50} is empty |
| 353 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 354 | ## |
| 355 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 356 | #SeeAlso MakeEmpty sort SkIRect::isEmpty |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 357 | |
| 358 | ## |
| 359 | |
| 360 | # ------------------------------------------------------------------------------ |
| 361 | |
| 362 | #Method bool isSorted() const |
| 363 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 364 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 365 | #Line # returns true if width or height are zero or positive ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 366 | Returns true if fLeft is equal to or less than fRight, or if fTop is equal |
| 367 | to or less than fBottom. Call sort() to reverse rectangles with negative |
| 368 | width() or height(). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 369 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 370 | #Return true if width() or height() are zero or positive ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 371 | |
| 372 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 373 | SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}}; |
| 374 | for (auto rect : tests) { |
| 375 | SkDebugf("rect: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(), |
| 376 | rect.bottom(), rect.isSorted() ? "" : " not"); |
| 377 | rect.sort(); |
| 378 | SkDebugf("sorted: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(), |
| 379 | rect.bottom(), rect.isSorted() ? "" : " not"); |
| 380 | } |
| 381 | #StdOut |
| 382 | rect: {20, 40, 10, 50} is not sorted |
| 383 | sorted: {10, 40, 20, 50} is sorted |
| 384 | rect: {20, 40, 20, 50} is sorted |
| 385 | sorted: {20, 40, 20, 50} is sorted |
| 386 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 387 | ## |
| 388 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 389 | #SeeAlso sort makeSorted isEmpty |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 390 | |
| 391 | ## |
| 392 | |
| 393 | # ------------------------------------------------------------------------------ |
| 394 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 395 | #Method bool isFinite() const |
| 396 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 397 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 398 | #Line # returns true if no member is infinite or NaN ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 399 | Returns true if all values in the rectangle are finite: SK_ScalarMin or larger, |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 400 | and SK_ScalarMax or smaller. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 401 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 402 | #Return true if no member is infinite or NaN ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 403 | |
| 404 | #Example |
Mike Reed | 274218e | 2018-01-08 15:05:02 -0500 | [diff] [blame] | 405 | SkRect largest = { SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax }; |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 406 | SkDebugf("largest is finite: %s\n", largest.isFinite() ? "true" : "false"); |
| 407 | SkDebugf("large width %g\n", largest.width()); |
| 408 | SkRect widest = SkRect::MakeWH(largest.width(), largest.height()); |
| 409 | SkDebugf("widest is finite: %s\n", widest.isFinite() ? "true" : "false"); |
| 410 | #StdOut |
| 411 | largest is finite: true |
| 412 | large width inf |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 413 | widest is finite: false |
| 414 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 415 | ## |
| 416 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 417 | #SeeAlso SkScalarIsFinite SkScalarIsNaN |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 418 | |
| 419 | ## |
| 420 | |
| 421 | # ------------------------------------------------------------------------------ |
| 422 | |
| 423 | #Method SkScalar x() const |
| 424 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 425 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 426 | #Line # returns bounds left ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 427 | Returns left edge of Rect, if sorted. Call isSorted to see if Rect is valid. |
| 428 | Call sort() to reverse fLeft and fRight if needed. |
| 429 | |
| 430 | #Return fLeft ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 431 | |
| 432 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 433 | SkRect unsorted = { 15, 5, 10, 25 }; |
| 434 | SkDebugf("unsorted.fLeft: %g unsorted.x(): %g\n", unsorted.fLeft, unsorted.x()); |
| 435 | SkRect sorted = unsorted.makeSorted(); |
| 436 | SkDebugf("sorted.fLeft: %g sorted.x(): %g\n", sorted.fLeft, sorted.x()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 437 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 438 | unsorted.fLeft: 15 unsorted.x(): 15 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 439 | sorted.fLeft: 10 sorted.x(): 10 |
| 440 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 441 | ## |
| 442 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 443 | #SeeAlso fLeft left() y() SkIRect::x() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 444 | |
| 445 | ## |
| 446 | |
| 447 | # ------------------------------------------------------------------------------ |
| 448 | |
| 449 | #Method SkScalar y() const |
| 450 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 451 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 452 | #Line # returns bounds top ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 453 | Returns top edge of Rect, if sorted. Call isEmpty to see if Rect may be invalid, |
| 454 | and sort() to reverse fTop and fBottom if needed. |
| 455 | |
| 456 | #Return fTop ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 457 | |
| 458 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 459 | SkRect unsorted = { 15, 25, 10, 5 }; |
| 460 | SkDebugf("unsorted.fTop: %g unsorted.y(): %g\n", unsorted.fTop, unsorted.y()); |
| 461 | SkRect sorted = unsorted.makeSorted(); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 462 | SkDebugf("sorted.fTop: %g sorted.y(): %g\n", sorted.fTop, sorted.y()); |
| 463 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 464 | unsorted.fTop: 25 unsorted.y(): 25 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 465 | sorted.fTop: 5 sorted.y(): 5 |
| 466 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 467 | ## |
| 468 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 469 | #SeeAlso fTop top() x() SkIRect::y() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 470 | |
| 471 | ## |
| 472 | |
| 473 | # ------------------------------------------------------------------------------ |
| 474 | |
| 475 | #Method SkScalar left() const |
| 476 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 477 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 478 | #Line # returns smaller bounds in x, if sorted ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 479 | Returns left edge of Rect, if sorted. Call isSorted to see if Rect is valid. |
| 480 | Call sort() to reverse fLeft and fRight if needed. |
| 481 | |
| 482 | #Return fLeft ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 483 | |
| 484 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 485 | SkRect unsorted = { 15, 5, 10, 25 }; |
| 486 | SkDebugf("unsorted.fLeft: %g unsorted.left(): %g\n", unsorted.fLeft, unsorted.left()); |
| 487 | SkRect sorted = unsorted.makeSorted(); |
| 488 | SkDebugf("sorted.fLeft: %g sorted.left(): %g\n", sorted.fLeft, sorted.left()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 489 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 490 | unsorted.fLeft: 15 unsorted.left(): 15 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 491 | sorted.fLeft: 10 sorted.left(): 10 |
| 492 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 493 | ## |
| 494 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 495 | #SeeAlso fLeft x() SkIRect::left() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 496 | |
| 497 | ## |
| 498 | |
| 499 | # ------------------------------------------------------------------------------ |
| 500 | |
| 501 | #Method SkScalar top() const |
| 502 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 503 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 504 | #Line # returns smaller bounds in y, if sorted ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 505 | Returns top edge of Rect, if sorted. Call isEmpty to see if Rect may be invalid, |
| 506 | and sort() to reverse fTop and fBottom if needed. |
| 507 | |
| 508 | #Return fTop ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 509 | |
| 510 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 511 | SkRect unsorted = { 15, 25, 10, 5 }; |
| 512 | SkDebugf("unsorted.fTop: %g unsorted.top(): %g\n", unsorted.fTop, unsorted.top()); |
| 513 | SkRect sorted = unsorted.makeSorted(); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 514 | SkDebugf("sorted.fTop: %g sorted.top(): %g\n", sorted.fTop, sorted.top()); |
| 515 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 516 | unsorted.fTop: 25 unsorted.top(): 25 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 517 | sorted.fTop: 5 sorted.top(): 5 |
| 518 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 519 | ## |
| 520 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 521 | #SeeAlso fTop y() SkIRect::top() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 522 | |
| 523 | ## |
| 524 | |
| 525 | # ------------------------------------------------------------------------------ |
| 526 | |
| 527 | #Method SkScalar right() const |
| 528 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 529 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 530 | #Line # returns larger bounds in x, if sorted ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 531 | Returns right edge of Rect, if sorted. Call isSorted to see if Rect is valid. |
| 532 | Call sort() to reverse fLeft and fRight if needed. |
| 533 | |
| 534 | #Return fRight ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 535 | |
| 536 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 537 | SkRect unsorted = { 15, 25, 10, 5 }; |
| 538 | SkDebugf("unsorted.fRight: %g unsorted.right(): %g\n", unsorted.fRight, unsorted.right()); |
| 539 | SkRect sorted = unsorted.makeSorted(); |
| 540 | SkDebugf("sorted.fRight: %g sorted.right(): %g\n", sorted.fRight, sorted.right()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 541 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 542 | unsorted.fRight: 10 unsorted.right(): 10 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 543 | sorted.fRight: 15 sorted.right(): 15 |
| 544 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 545 | ## |
| 546 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 547 | #SeeAlso fRight SkIRect::right() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 548 | |
| 549 | ## |
| 550 | |
| 551 | # ------------------------------------------------------------------------------ |
| 552 | |
| 553 | #Method SkScalar bottom() const |
| 554 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 555 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 556 | #Line # returns larger bounds in y, if sorted ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 557 | Returns bottom edge of Rect, if sorted. Call isEmpty to see if Rect may be invalid, |
| 558 | and sort() to reverse fTop and fBottom if needed. |
| 559 | |
| 560 | #Return fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 561 | |
| 562 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 563 | SkRect unsorted = { 15, 25, 10, 5 }; |
| 564 | SkDebugf("unsorted.fBottom: %g unsorted.bottom(): %g\n", unsorted.fBottom, unsorted.bottom()); |
| 565 | SkRect sorted = unsorted.makeSorted(); |
| 566 | SkDebugf("sorted.fBottom: %g sorted.bottom(): %g\n", sorted.fBottom, sorted.bottom()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 567 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 568 | unsorted.fBottom: 5 unsorted.bottom(): 5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 569 | sorted.fBottom: 25 sorted.bottom(): 25 |
| 570 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 571 | ## |
| 572 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 573 | #SeeAlso fBottom SkIRect::bottom() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 574 | |
| 575 | ## |
| 576 | |
| 577 | # ------------------------------------------------------------------------------ |
| 578 | |
| 579 | #Method SkScalar width() const |
| 580 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 581 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 582 | #Line # returns span in x ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 583 | Returns span on the x-axis. This does not check if Rect is sorted, or if |
| 584 | result fits in 32-bit float; result may be negative or infinity. |
| 585 | |
| 586 | #Return fRight minus fLeft ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 587 | |
| 588 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 589 | #Description |
| 590 | Compare with SkIRect::width() example. |
| 591 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 592 | SkRect unsorted = { 15, 25, 10, 5 }; |
| 593 | SkDebugf("unsorted width: %g\n", unsorted.width()); |
| 594 | SkRect large = { -2147483647.f, 1, 2147483644.f, 2 }; |
| 595 | SkDebugf("large width: %.0f\n", large.width()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 596 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 597 | unsorted width: -5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 598 | large width: 4294967296 |
| 599 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 600 | ## |
| 601 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 602 | #SeeAlso height() SkIRect::width() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 603 | |
| 604 | ## |
| 605 | |
| 606 | # ------------------------------------------------------------------------------ |
| 607 | |
| 608 | #Method SkScalar height() const |
| 609 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 610 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 611 | #Line # returns span in y ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 612 | Returns span on the y-axis. This does not check if IRect is sorted, or if |
| 613 | result fits in 32-bit float; result may be negative or infinity. |
| 614 | |
| 615 | #Return fBottom minus fTop ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 616 | |
| 617 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 618 | #Description |
| 619 | Compare with SkIRect::height() example. |
| 620 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 621 | SkRect unsorted = { 15, 25, 10, 20 }; |
| 622 | SkDebugf("unsorted height: %g\n", unsorted.height()); |
| 623 | SkRect large = { 1, -2147483647.f, 2, 2147483644.f }; |
| 624 | SkDebugf("large height: %.0f\n", large.height()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 625 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 626 | unsorted height: -5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 627 | large height: 4294967296 |
| 628 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 629 | ## |
| 630 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 631 | #SeeAlso width() SkIRect::height() |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 632 | |
| 633 | ## |
| 634 | |
| 635 | # ------------------------------------------------------------------------------ |
| 636 | |
| 637 | #Method SkScalar centerX() const |
| 638 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 639 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 640 | #Line # returns midpoint in x ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 641 | Returns average of left edge and right edge. Result does not change if Rect |
| 642 | is sorted. Result may overflow to infinity if Rect is far from the origin. |
| 643 | |
| 644 | #Return midpoint in x ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 645 | |
| 646 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 647 | SkRect tests[] = {{20, 30, 41, 51}, {-20, -30, -41, -51}}; |
| 648 | for (auto rect : tests) { |
| 649 | SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX()); |
| 650 | rect.sort(); |
| 651 | SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX()); |
| 652 | } |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 653 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 654 | left: 20 right: 41 centerX: 30.5 |
| 655 | left: 20 right: 41 centerX: 30.5 |
| 656 | left: -20 right: -41 centerX: -30.5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 657 | left: -41 right: -20 centerX: -30.5 |
| 658 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 659 | ## |
| 660 | |
Cary Clark | 47d7dae | 2018-04-11 16:54:35 -0400 | [diff] [blame] | 661 | #SeeAlso centerY |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 662 | |
| 663 | ## |
| 664 | |
| 665 | # ------------------------------------------------------------------------------ |
| 666 | |
| 667 | #Method SkScalar centerY() const |
| 668 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 669 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 670 | #Line # returns midpoint in y ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 671 | Returns average of top edge and bottom edge. Result does not change if Rect |
| 672 | is sorted. Result may overflow to infinity if Rect is far from the origin. |
| 673 | |
| 674 | #Return midpoint in y ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 675 | |
| 676 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 677 | SkRect rect = { 2e+38, 2e+38, 3e+38, 3e+38 }; |
| 678 | SkDebugf("left: %g right: %g centerX: %g ", rect.left(), rect.right(), rect.centerX()); |
| 679 | SkDebugf("safe mid x: %g\n", rect.left() / 2 + rect.right() / 2); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 680 | #StdOut |
| 681 | left: 2e+38 right: 3e+38 centerX: inf safe mid x: 2.5e+38 |
| 682 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 683 | ## |
| 684 | |
Cary Clark | 47d7dae | 2018-04-11 16:54:35 -0400 | [diff] [blame] | 685 | #SeeAlso centerX |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 686 | |
| 687 | ## |
| 688 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 689 | #Subtopic Property ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 690 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 691 | #Subtopic Operator |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 692 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 693 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 694 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 695 | # ------------------------------------------------------------------------------ |
| 696 | |
Cary Clark | 884dd7d | 2017-10-11 10:37:52 -0400 | [diff] [blame] | 697 | #Method bool operator==(const SkRect& a, const SkRect& b) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 698 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 699 | #In Operator |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 700 | #Line # returns true if members are equal ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 701 | Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 702 | equal to the corresponding members in b. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 703 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 704 | a and b are not equal if either contain NaN. a and b are equal if members |
| 705 | contain zeroes width different signs. |
| 706 | |
| 707 | #Param a Rect to compare ## |
| 708 | #Param b Rect to compare ## |
| 709 | |
| 710 | #Return true if members are equal ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 711 | |
| 712 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 713 | auto debugster = [](const SkRect& test) -> void { |
| 714 | SkRect negZero = {-0.0f, -0.0f, 2, 2}; |
| 715 | SkDebugf("{%g, %g, %g, %g} %c= {%g, %g, %g, %g} %s numerically equal\n", |
| 716 | test.fLeft, test.fTop, test.fRight, test.fBottom, |
| 717 | negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom, |
| 718 | test == negZero ? '=' : '!', |
| 719 | test.fLeft == negZero.fLeft && test.fTop == negZero.fTop && |
| 720 | test.fRight == negZero.fRight && test.fBottom == negZero.fBottom ? |
| 721 | "and are" : "yet are not"); |
| 722 | }; |
| 723 | SkRect tests[] = {{0, 0, 2, 2}, {-0, -0, 2, 2}, {0.0f, 0.0f, 2, 2}}; |
| 724 | SkDebugf("tests are %s" "equal\n", tests[0] == tests[1] && tests[1] == tests[2] ? "" : "not "); |
| 725 | for (auto rect : tests) { |
| 726 | debugster(rect); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 727 | } |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 728 | #StdOut |
| 729 | tests are equal |
| 730 | {0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal |
| 731 | {0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 732 | {0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 733 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 734 | ## |
| 735 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 736 | #SeeAlso operator!=(const SkRect& a, const SkRect& b) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 737 | |
| 738 | ## |
| 739 | |
| 740 | # ------------------------------------------------------------------------------ |
| 741 | |
Cary Clark | 884dd7d | 2017-10-11 10:37:52 -0400 | [diff] [blame] | 742 | #Method bool operator!=(const SkRect& a, const SkRect& b) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 743 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 744 | #In Operator |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 745 | #Line # returns true if members are unequal ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 746 | Returns true if any in a: fLeft, fTop, fRight, and fBottom; does not |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 747 | equal the corresponding members in b. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 748 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 749 | a and b are not equal if either contain NaN. a and b are equal if members |
| 750 | contain zeroes width different signs. |
| 751 | |
| 752 | #Param a Rect to compare ## |
| 753 | #Param b Rect to compare ## |
| 754 | |
| 755 | #Return true if members are not equal ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 756 | |
| 757 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 758 | SkRect test = {0, 0, 2, SK_ScalarNaN}; |
| 759 | SkDebugf("test with NaN is %s" "equal to itself\n", test == test ? "" : "not "); |
| 760 | #StdOut |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 761 | test with NaN is not equal to itself |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 762 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 763 | ## |
| 764 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 765 | #SeeAlso operator==(const SkRect& a, const SkRect& b) |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 766 | |
| 767 | ## |
| 768 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 769 | #Subtopic Operator ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 770 | |
| 771 | #Subtopic As_Points |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 772 | #Line # conversion to and from Points ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 773 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 774 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 775 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 776 | # ------------------------------------------------------------------------------ |
| 777 | |
| 778 | #Method void toQuad(SkPoint quad[4]) const |
| 779 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 780 | #In As_Points |
| 781 | #Line # returns four corners as Point ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 782 | Returns four points in quad that enclose Rect ordered as: top-left, top-right, |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 783 | bottom-right, bottom-left. |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 784 | |
| 785 | #Private |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 786 | Consider adding param to control whether quad is clockwise or counterclockwise. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 787 | ## |
| 788 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 789 | #Param quad storage for corners of Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 790 | |
| 791 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 792 | SkRect rect = {1, 2, 3, 4}; |
| 793 | SkPoint corners[4]; |
| 794 | rect.toQuad(corners); |
| 795 | SkDebugf("rect: {%g, %g, %g, %g}\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 796 | SkDebugf("corners:"); |
| 797 | for (auto corner : corners) { |
| 798 | SkDebugf(" {%g, %g}", corner.fX, corner.fY); |
| 799 | } |
| 800 | SkDebugf("\n"); |
| 801 | #StdOut |
| 802 | rect: {1, 2, 3, 4} |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 803 | corners: {1, 2} {3, 2} {3, 4} {1, 4} |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 804 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 805 | ## |
| 806 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 807 | #SeeAlso SkPath::addRect |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 808 | |
| 809 | ## |
| 810 | |
| 811 | # ------------------------------------------------------------------------------ |
| 812 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 813 | #Method void setBounds(const SkPoint pts[], int count) |
| 814 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 815 | #In As_Points |
| 816 | #Line # sets to upper and lower limits of Point array ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 817 | Sets to bounds of Point array with count entries. If count is zero or smaller, |
| 818 | or if Point array contains an infinity or NaN, sets to (0, 0, 0, 0). |
| 819 | |
| 820 | Result is either empty or sorted: fLeft is less than or equal to fRight, and |
| 821 | fTop is less than or equal to fBottom. |
| 822 | |
| 823 | #Param pts Point array ## |
| 824 | #Param count entries in array ## |
| 825 | |
| 826 | #Example |
| 827 | SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}}; |
| 828 | for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) { |
| 829 | SkRect rect; |
| 830 | rect.setBounds(points, count); |
| 831 | if (count > 0) { |
| 832 | SkDebugf("added: %3g, %g ", points[count - 1].fX, points[count - 1].fY); |
| 833 | } else { |
| 834 | SkDebugf("%14s", " "); |
| 835 | } |
| 836 | SkDebugf("count: %d rect: %g, %g, %g, %g\n", count, |
| 837 | rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 838 | } |
| 839 | #StdOut |
| 840 | count: 0 rect: 0, 0, 0, 0 |
| 841 | added: 3, 4 count: 1 rect: 3, 4, 3, 4 |
| 842 | added: 1, 2 count: 2 rect: 1, 2, 3, 4 |
| 843 | added: 5, 6 count: 3 rect: 1, 2, 5, 6 |
| 844 | added: nan, 8 count: 4 rect: 0, 0, 0, 0 |
| 845 | ## |
| 846 | ## |
| 847 | |
| 848 | #SeeAlso set setBoundsCheck SkPath::addPoly |
| 849 | |
| 850 | ## |
| 851 | |
| 852 | # ------------------------------------------------------------------------------ |
| 853 | |
| 854 | #Method bool setBoundsCheck(const SkPoint pts[], int count) |
| 855 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 856 | #In As_Points |
| 857 | #Line # sets to upper and lower limits of Point array ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 858 | Sets to bounds of Point array with count entries. Returns false if count is |
| 859 | zero or smaller, or if Point array contains an infinity or NaN; in these cases |
| 860 | sets Rect to (0, 0, 0, 0). |
| 861 | |
| 862 | Result is either empty or sorted: fLeft is less than or equal to fRight, and |
| 863 | fTop is less than or equal to fBottom. |
| 864 | |
| 865 | #Param pts Point array ## |
| 866 | #Param count entries in array ## |
| 867 | |
| 868 | #Return true if all Point values are finite ## |
| 869 | |
| 870 | #Example |
| 871 | SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}}; |
| 872 | for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) { |
| 873 | SkRect rect; |
| 874 | bool success = rect.setBoundsCheck(points, count); |
| 875 | if (count > 0) { |
| 876 | SkDebugf("added: %3g, %g ", points[count - 1].fX, points[count - 1].fY); |
| 877 | } else { |
| 878 | SkDebugf("%14s", " "); |
| 879 | } |
| 880 | SkDebugf("count: %d rect: %g, %g, %g, %g success: %s\n", count, |
| 881 | rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, success ? "true" : "false"); |
| 882 | } |
| 883 | #StdOut |
| 884 | count: 0 rect: 0, 0, 0, 0 success: true |
| 885 | added: 3, 4 count: 1 rect: 3, 4, 3, 4 success: true |
| 886 | added: 1, 2 count: 2 rect: 1, 2, 3, 4 success: true |
| 887 | added: 5, 6 count: 3 rect: 1, 2, 5, 6 success: true |
| 888 | added: nan, 8 count: 4 rect: 0, 0, 0, 0 success: false |
| 889 | ## |
| 890 | ## |
| 891 | |
| 892 | #SeeAlso set setBounds SkPath::addPoly |
| 893 | |
| 894 | ## |
| 895 | |
| 896 | #Subtopic As_Points ## |
| 897 | |
| 898 | #Subtopic Set |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 899 | #Line # replaces all values ## |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 900 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 901 | |
| 902 | # ------------------------------------------------------------------------------ |
| 903 | |
Cary Clark | c06754b | 2018-05-16 21:28:55 -0400 | [diff] [blame] | 904 | #Method void setBoundsNoCheck(const SkPoint pts[], int count) |
| 905 | #In Set |
| 906 | #Line # sets to upper and lower limits of Point array ## |
Cary Clark | ffb3d68 | 2018-05-17 12:17:28 -0400 | [diff] [blame^] | 907 | Sets to bounds of Point pts array with count entries. If any Point in pts |
| 908 | contains Infinity or NaN, all Rect dimensions are set to NaN. |
Cary Clark | c06754b | 2018-05-16 21:28:55 -0400 | [diff] [blame] | 909 | |
| 910 | #Param pts Point array ## |
| 911 | #Param count entries in array ## |
| 912 | |
| 913 | #Example |
Cary Clark | ffb3d68 | 2018-05-17 12:17:28 -0400 | [diff] [blame^] | 914 | SkPoint points[] = {{3, 4}, {1, 2}, {SkScalar_Inf, 6}, {SK_ScalarNaN, 8}}; |
| 915 | for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) { |
| 916 | SkRect rect; |
| 917 | rect.setBoundsNoCheck(points, count); |
| 918 | if (count > 0) { |
| 919 | SkDebugf("added: %3g, %g ", points[count - 1].fX, points[count - 1].fY); |
| 920 | } else { |
| 921 | SkDebugf("%14s", " "); |
| 922 | } |
| 923 | SkDebugf("count: %d rect: %g, %g, %g, %g\n", count, |
| 924 | rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 925 | } |
Cary Clark | c06754b | 2018-05-16 21:28:55 -0400 | [diff] [blame] | 926 | ## |
| 927 | |
| 928 | #SeeAlso setBoundsCheck |
| 929 | #Method ## |
| 930 | |
| 931 | # ------------------------------------------------------------------------------ |
| 932 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 933 | #Method void setEmpty() |
| 934 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 935 | #In Set |
| 936 | #Line # sets to (0, 0, 0, 0) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 937 | Sets Rect to (0, 0, 0, 0). |
| 938 | |
| 939 | Many other rectangles are empty; if left is equal to or greater than right, |
| 940 | or if top is equal to or greater than bottom. Setting all members to zero |
| 941 | is a convenience, but does not designate a special empty rectangle. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 942 | |
| 943 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 944 | SkRect rect = {3, 4, 1, 2}; |
| 945 | for (int i = 0; i < 2; ++i) { |
| 946 | SkDebugf("rect: {%g, %g, %g, %g} is %s" "empty\n", rect.fLeft, rect.fTop, |
| 947 | rect.fRight, rect.fBottom, rect.isEmpty() ? "" : "not "); |
| 948 | rect.setEmpty(); |
| 949 | } |
| 950 | #StdOut |
| 951 | rect: {3, 4, 1, 2} is empty |
| 952 | rect: {0, 0, 0, 0} is empty |
| 953 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 954 | ## |
| 955 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 956 | #SeeAlso MakeEmpty SkIRect::setEmpty |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 957 | |
| 958 | ## |
| 959 | |
| 960 | # ------------------------------------------------------------------------------ |
| 961 | |
| 962 | #Method void set(const SkIRect& src) |
| 963 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 964 | #In Set |
| 965 | #Line # sets to SkScalar input (left, top, right, bottom) and others ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 966 | Sets Rect to src, promoting src members from integer to Scalar. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 967 | Very large values in src may lose precision. |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 968 | |
| 969 | #Param src integer Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 970 | |
| 971 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 972 | SkIRect i_rect = {3, 4, 1, 2}; |
| 973 | SkDebugf("i_rect: {%d, %d, %d, %d}\n", i_rect.fLeft, i_rect.fTop, i_rect.fRight, i_rect.fBottom); |
| 974 | SkRect f_rect; |
| 975 | f_rect.set(i_rect); |
| 976 | SkDebugf("f_rect: {%g, %g, %g, %g}\n", f_rect.fLeft, f_rect.fTop, f_rect.fRight, f_rect.fBottom); |
| 977 | #StdOut |
| 978 | i_rect: {3, 4, 1, 2} |
| 979 | f_rect: {3, 4, 1, 2} |
| 980 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 981 | ## |
| 982 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 983 | #SeeAlso setLTRB SkIntToScalar |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 984 | |
| 985 | ## |
| 986 | |
| 987 | # ------------------------------------------------------------------------------ |
| 988 | |
| 989 | #Method void set(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
| 990 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 991 | #In Set |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 992 | Sets Rect to (left, top, right, bottom). |
| 993 | left and right are not sorted; left is not necessarily less than right. |
| 994 | top and bottom are not sorted; top is not necessarily less than bottom. |
| 995 | |
| 996 | #Param left stored in fLeft ## |
| 997 | #Param top stored in fTop ## |
| 998 | #Param right stored in fRight ## |
| 999 | #Param bottom stored in fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1000 | |
| 1001 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1002 | SkRect rect1 = {3, 4, 1, 2}; |
| 1003 | SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom); |
| 1004 | SkRect rect2; |
| 1005 | rect2.set(3, 4, 1, 2); |
| 1006 | SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom); |
| 1007 | #StdOut |
| 1008 | rect1: {3, 4, 1, 2} |
| 1009 | rect2: {3, 4, 1, 2} |
| 1010 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1011 | ## |
| 1012 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1013 | #SeeAlso setLTRB setXYWH SkIRect::set |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1014 | |
| 1015 | ## |
| 1016 | |
| 1017 | # ------------------------------------------------------------------------------ |
| 1018 | |
| 1019 | #Method void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
| 1020 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1021 | #In Set |
| 1022 | #Line # sets to SkScalar input (left, top, right, bottom) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1023 | Sets Rect to (left, top, right, bottom). |
| 1024 | left and right are not sorted; left is not necessarily less than right. |
| 1025 | top and bottom are not sorted; top is not necessarily less than bottom. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1026 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1027 | #Param left stored in fLeft ## |
| 1028 | #Param top stored in fTop ## |
| 1029 | #Param right stored in fRight ## |
| 1030 | #Param bottom stored in fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1031 | |
| 1032 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1033 | SkRect rect1 = {3, 4, 1, 2}; |
| 1034 | SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom); |
| 1035 | SkRect rect2; |
| 1036 | rect2.setLTRB(3, 4, 1, 2); |
| 1037 | SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom); |
| 1038 | #StdOut |
| 1039 | rect1: {3, 4, 1, 2} |
| 1040 | rect2: {3, 4, 1, 2} |
| 1041 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1042 | ## |
| 1043 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1044 | #SeeAlso set setXYWH SkIRect::set |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1045 | |
| 1046 | ## |
| 1047 | |
| 1048 | # ------------------------------------------------------------------------------ |
| 1049 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1050 | #Method void set(const SkPoint pts[], int count) |
| 1051 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1052 | #In Set |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1053 | Sets to bounds of Point array with count entries. If count is zero or smaller, |
| 1054 | or if Point array contains an infinity or NaN, sets Rect to (0, 0, 0, 0). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1055 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1056 | Result is either empty or sorted: fLeft is less than or equal to fRight, and |
| 1057 | fTop is less than or equal to fBottom. |
| 1058 | |
| 1059 | #Param pts Point array ## |
| 1060 | #Param count entries in array ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1061 | |
| 1062 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1063 | SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}}; |
| 1064 | for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) { |
| 1065 | SkRect rect; |
| 1066 | rect.set(points, count); |
| 1067 | if (count > 0) { |
| 1068 | SkDebugf("added: %3g, %g ", points[count - 1].fX, points[count - 1].fY); |
| 1069 | } else { |
| 1070 | SkDebugf("%14s", " "); |
| 1071 | } |
| 1072 | SkDebugf("count: %d rect: %g, %g, %g, %g\n", count, |
| 1073 | rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1074 | } |
| 1075 | #StdOut |
| 1076 | count: 0 rect: 0, 0, 0, 0 |
| 1077 | added: 3, 4 count: 1 rect: 3, 4, 3, 4 |
| 1078 | added: 1, 2 count: 2 rect: 1, 2, 3, 4 |
| 1079 | added: 5, 6 count: 3 rect: 1, 2, 5, 6 |
| 1080 | added: nan, 8 count: 4 rect: 0, 0, 0, 0 |
| 1081 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1082 | ## |
| 1083 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1084 | #SeeAlso setBounds setBoundsCheck SkPath::addPoly |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1085 | |
| 1086 | ## |
| 1087 | |
| 1088 | # ------------------------------------------------------------------------------ |
| 1089 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1090 | #Method void set(const SkPoint& p0, const SkPoint& p1) |
| 1091 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1092 | #In Set |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1093 | Sets bounds to the smallest Rect enclosing Points p0 and p1. The result is |
| 1094 | sorted and may be empty. Does not check to see if values are finite. |
| 1095 | |
| 1096 | #Param p0 corner to include ## |
| 1097 | #Param p1 corner to include ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1098 | |
| 1099 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1100 | #Description |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1101 | p0 and p1 may be swapped and have the same effect unless one contains NaN. |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1102 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1103 | SkPoint point1 = {SK_ScalarNaN, 8}; |
| 1104 | SkPoint point2 = {3, 4}; |
| 1105 | SkRect rect; |
| 1106 | rect.set(point1, point2); |
| 1107 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1108 | rect.set(point2, point1); |
| 1109 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1110 | ## |
| 1111 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1112 | #SeeAlso setBounds setBoundsCheck |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1113 | |
| 1114 | ## |
| 1115 | |
| 1116 | # ------------------------------------------------------------------------------ |
| 1117 | |
| 1118 | #Method void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height) |
| 1119 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1120 | #In Set |
| 1121 | #Line # sets to SkScalar input (x, y, width, height) ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1122 | Sets Rect to |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1123 | #Formula |
| 1124 | (x, y, x + width, y + height) |
| 1125 | ## |
| 1126 | . Does not validate input; |
| 1127 | width or height may be negative. |
| 1128 | |
| 1129 | #Param x stored in fLeft ## |
| 1130 | #Param y stored in fTop ## |
| 1131 | #Param width added to x and stored in fRight ## |
| 1132 | #Param height added to y and stored in fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1133 | |
| 1134 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1135 | SkRect rect; |
| 1136 | rect.setXYWH(5, 35, -15, 25); |
| 1137 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1138 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1139 | rect.sort(); |
| 1140 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1141 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1142 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1143 | rect: 5, 35, -10, 60 isEmpty: true |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1144 | rect: -10, 35, 5, 60 isEmpty: false |
| 1145 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1146 | ## |
| 1147 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1148 | #SeeAlso MakeXYWH setLTRB set SkIRect::setXYWH |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1149 | |
| 1150 | ## |
| 1151 | |
| 1152 | # ------------------------------------------------------------------------------ |
| 1153 | |
| 1154 | #Method void setWH(SkScalar width, SkScalar height) |
| 1155 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1156 | #In Set |
| 1157 | #Line # sets to SkScalar input (0, 0, width, height) ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1158 | Sets Rect to (0, 0, width, height). Does not validate input; |
| 1159 | width or height may be negative. |
| 1160 | |
| 1161 | #Param width stored in fRight ## |
| 1162 | #Param height stored in fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1163 | |
| 1164 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1165 | SkRect rect; |
| 1166 | rect.setWH(-15, 25); |
| 1167 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1168 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1169 | rect.sort(); |
| 1170 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1171 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1172 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1173 | rect: 0, 0, -15, 25 isEmpty: true |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1174 | rect: -15, 0, 0, 25 isEmpty: false |
| 1175 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1176 | ## |
| 1177 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1178 | #SeeAlso MakeWH setXYWH isetWH |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1179 | |
| 1180 | ## |
| 1181 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1182 | #Subtopic Set ## |
| 1183 | |
| 1184 | #Subtopic From_Integers |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1185 | #Line # sets Scalar values from integer input ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1186 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 1187 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1188 | |
| 1189 | # ------------------------------------------------------------------------------ |
| 1190 | |
| 1191 | #Method void iset(int left, int top, int right, int bottom) |
| 1192 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1193 | #In From_Integers |
| 1194 | #Line # sets to int input (left, top, right, bottom) ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1195 | Sets Rect to (left, top, right, bottom). |
| 1196 | All parameters are promoted from integer to Scalar. |
| 1197 | left and right are not sorted; left is not necessarily less than right. |
| 1198 | top and bottom are not sorted; top is not necessarily less than bottom. |
| 1199 | |
| 1200 | #Param left promoted to SkScalar and stored in fLeft ## |
| 1201 | #Param top promoted to SkScalar and stored in fTop ## |
| 1202 | #Param right promoted to SkScalar and stored in fRight ## |
| 1203 | #Param bottom promoted to SkScalar and stored in fBottom ## |
| 1204 | |
| 1205 | #Example |
| 1206 | SkRect rect1 = {3, 4, 1, 2}; |
| 1207 | SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom); |
| 1208 | SkRect rect2; |
| 1209 | rect2.iset(3, 4, 1, 2); |
| 1210 | SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom); |
| 1211 | #StdOut |
| 1212 | rect1: {3, 4, 1, 2} |
| 1213 | rect2: {3, 4, 1, 2} |
| 1214 | ## |
| 1215 | ## |
| 1216 | |
| 1217 | #SeeAlso set setLTRB SkIRect::set SkIntToScalar |
| 1218 | |
| 1219 | ## |
| 1220 | |
| 1221 | # ------------------------------------------------------------------------------ |
| 1222 | |
| 1223 | #Method void isetWH(int width, int height) |
| 1224 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1225 | #In From_Integers |
| 1226 | #Line # sets to int input (0, 0, width, height) ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1227 | Sets Rect to (0, 0, width, height). |
| 1228 | width and height may be zero or negative. width and height are promoted from |
| 1229 | integer to SkScalar, large values may lose precision. |
| 1230 | |
| 1231 | #Param width promoted to SkScalar and stored in fRight ## |
| 1232 | #Param height promoted to SkScalar and stored in fBottom ## |
| 1233 | |
| 1234 | #Example |
| 1235 | SkRect rect1 = {0, 0, 1, 2}; |
| 1236 | SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom); |
| 1237 | SkRect rect2; |
| 1238 | rect2.isetWH(1, 2); |
| 1239 | SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom); |
| 1240 | #StdOut |
| 1241 | rect1: {0, 0, 1, 2} |
| 1242 | rect2: {0, 0, 1, 2} |
| 1243 | ## |
| 1244 | ## |
| 1245 | |
| 1246 | #SeeAlso MakeWH MakeXYWH iset() SkIRect:MakeWH |
| 1247 | |
| 1248 | ## |
| 1249 | |
| 1250 | #Subtopic From_Integers ## |
| 1251 | |
| 1252 | #Subtopic Inset_Outset_Offset |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 1253 | #Line # moves sides ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1254 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 1255 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1256 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1257 | # ------------------------------------------------------------------------------ |
| 1258 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1259 | #Method SkRect makeOffset(SkScalar dx, SkScalar dy) const |
| 1260 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1261 | #In Inset_Outset_Offset |
| 1262 | #Line # constructs from translated sides ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1263 | Returns Rect offset by (dx, dy). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1264 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1265 | If dx is negative, Rect returned is moved to the left. |
| 1266 | If dx is positive, Rect returned is moved to the right. |
| 1267 | If dy is negative, Rect returned is moved upward. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1268 | If dy is positive, Rect returned is moved downward. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1269 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1270 | #Param dx added to fLeft and fRight ## |
| 1271 | #Param dy added to fTop and fBottom ## |
| 1272 | |
| 1273 | #Return Rect offset in x or y, with original width and height ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1274 | |
| 1275 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1276 | SkRect rect = { 10, 50, 20, 60 }; |
| 1277 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1278 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1279 | rect = rect.makeOffset(15, 32); |
| 1280 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1281 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1282 | #StdOut |
| 1283 | rect: 10, 50, 20, 60 isEmpty: false |
| 1284 | rect: 25, 82, 35, 92 isEmpty: false |
| 1285 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1286 | ## |
| 1287 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1288 | #SeeAlso offset() makeInset makeOutset SkIRect::makeOffset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1289 | |
| 1290 | ## |
| 1291 | |
| 1292 | # ------------------------------------------------------------------------------ |
| 1293 | |
| 1294 | #Method SkRect makeInset(SkScalar dx, SkScalar dy) const |
| 1295 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1296 | #In Inset_Outset_Offset |
| 1297 | #Line # constructs from sides moved symmetrically about the center ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1298 | Returns Rect, inset by (dx, dy). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1299 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1300 | If dx is negative, Rect returned is wider. |
| 1301 | If dx is positive, Rect returned is narrower. |
| 1302 | If dy is negative, Rect returned is taller. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1303 | If dy is positive, Rect returned is shorter. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1304 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1305 | #Param dx added to fLeft and subtracted from fRight ## |
| 1306 | #Param dy added to fTop and subtracted from fBottom ## |
| 1307 | |
| 1308 | #Return Rect inset symmetrically left and right, top and bottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1309 | |
| 1310 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1311 | SkRect rect = { 10, 50, 20, 60 }; |
| 1312 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1313 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1314 | rect = rect.makeInset(15, 32); |
| 1315 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1316 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1317 | #StdOut |
| 1318 | rect: 10, 50, 20, 60 isEmpty: false |
| 1319 | rect: 25, 82, 5, 28 isEmpty: true |
| 1320 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1321 | ## |
| 1322 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1323 | #SeeAlso inset() makeOffset makeOutset SkIRect::makeInset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1324 | |
| 1325 | ## |
| 1326 | |
| 1327 | # ------------------------------------------------------------------------------ |
| 1328 | |
| 1329 | #Method SkRect makeOutset(SkScalar dx, SkScalar dy) const |
| 1330 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1331 | #In Inset_Outset_Offset |
| 1332 | #Line # constructs from sides moved symmetrically about the center ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1333 | Returns Rect, outset by (dx, dy). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1334 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1335 | If dx is negative, Rect returned is narrower. |
| 1336 | If dx is positive, Rect returned is wider. |
| 1337 | If dy is negative, Rect returned is shorter. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1338 | If dy is positive, Rect returned is taller. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1339 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1340 | #Param dx subtracted to fLeft and added from fRight ## |
| 1341 | #Param dy subtracted to fTop and added from fBottom ## |
| 1342 | |
| 1343 | #Return Rect outset symmetrically left and right, top and bottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1344 | |
| 1345 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1346 | SkRect rect = { 10, 50, 20, 60 }; |
| 1347 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1348 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1349 | rect = rect.makeOutset(15, 32); |
| 1350 | SkDebugf("rect: %g, %g, %g, %g isEmpty: %s\n", rect.left(), rect.top(), rect.right(), |
| 1351 | rect.bottom(), rect.isEmpty() ? "true" : "false"); |
| 1352 | #StdOut |
| 1353 | rect: 10, 50, 20, 60 isEmpty: false |
| 1354 | rect: -5, 18, 35, 92 isEmpty: false |
| 1355 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1356 | ## |
| 1357 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1358 | #SeeAlso outset() makeOffset makeInset SkIRect::makeOutset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1359 | |
| 1360 | ## |
| 1361 | |
| 1362 | # ------------------------------------------------------------------------------ |
| 1363 | |
| 1364 | #Method void offset(SkScalar dx, SkScalar dy) |
| 1365 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1366 | #In Inset_Outset_Offset |
| 1367 | #Line # translates sides without changing width and height ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1368 | Offsets Rect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1369 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1370 | If dx is negative, moves Rect to the left. |
| 1371 | If dx is positive, moves Rect to the right. |
| 1372 | If dy is negative, moves Rect upward. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1373 | If dy is positive, moves Rect downward. |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1374 | |
| 1375 | #Param dx offset added to fLeft and fRight ## |
| 1376 | #Param dy offset added to fTop and fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1377 | |
| 1378 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1379 | SkRect rect = { 10, 14, 50, 73 }; |
| 1380 | rect.offset(5, 13); |
| 1381 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1382 | #StdOut |
| 1383 | rect: 15, 27, 55, 86 |
| 1384 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1385 | ## |
| 1386 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1387 | #SeeAlso offsetTo makeOffset SkIRect::offset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1388 | |
| 1389 | ## |
| 1390 | |
| 1391 | # ------------------------------------------------------------------------------ |
| 1392 | |
| 1393 | #Method void offset(const SkPoint& delta) |
| 1394 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1395 | #In Inset_Outset_Offset |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1396 | Offsets Rect by adding delta.fX to fLeft, fRight; and by adding delta.fY to |
| 1397 | fTop, fBottom. |
| 1398 | |
| 1399 | If delta.fX is negative, moves Rect to the left. |
| 1400 | If delta.fX is positive, moves Rect to the right. |
| 1401 | If delta.fY is negative, moves Rect upward. |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1402 | If delta.fY is positive, moves Rect downward. |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1403 | |
| 1404 | #Param delta added to Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1405 | |
| 1406 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1407 | SkRect rect = { 10, 14, 50, 73 }; |
| 1408 | rect.offset({5, 13}); |
| 1409 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1410 | #StdOut |
| 1411 | rect: 15, 27, 55, 86 |
| 1412 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1413 | ## |
| 1414 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1415 | #SeeAlso offsetTo makeOffset SkIRect::offset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1416 | |
| 1417 | ## |
| 1418 | |
| 1419 | # ------------------------------------------------------------------------------ |
| 1420 | |
| 1421 | #Method void offsetTo(SkScalar newX, SkScalar newY) |
| 1422 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1423 | #In Inset_Outset_Offset |
| 1424 | #Line # translates to (x, y) without changing width and height ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1425 | Offsets Rect so that fLeft equals newX, and fTop equals newY. width and height |
| 1426 | are unchanged. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1427 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1428 | #Param newX stored in fLeft, preserving width() ## |
| 1429 | #Param newY stored in fTop, preserving height() ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1430 | |
| 1431 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1432 | SkRect rect = { 10, 14, 50, 73 }; |
| 1433 | rect.offsetTo(15, 27); |
| 1434 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1435 | #StdOut |
| 1436 | rect: 15, 27, 55, 86 |
| 1437 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1438 | ## |
| 1439 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1440 | #SeeAlso offset makeOffset setXYWH SkIRect::offsetTo |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1441 | |
| 1442 | ## |
| 1443 | |
| 1444 | # ------------------------------------------------------------------------------ |
| 1445 | |
| 1446 | #Method void inset(SkScalar dx, SkScalar dy) |
| 1447 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1448 | #In Inset_Outset_Offset |
| 1449 | #Line # moves the sides symmetrically about the center ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1450 | Insets Rect by (dx, dy). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1451 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1452 | If dx is positive, makes Rect narrower. |
| 1453 | If dx is negative, makes Rect wider. |
| 1454 | If dy is positive, makes Rect shorter. |
| 1455 | If dy is negative, makes Rect taller. |
| 1456 | |
| 1457 | #Param dx added to fLeft and subtracted from fRight ## |
| 1458 | #Param dy added to fTop and subtracted from fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1459 | |
| 1460 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1461 | SkRect rect = { 10, 14, 50, 73 }; |
| 1462 | rect.inset(5, 13); |
| 1463 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1464 | #StdOut |
| 1465 | rect: 15, 27, 45, 60 |
| 1466 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1467 | ## |
| 1468 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1469 | #SeeAlso outset makeInset SkIRect::inset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1470 | |
| 1471 | ## |
| 1472 | |
| 1473 | # ------------------------------------------------------------------------------ |
| 1474 | |
| 1475 | #Method void outset(SkScalar dx, SkScalar dy) |
| 1476 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1477 | #In Inset_Outset_Offset |
| 1478 | #Line # moves the sides symmetrically about the center ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1479 | Outsets Rect by (dx, dy). |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1480 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1481 | If dx is positive, makes Rect wider. |
| 1482 | If dx is negative, makes Rect narrower. |
| 1483 | If dy is positive, makes Rect taller. |
| 1484 | If dy is negative, makes Rect shorter. |
| 1485 | |
| 1486 | #Param dx subtracted to fLeft and added from fRight ## |
| 1487 | #Param dy subtracted to fTop and added from fBottom ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1488 | |
| 1489 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1490 | SkRect rect = { 10, 14, 50, 73 }; |
| 1491 | rect.outset(5, 13); |
| 1492 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1493 | #StdOut |
| 1494 | rect: 5, 1, 55, 86 |
| 1495 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1496 | ## |
| 1497 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1498 | #SeeAlso inset makeOutset SkIRect::outset |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1499 | |
| 1500 | ## |
| 1501 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1502 | #Subtopic Inset_Outset_Offset ## |
| 1503 | |
| 1504 | #Subtopic Intersection |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1505 | #Line # sets to shared bounds ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1506 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1507 | Rects intersect when they enclose a common area. To intersect, each of the pair |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1508 | must describe area; fLeft is less than fRight, and fTop is less than fBottom; |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1509 | empty() returns false. The intersection of Rect pair can be described by: |
| 1510 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1511 | #Formula |
| 1512 | (max(a.fLeft, b.fLeft), max(a.fTop, b.fTop), |
| 1513 | min(a.fRight, b.fRight), min(a.fBottom, b.fBottom)) |
| 1514 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1515 | . |
| 1516 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1517 | The intersection is only meaningful if the resulting Rect is not empty and |
| 1518 | describes an area: fLeft is less than fRight, and fTop is less than fBottom. |
| 1519 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 1520 | #Populate |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1521 | |
| 1522 | # ------------------------------------------------------------------------------ |
| 1523 | |
Florin Malita | eb42045 | 2018-02-20 11:44:43 -0500 | [diff] [blame] | 1524 | #Method bool contains(SkScalar x, SkScalar y) const |
| 1525 | |
| 1526 | #In Intersection |
Cary Clark | edfe670 | 2018-02-20 14:33:13 -0500 | [diff] [blame] | 1527 | #Line # returns true if points are equal or inside ## |
Florin Malita | eb42045 | 2018-02-20 11:44:43 -0500 | [diff] [blame] | 1528 | Returns true if: fLeft <= x < fRight && fTop <= y < fBottom. |
| 1529 | Returns false if SkRect is empty. |
| 1530 | |
| 1531 | #Param x test SkPoint x-coordinate ## |
| 1532 | #Param y test SkPoint y-coordinate ## |
| 1533 | |
| 1534 | #Return true if (x, y) is inside SkRect ## |
| 1535 | |
| 1536 | #Example |
| 1537 | SkRect rect = { 30, 50, 40, 60 }; |
| 1538 | SkPoint tests[] = { { 30, 50 }, { 39, 49 }, { 29, 59 } }; |
| 1539 | for (auto contained : tests) { |
| 1540 | SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g)\n", |
| 1541 | rect.left(), rect.top(), rect.right(), rect.bottom(), |
| 1542 | rect.contains(contained.x(), contained.y()) ? "contains" : "does not contain", |
| 1543 | contained.x(), contained.y()); |
| 1544 | } |
| 1545 | #StdOut |
| 1546 | rect: (30, 50, 40, 60) contains (30, 50) |
| 1547 | rect: (30, 50, 40, 60) does not contain (39, 49) |
| 1548 | rect: (30, 50, 40, 60) does not contain (29, 59) |
| 1549 | ## |
| 1550 | ## |
| 1551 | |
| 1552 | #SeeAlso SkIRect::contains |
| 1553 | |
| 1554 | ## |
| 1555 | |
| 1556 | # ------------------------------------------------------------------------------ |
| 1557 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1558 | #Method bool contains(const SkRect& r) const |
| 1559 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1560 | #In Intersection |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1561 | Returns true if Rect contains r. |
| 1562 | Returns false if Rect is empty or r is empty. |
| 1563 | |
| 1564 | Rect contains r when Rect area completely includes r area. |
| 1565 | |
| 1566 | #Param r Rect contained ## |
| 1567 | |
| 1568 | #Return true if all sides of Rect are outside r ## |
| 1569 | |
| 1570 | #Example |
| 1571 | SkRect rect = { 30, 50, 40, 60 }; |
| 1572 | SkRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} }; |
| 1573 | for (auto contained : tests) { |
| 1574 | SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g, %g, %g)\n", |
| 1575 | rect.left(), rect.top(), rect.right(), rect.bottom(), |
| 1576 | rect.contains(contained) ? "contains" : "does not contain", |
| 1577 | contained.left(), contained.top(), contained.right(), contained.bottom()); |
| 1578 | } |
| 1579 | #StdOut |
| 1580 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51) |
| 1581 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50) |
| 1582 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60) |
| 1583 | ## |
| 1584 | ## |
| 1585 | |
| 1586 | #SeeAlso SkIRect::contains |
| 1587 | |
| 1588 | ## |
| 1589 | |
| 1590 | # ------------------------------------------------------------------------------ |
| 1591 | |
| 1592 | #Method bool contains(const SkIRect& r) const |
| 1593 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1594 | #In Intersection |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1595 | Returns true if Rect contains r. |
| 1596 | Returns false if Rect is empty or r is empty. |
| 1597 | |
| 1598 | Rect contains r when Rect area completely includes r area. |
| 1599 | |
| 1600 | #Param r IRect contained ## |
| 1601 | |
| 1602 | #Return true if all sides of Rect are outside r ## |
| 1603 | |
| 1604 | #Example |
| 1605 | SkRect rect = { 30, 50, 40, 60 }; |
| 1606 | SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} }; |
| 1607 | for (auto contained : tests) { |
| 1608 | SkDebugf("rect: (%g, %g, %g, %g) %s (%d, %d, %d, %d)\n", |
| 1609 | rect.left(), rect.top(), rect.right(), rect.bottom(), |
| 1610 | rect.contains(contained) ? "contains" : "does not contain", |
| 1611 | contained.left(), contained.top(), contained.right(), contained.bottom()); |
| 1612 | } |
| 1613 | #StdOut |
| 1614 | rect: (30, 50, 40, 60) contains (30, 50, 31, 51) |
| 1615 | rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50) |
| 1616 | rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60) |
| 1617 | ## |
| 1618 | ## |
| 1619 | |
| 1620 | #SeeAlso SkIRect::contains |
| 1621 | |
| 1622 | ## |
| 1623 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1624 | # ------------------------------------------------------------------------------ |
| 1625 | |
| 1626 | #Method bool intersect(const SkRect& r) |
| 1627 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1628 | #In Intersection |
| 1629 | #Line # sets to shared area; returns true if not empty ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1630 | Returns true if Rect intersects r, and sets Rect to intersection. |
| 1631 | Returns false if Rect does not intersect r, and leaves Rect unchanged. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1632 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1633 | Returns false if either r or Rect is empty, leaving Rect unchanged. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1634 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1635 | #Param r limit of result ## |
| 1636 | |
| 1637 | #Return true if r and Rect have area in common ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1638 | |
| 1639 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1640 | #Description |
| 1641 | Two SkDebugf calls are required. If the calls are combined, their arguments |
| 1642 | may not be evaluated in left to right order: the printed intersection may |
| 1643 | be before or after the call to intersect. |
| 1644 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1645 | SkRect leftRect = { 10, 40, 50, 80 }; |
| 1646 | SkRect rightRect = { 30, 60, 70, 90 }; |
| 1647 | SkDebugf("%s intersection: ", leftRect.intersect(rightRect) ? "" : "no "); |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1648 | SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(), |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1649 | leftRect.right(), leftRect.bottom()); |
| 1650 | #StdOut |
| 1651 | intersection: 30, 60, 50, 80 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1652 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1653 | ## |
| 1654 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1655 | #SeeAlso intersects Intersects join SkIRect::intersect |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1656 | |
| 1657 | ## |
| 1658 | |
| 1659 | # ------------------------------------------------------------------------------ |
| 1660 | |
| 1661 | #Method bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
| 1662 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1663 | #In Intersection |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1664 | Constructs Rect to intersect from (left, top, right, bottom). Does not sort |
| 1665 | construction. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1666 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1667 | Returns true if Rect intersects construction, and sets Rect to intersection. |
| 1668 | Returns false if Rect does not intersect construction, and leaves Rect unchanged. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1669 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1670 | Returns false if either construction or Rect is empty, leaving Rect unchanged. |
| 1671 | |
| 1672 | #Param left x minimum of constructed Rect ## |
| 1673 | #Param top y minimum of constructed Rect ## |
| 1674 | #Param right x maximum of constructed Rect ## |
| 1675 | #Param bottom y maximum of constructed Rect ## |
| 1676 | |
| 1677 | #Return true if construction and Rect have area in common ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1678 | |
| 1679 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1680 | #Description |
| 1681 | Two SkDebugf calls are required. If the calls are combined, their arguments |
| 1682 | may not be evaluated in left to right order: the printed intersection may |
| 1683 | be before or after the call to intersect. |
| 1684 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1685 | SkRect leftRect = { 10, 40, 50, 80 }; |
| 1686 | SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no "); |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1687 | SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(), |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1688 | leftRect.right(), leftRect.bottom()); |
| 1689 | #StdOut |
| 1690 | intersection: 30, 60, 50, 80 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1691 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1692 | ## |
| 1693 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1694 | #SeeAlso intersects Intersects join SkIRect::intersect |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1695 | |
| 1696 | ## |
| 1697 | |
| 1698 | # ------------------------------------------------------------------------------ |
| 1699 | |
| 1700 | #Method bool SK_WARN_UNUSED_RESULT intersect(const SkRect& a, const SkRect& b) |
| 1701 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1702 | #In Intersection |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1703 | Returns true if a intersects b, and sets Rect to intersection. |
| 1704 | Returns false if a does not intersect b, and leaves Rect unchanged. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1705 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1706 | Returns false if either a or b is empty, leaving Rect unchanged. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1707 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1708 | #Param a Rect to intersect ## |
| 1709 | #Param b Rect to intersect ## |
| 1710 | |
| 1711 | #Return true if a and b have area in common ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1712 | |
| 1713 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1714 | SkRect result; |
| 1715 | bool intersected = result.intersect({ 10, 40, 50, 80 }, { 30, 60, 70, 90 }); |
| 1716 | SkDebugf("%s intersection: %g, %g, %g, %g\n", intersected ? "" : "no ", |
| 1717 | result.left(), result.top(), result.right(), result.bottom()); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1718 | #StdOut |
| 1719 | intersection: 30, 60, 50, 80 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1720 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1721 | ## |
| 1722 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1723 | #SeeAlso intersects Intersects join SkIRect::intersect |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1724 | |
| 1725 | ## |
| 1726 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1727 | # ------------------------------------------------------------------------------ |
| 1728 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1729 | #Method bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const |
| 1730 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1731 | #In Intersection |
| 1732 | #Line # returns true if areas overlap ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1733 | Constructs Rect to intersect from (left, top, right, bottom). Does not sort |
| 1734 | construction. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1735 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1736 | Returns true if Rect intersects construction. |
| 1737 | Returns false if either construction or Rect is empty, or do not intersect. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1738 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1739 | #Param left x minimum of constructed Rect ## |
| 1740 | #Param top y minimum of constructed Rect ## |
| 1741 | #Param right x maximum of constructed Rect ## |
| 1742 | #Param bottom y maximum of constructed Rect ## |
| 1743 | |
| 1744 | #Return true if construction and Rect have area in common ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1745 | |
| 1746 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1747 | SkRect rect = { 10, 40, 50, 80 }; |
| 1748 | SkDebugf("%s intersection", rect.intersects(30, 60, 70, 90) ? "" : "no "); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1749 | #StdOut |
| 1750 | intersection |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1751 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1752 | ## |
| 1753 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1754 | #SeeAlso intersect Intersects SkIRect::Intersects |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1755 | |
| 1756 | ## |
| 1757 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1758 | # ------------------------------------------------------------------------------ |
| 1759 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1760 | #Method bool intersects(const SkRect& r) const |
| 1761 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1762 | #In Intersection |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1763 | Returns true if Rect intersects r. |
| 1764 | Returns false if either r or Rect is empty, or do not intersect. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1765 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1766 | #Param r Rect to intersect ## |
| 1767 | |
| 1768 | #Return true if r and Rect have area in common ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1769 | |
| 1770 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1771 | SkRect rect = { 10, 40, 50, 80 }; |
| 1772 | SkDebugf("%s intersection", rect.intersects({30, 60, 70, 90}) ? "" : "no "); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1773 | #StdOut |
| 1774 | intersection |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1775 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1776 | ## |
| 1777 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1778 | #SeeAlso intersect Intersects SkIRect::Intersects |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1779 | |
| 1780 | ## |
| 1781 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1782 | # ------------------------------------------------------------------------------ |
| 1783 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1784 | #Method static bool Intersects(const SkRect& a, const SkRect& b) |
| 1785 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1786 | #In Intersection |
| 1787 | #Line # returns true if areas overlap ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1788 | Returns true if a intersects b. |
| 1789 | Returns false if either a or b is empty, or do not intersect. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1790 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1791 | #Param a Rect to intersect ## |
| 1792 | #Param b Rect to intersect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1793 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1794 | #Return true if a and b have area in common ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1795 | |
| 1796 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1797 | SkDebugf("%s intersection", SkRect::Intersects({10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no "); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1798 | #StdOut |
| 1799 | intersection |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1800 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1801 | ## |
| 1802 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1803 | #SeeAlso intersect intersects SkIRect::Intersects |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1804 | |
| 1805 | ## |
| 1806 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1807 | #Subtopic Intersection ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1808 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1809 | #Subtopic Join |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1810 | #Line # sets to union of bounds ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1811 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 1812 | #Populate |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1813 | |
| 1814 | # ------------------------------------------------------------------------------ |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1815 | |
| 1816 | #Method void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
| 1817 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1818 | #In Join |
| 1819 | #Line # sets to union of bounds ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1820 | Constructs Rect to intersect from (left, top, right, bottom). Does not sort |
| 1821 | construction. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1822 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1823 | Sets Rect to the union of itself and the construction. |
| 1824 | |
| 1825 | Has no effect if construction is empty. Otherwise, if Rect is empty, sets |
| 1826 | Rect to construction. |
| 1827 | |
| 1828 | #Param left x minimum of constructed Rect ## |
| 1829 | #Param top y minimum of constructed Rect ## |
| 1830 | #Param right x maximum of constructed Rect ## |
| 1831 | #Param bottom y maximum of constructed Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1832 | |
| 1833 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1834 | SkRect rect = { 10, 20, 15, 25}; |
| 1835 | rect.join(50, 60, 55, 65); |
| 1836 | SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1837 | #StdOut |
| 1838 | join: 10, 20, 55, 65 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1839 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1840 | ## |
| 1841 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1842 | #SeeAlso joinNonEmptyArg joinPossiblyEmptyRect SkIRect::join |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1843 | |
| 1844 | ## |
| 1845 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1846 | # ------------------------------------------------------------------------------ |
| 1847 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1848 | #Method void join(const SkRect& r) |
| 1849 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1850 | #In Join |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1851 | Sets Rect to the union of itself and r. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1852 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1853 | Has no effect if r is empty. Otherwise, if Rect is empty, sets |
| 1854 | Rect to r. |
| 1855 | |
| 1856 | #Param r expansion Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1857 | |
| 1858 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1859 | SkRect rect = { 10, 20, 15, 25}; |
| 1860 | rect.join({50, 60, 55, 65}); |
| 1861 | SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1862 | #StdOut |
| 1863 | join: 10, 20, 55, 65 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1864 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1865 | ## |
| 1866 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1867 | #SeeAlso joinNonEmptyArg joinPossiblyEmptyRect SkIRect::join |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1868 | |
| 1869 | ## |
| 1870 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1871 | # ------------------------------------------------------------------------------ |
| 1872 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1873 | #Method void joinNonEmptyArg(const SkRect& r) |
| 1874 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1875 | #In Join |
| 1876 | #Line # sets to union of bounds, asserting that argument is not empty ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1877 | Sets Rect to the union of itself and r. |
| 1878 | |
| 1879 | Asserts if r is empty and SK_DEBUG is defined. |
| 1880 | If Rect is empty, sets Rect to r. |
| 1881 | |
| 1882 | May produce incorrect results if r is empty. |
| 1883 | |
| 1884 | #Param r expansion Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1885 | |
| 1886 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1887 | #Description |
| 1888 | Since Rect is not sorted, first result is copy of toJoin. |
| 1889 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1890 | SkRect rect = { 10, 100, 15, 0}; |
| 1891 | SkRect sorted = rect.makeSorted(); |
| 1892 | SkRect toJoin = { 50, 60, 55, 65 }; |
| 1893 | rect.joinNonEmptyArg(toJoin); |
| 1894 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1895 | sorted.joinNonEmptyArg(toJoin); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1896 | SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom); |
| 1897 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1898 | rect: 50, 60, 55, 65 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1899 | sorted: 10, 0, 55, 100 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1900 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1901 | ## |
| 1902 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1903 | #SeeAlso join joinPossiblyEmptyRect SkIRect::join |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1904 | |
| 1905 | ## |
| 1906 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1907 | # ------------------------------------------------------------------------------ |
| 1908 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1909 | #Method void joinPossiblyEmptyRect(const SkRect& r) |
| 1910 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1911 | #In Join |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1912 | #Line # sets to union of bounds; skips empty check for both ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1913 | Sets Rect to the union of itself and the construction. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1914 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1915 | May produce incorrect results if Rect or r is empty. |
| 1916 | |
| 1917 | #Param r expansion Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1918 | |
| 1919 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1920 | #Description |
| 1921 | Since Rect is not sorted, first result is not useful. |
| 1922 | ## |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1923 | SkRect rect = { 10, 100, 15, 0}; |
| 1924 | SkRect sorted = rect.makeSorted(); |
| 1925 | SkRect toJoin = { 50, 60, 55, 65 }; |
| 1926 | rect.joinPossiblyEmptyRect(toJoin); |
| 1927 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 1928 | sorted.joinPossiblyEmptyRect(toJoin); |
| 1929 | SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1930 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1931 | rect: 10, 60, 55, 65 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1932 | sorted: 10, 0, 55, 100 |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 1933 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1934 | ## |
| 1935 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1936 | #SeeAlso joinNonEmptyArg join SkIRect::join |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1937 | |
| 1938 | ## |
| 1939 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1940 | #Subtopic Join ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1941 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 1942 | #Subtopic Rounding |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 1943 | #Line # adjust to integer bounds ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1944 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 1945 | #Populate |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1946 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1947 | #Method void round(SkIRect* dst) const |
| 1948 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1949 | #In Rounding |
| 1950 | #Line # sets members to nearest integer value ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1951 | Sets IRect by adding 0.5 and discarding the fractional portion of Rect |
| 1952 | members, using |
| 1953 | #Formula |
| 1954 | (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), |
| 1955 | SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)) |
| 1956 | ## |
| 1957 | . |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1958 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1959 | #Param dst storage for IRect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1960 | |
| 1961 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1962 | SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f }; |
| 1963 | SkIRect round; |
| 1964 | rect.round(&round); |
| 1965 | SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1966 | #StdOut |
| 1967 | round: 31, 51, 41, 61 |
| 1968 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1969 | ## |
| 1970 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1971 | #SeeAlso roundIn roundOut SkScalarRoundToInt |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1972 | |
| 1973 | ## |
| 1974 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1975 | # ------------------------------------------------------------------------------ |
| 1976 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1977 | #Method void roundOut(SkIRect* dst) const |
| 1978 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 1979 | #In Rounding |
| 1980 | #Line # sets members to nearest integer value away from opposite ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1981 | Sets IRect by discarding the fractional portion of fLeft and fTop; and |
Cary Clark | 78c110e | 2018-02-09 16:49:09 -0500 | [diff] [blame] | 1982 | rounding up fRight and fBottom, using |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1983 | #Formula |
| 1984 | (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), |
| 1985 | SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)) |
| 1986 | ## |
| 1987 | . |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1988 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1989 | #Param dst storage for IRect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1990 | |
| 1991 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 1992 | SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f }; |
| 1993 | SkIRect round; |
| 1994 | rect.roundOut(&round); |
| 1995 | SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 1996 | #StdOut |
| 1997 | round: 30, 50, 41, 61 |
| 1998 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 1999 | ## |
| 2000 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2001 | #SeeAlso roundIn round SkScalarRoundToInt |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2002 | |
| 2003 | ## |
| 2004 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2005 | # ------------------------------------------------------------------------------ |
| 2006 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 2007 | #Method void roundOut(SkRect* dst) const |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2008 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2009 | #In Rounding |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2010 | Sets Rect by discarding the fractional portion of fLeft and fTop; and |
Cary Clark | 78c110e | 2018-02-09 16:49:09 -0500 | [diff] [blame] | 2011 | rounding up fRight and fBottom, using |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2012 | #Formula |
| 2013 | (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), |
| 2014 | SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)) |
| 2015 | ## |
| 2016 | . |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2017 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2018 | #Param dst storage for Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2019 | |
| 2020 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2021 | SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f }; |
| 2022 | SkRect round; |
| 2023 | rect.roundOut(&round); |
| 2024 | SkDebugf("round: %g, %g, %g, %g\n", round.fLeft, round.fTop, round.fRight, round.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2025 | #StdOut |
| 2026 | round: 30, 50, 41, 61 |
| 2027 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2028 | ## |
| 2029 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2030 | #SeeAlso roundIn round SkScalarRoundToInt |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2031 | |
| 2032 | ## |
| 2033 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2034 | # ------------------------------------------------------------------------------ |
| 2035 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2036 | #Method void roundIn(SkIRect* dst) const |
| 2037 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2038 | #In Rounding |
| 2039 | #Line # sets members to nearest integer value towards opposite ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2040 | Sets Rect by rounding up fLeft and fTop; and |
Cary Clark | 78c110e | 2018-02-09 16:49:09 -0500 | [diff] [blame] | 2041 | discarding the fractional portion of fRight and fBottom, using |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2042 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2043 | #Formula |
| 2044 | (SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop), |
| 2045 | SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom)) |
| 2046 | ## |
| 2047 | . |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2048 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2049 | #Param dst storage for IRect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2050 | |
| 2051 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2052 | SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f }; |
| 2053 | SkIRect round; |
| 2054 | rect.roundIn(&round); |
| 2055 | SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2056 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2057 | round: 31, 51, 40, 60 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2058 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2059 | ## |
| 2060 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2061 | #SeeAlso roundOut round SkScalarRoundToInt |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2062 | |
| 2063 | ## |
| 2064 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2065 | # ------------------------------------------------------------------------------ |
| 2066 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2067 | #Method SkIRect round() const |
| 2068 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2069 | #In Rounding |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2070 | Returns IRect by adding 0.5 and discarding the fractional portion of Rect |
| 2071 | members, using |
| 2072 | #Formula |
| 2073 | (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), |
| 2074 | SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)) |
| 2075 | ## |
| 2076 | . |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2077 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2078 | #Return rounded IRect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2079 | |
| 2080 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2081 | SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f }; |
| 2082 | SkIRect round = rect.round(); |
| 2083 | SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2084 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2085 | round: 31, 51, 41, 61 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2086 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2087 | ## |
| 2088 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2089 | #SeeAlso roundOut roundIn SkScalarRoundToInt |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2090 | |
| 2091 | ## |
| 2092 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2093 | # ------------------------------------------------------------------------------ |
| 2094 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2095 | #Method SkIRect roundOut() const |
| 2096 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2097 | #In Rounding |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2098 | Sets IRect by discarding the fractional portion of fLeft and fTop; and |
Cary Clark | 78c110e | 2018-02-09 16:49:09 -0500 | [diff] [blame] | 2099 | rounding up fRight and fBottom, using |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2100 | #Formula |
| 2101 | (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), |
| 2102 | SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)) |
| 2103 | ## |
| 2104 | . |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2105 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2106 | #Return rounded IRect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2107 | |
| 2108 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2109 | SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f }; |
| 2110 | SkIRect round = rect.roundOut(); |
| 2111 | SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2112 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2113 | round: 30, 50, 41, 61 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2114 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2115 | ## |
| 2116 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2117 | #SeeAlso round roundIn SkScalarRoundToInt |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2118 | |
| 2119 | ## |
| 2120 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 2121 | #Subtopic Rounding ## |
| 2122 | |
| 2123 | #Subtopic Sorting |
Cary Clark | 08895c4 | 2018-02-01 09:37:32 -0500 | [diff] [blame] | 2124 | #Line # orders sides ## |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 2125 | |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 2126 | #Populate |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2127 | |
| 2128 | # ------------------------------------------------------------------------------ |
| 2129 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2130 | #Method void sort() |
| 2131 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2132 | #In Sorting |
| 2133 | #Line # orders sides from smaller to larger ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2134 | Swaps fLeft and fRight if fLeft is greater than fRight; and swaps |
| 2135 | fTop and fBottom if fTop is greater than fBottom. Result may be empty; |
| 2136 | and width() and height() will be zero or positive. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2137 | |
| 2138 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2139 | SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f }; |
| 2140 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 2141 | rect.sort(); |
| 2142 | SkDebugf("sorted: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2143 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2144 | rect: 30.5, 50.5, 20.5, 10.5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2145 | sorted: 20.5, 10.5, 30.5, 50.5 |
| 2146 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2147 | ## |
| 2148 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 2149 | #SeeAlso makeSorted SkIRect::sort isSorted |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2150 | |
| 2151 | ## |
| 2152 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2153 | # ------------------------------------------------------------------------------ |
| 2154 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2155 | #Method SkRect makeSorted() const |
| 2156 | |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2157 | #In Sorting |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 2158 | #In Constructor |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 2159 | #Line # constructs Rect, ordering sides from smaller to larger ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2160 | Returns Rect with fLeft and fRight swapped if fLeft is greater than fRight; and |
| 2161 | with fTop and fBottom swapped if fTop is greater than fBottom. Result may be empty; |
| 2162 | and width() and height() will be zero or positive. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2163 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2164 | #Return sorted Rect ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2165 | |
| 2166 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2167 | SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f }; |
| 2168 | SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| 2169 | SkRect sort = rect.makeSorted(); |
| 2170 | SkDebugf("sorted: %g, %g, %g, %g\n", sort.fLeft, sort.fTop, sort.fRight, sort.fBottom); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2171 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2172 | rect: 30.5, 50.5, 20.5, 10.5 |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2173 | sorted: 20.5, 10.5, 30.5, 50.5 |
| 2174 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2175 | ## |
| 2176 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 2177 | #SeeAlso sort SkIRect::makeSorted isSorted |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2178 | |
| 2179 | ## |
| 2180 | |
Cary Clark | 2dc84ad | 2018-01-26 12:56:22 -0500 | [diff] [blame] | 2181 | #Subtopic Sorting ## |
| 2182 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2183 | # ------------------------------------------------------------------------------ |
| 2184 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2185 | #Method const SkScalar* asScalars() const |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 2186 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2187 | #Line # returns pointer to members as array ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2188 | Returns pointer to first Scalar in Rect, to treat it as an array with four |
| 2189 | entries. |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2190 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2191 | #Return pointer to fLeft ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2192 | |
| 2193 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2194 | SkRect rect = {7, 11, 13, 17}; |
| 2195 | SkDebugf("rect.asScalars() %c= &rect.fLeft\n", rect.asScalars() == &rect.fLeft? '=' : '!'); |
| 2196 | #StdOut |
| 2197 | rect.asScalars() == &rect.fLeft |
| 2198 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2199 | ## |
| 2200 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2201 | #SeeAlso toQuad |
| 2202 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2203 | ## |
| 2204 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2205 | # ------------------------------------------------------------------------------ |
| 2206 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2207 | #Method void dump(bool asHex) const |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 2208 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2209 | #Line # sends text representation to standard output using floats ## |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 2210 | Writes text representation of Rect to standard output. Set asHex to true to |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2211 | generate exact binary representations of floating point numbers. |
| 2212 | |
| 2213 | #Param asHex true if SkScalar values are written as hexadecimal ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2214 | |
| 2215 | #Example |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2216 | SkRect rect = {20, 30, 40, 50}; |
| 2217 | for (bool dumpAsHex : { false, true } ) { |
| 2218 | rect.dump(dumpAsHex); |
| 2219 | SkDebugf("\n"); |
| 2220 | } |
| 2221 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2222 | SkRect::MakeLTRB(20, 30, 40, 50); |
| 2223 | |
| 2224 | SkRect::MakeLTRB(SkBits2Float(0x41a00000), /* 20.000000 */ |
| 2225 | SkBits2Float(0x41f00000), /* 30.000000 */ |
| 2226 | SkBits2Float(0x42200000), /* 40.000000 */ |
| 2227 | SkBits2Float(0x42480000) /* 50.000000 */); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2228 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2229 | ## |
| 2230 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2231 | #SeeAlso dumpHex |
| 2232 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2233 | ## |
| 2234 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2235 | # ------------------------------------------------------------------------------ |
| 2236 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2237 | #Method void dump() const |
| 2238 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2239 | Writes text representation of Rect to standard output. The representation may be |
| 2240 | directly compiled as C++ code. Floating point values are written |
| 2241 | with limited precision; it may not be possible to reconstruct original Rect |
| 2242 | from output. |
| 2243 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2244 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2245 | SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6}; |
| 2246 | rect.dump(); |
| 2247 | SkRect copy = SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7); |
| 2248 | SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not "); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2249 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2250 | SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2251 | rect is not equal to copy |
| 2252 | ## |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2253 | ## |
| 2254 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2255 | #SeeAlso dumpHex |
| 2256 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2257 | ## |
| 2258 | |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2259 | # ------------------------------------------------------------------------------ |
| 2260 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2261 | #Method void dumpHex() const |
Cary Clark | 4855f78 | 2018-02-06 09:41:53 -0500 | [diff] [blame] | 2262 | #In Property |
Cary Clark | ab2621d | 2018-01-30 10:08:57 -0500 | [diff] [blame] | 2263 | #Line # sends text representation to standard output using hexadecimal ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2264 | Writes text representation of Rect to standard output. The representation may be |
| 2265 | directly compiled as C++ code. Floating point values are written |
| 2266 | in hexadecimal to preserve their exact bit pattern. The output reconstructs the |
| 2267 | original Rect. |
| 2268 | |
Cary Clark | 682c58d | 2018-05-16 07:07:07 -0400 | [diff] [blame] | 2269 | Use instead of dump() when submitting |
| 2270 | #A bug reports against Skia # https://bug.skia.org ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2271 | . |
| 2272 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2273 | #Example |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2274 | SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6}; |
| 2275 | rect.dumpHex(); |
| 2276 | SkRect copy = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ |
| 2277 | SkBits2Float(0x3f2aaaab), /* 0.666667 */ |
| 2278 | SkBits2Float(0x40266666), /* 2.600000 */ |
| 2279 | SkBits2Float(0x40e00000) /* 7.000000 */); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2280 | SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not "); |
| 2281 | #StdOut |
Cary Clark | 154beea | 2017-10-26 07:58:48 -0400 | [diff] [blame] | 2282 | SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */ |
| 2283 | SkBits2Float(0x3f2aaaab), /* 0.666667 */ |
| 2284 | SkBits2Float(0x40266666), /* 2.600000 */ |
| 2285 | SkBits2Float(0x40e00000) /* 7.000000 */); |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2286 | rect is equal to copy |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2287 | ## |
Cary Clark | 7fc1d12 | 2017-10-09 14:07:42 -0400 | [diff] [blame] | 2288 | ## |
| 2289 | |
| 2290 | #SeeAlso dump |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2291 | |
| 2292 | ## |
| 2293 | |
Cary Clark | 0c95aab | 2018-01-08 16:20:59 -0500 | [diff] [blame] | 2294 | #Method static SkRect SK_WARN_UNUSED_RESULT MakeLargest() |
Cary Clark | 0c95aab | 2018-01-08 16:20:59 -0500 | [diff] [blame] | 2295 | #Deprecated |
| 2296 | ## |
| 2297 | |
Cary Clark | bc5697d | 2017-10-04 14:31:33 -0400 | [diff] [blame] | 2298 | #Struct SkRect ## |
| 2299 | |
| 2300 | #Topic Rect ## |