aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkRect_Reference.bmh
blob: 49eff9e8730f76e165bd5dd8ee3ff67f3c6dc6e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
#Topic Rect
#Alias Rects ##
#Alias Rect_Reference ##

#Struct SkRect

SkRect holds four SkScalar coordinates describing the upper and
lower bounds of a rectangle. SkRect may be created from outer bounds or
from position, width, and height. SkRect describes an area; if its right
is less than or equal to its left, or if its bottom is less than or equal to
its top, it is considered empty.

# move to topic about MakeIWH and friends
SkRect can be constructed from int values to avoid compiler warnings that
integer input cannot convert to SkScalar without loss of precision.

#Subtopic Overview
#Populate
##

#Subtopic Related_Function
#Populate
##

#Subtopic Member_Function
#Populate
##

#Subtopic Member
#Populate

#Member SkScalar  fLeft
#Line # smaller x-axis bounds ##
May contain any value, including infinities and NaN. The smaller of the
horizontal values when sorted. When equal to or greater than fRight, Rect is empty.
##

#Member SkScalar  fTop
#Line # smaller y-axis bounds ##
May contain any value, including infinities and NaN. The smaller of the
vertical values when sorted. When equal to or greater than fBottom, Rect is empty.
##

#Member SkScalar  fRight
#Line # larger x-axis bounds ##
May contain any value, including infinities and NaN. The larger of the
horizontal values when sorted. When equal to or less than fLeft, Rect is empty.
##

#Member SkScalar  fBottom
#Line # larger y-axis bounds ##
May contain any value, including infinities and NaN. The larger of the
vertical values when sorted. When equal to or less than fTop, Rect is empty.
##

#Subtopic Member ##

#Subtopic Constructor
#Populate

# ------------------------------------------------------------------------------

#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty()

#In Constructor
#Line # constructs from bounds of (0, 0, 0, 0) ##
Returns constructed Rect set to (0, 0, 0, 0).
Many other rectangles are empty; if left is equal to or greater than right,
or if top is equal to or greater than bottom. Setting all members to zero
is a convenience, but does not designate a special empty rectangle.

#Return bounds (0, 0, 0, 0) ##

#Example
    SkRect rect = SkRect::MakeEmpty();
    SkDebugf("MakeEmpty isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
    rect.offset(10, 10);
    SkDebugf("offset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
    rect.inset(10, 10);
    SkDebugf("inset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
    rect.outset(20, 20);
    SkDebugf("outset rect isEmpty: %s\n", rect.isEmpty() ? "true" : "false");
#StdOut
MakeEmpty isEmpty: true
offset rect isEmpty: true
inset rect isEmpty: true
outset rect isEmpty: false
##
##

#SeeAlso isEmpty setEmpty SkIRect::MakeEmpty

##

# ------------------------------------------------------------------------------

#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h)

#In Constructor
#Line # constructs from SkScalar input returning (0, 0, width, height) ##
Returns constructed Rect set to SkScalar values (0, 0, w, h). Does not
validate input; w or h may be negative.

Passing integer values may generate a compiler warning since Rect cannot
represent 32-bit integers exactly. Use SkIRect for an exact integer rectangle.

#Param w  SkScalar width of constructed Rect  ##
#Param h  SkScalar height of constructed Rect ##

#Return bounds (0, 0, w, h) ##

#Example
    SkRect rect1 = SkRect::MakeWH(25, 35);
    SkRect rect2 = SkRect::MakeIWH(25, 35);
    SkRect rect3 = SkRect::MakeXYWH(0, 0, 25, 35);
    SkRect rect4 = SkRect::MakeLTRB(0, 0, 25, 35);
    SkDebugf("all %s" "equal\n", rect1 == rect2 && rect2 == rect3 && rect3 == rect4 ?
             "" : "not ");
#StdOut
all equal
##
##

#SeeAlso MakeSize MakeXYWH MakeIWH setWH SkIRect::MakeWH

##

# ------------------------------------------------------------------------------

#Method static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h)

#In Constructor
#Line # constructs from int input returning (0, 0, width, height) ##
Returns constructed Rect set to integer values (0, 0, w, h). Does not validate
input; w or h may be negative.

Use to avoid a compiler warning that input may lose precision when stored.
Use SkIRect for an exact integer rectangle.

#Param w  integer width of constructed Rect  ##
#Param h  integer height of constructed Rect ##

#Return bounds (0, 0, w, h) ##

#Example
    SkIRect i_rect = SkIRect::MakeWH(25, 35);
    SkRect  f_rect = SkRect::MakeIWH(25, 35);
    SkDebugf("i_rect width: %d f_rect width:%g\n", i_rect.width(), f_rect.width());
    i_rect = SkIRect::MakeWH(125000111, 0);
    f_rect = SkRect::MakeIWH(125000111, 0);
    SkDebugf("i_rect width: %d f_rect width:%.0f\n", i_rect.width(), f_rect.width());
#StdOut
i_rect width: 25 f_rect width:25
i_rect width: 125000111 f_rect width:125000112
##
##

#SeeAlso MakeXYWH MakeWH isetWH SkIRect::MakeWH

##

# ------------------------------------------------------------------------------

#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size)

#In Constructor
#Line # constructs from Size returning (0, 0, width, height) ##
Returns constructed Rect set to (0, 0, size.width(), size.height()). Does not
validate input; size.width() or size.height() may be negative.

#Param size  SkScalar values for Rect width and height ##

#Return bounds (0, 0, size.width(), size.height()) ##

#Example
    SkSize size = {25.5f, 35.5f};
    SkRect rect = SkRect::MakeSize(size);
    SkDebugf("rect width: %g  height: %g\n", rect.width(), rect.height());
    SkISize floor = size.toFloor();
    rect = SkRect::MakeSize(SkSize::Make(floor));
    SkDebugf("floor width: %g  height: %g\n", rect.width(), rect.height());
#StdOut
rect width: 25.5  height: 35.5
floor width: 25  height: 35
##
##

#SeeAlso MakeWH MakeXYWH MakeIWH setWH SkIRect::MakeWH

##

# ------------------------------------------------------------------------------

#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScalar r,
                                                           SkScalar b)
#In Constructor
#Line # constructs from SkScalar left, top, right, bottom ##

Returns constructed Rect set to (l, t, r, b). Does not sort input; Rect may
result in fLeft greater than fRight, or fTop greater than fBottom.

#Param l  SkScalar stored in fLeft ##
#Param t  SkScalar stored in fTop ##
#Param r  SkScalar stored in fRight ##
#Param b  SkScalar stored in fBottom ##

#Return bounds (l, t, r, b) ##

#Example
    SkRect rect = SkRect::MakeLTRB(5, 35, 15, 25);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect.sort();
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 5, 35, 15, 25  isEmpty: true
rect: 5, 25, 15, 35  isEmpty: false
##
##

#SeeAlso MakeXYWH SkIRect::MakeLTRB

##

# ------------------------------------------------------------------------------

#Method static constexpr SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w, SkScalar h)

#In Constructor
#Line # constructs from SkScalar input returning (x, y, width, height) ##
Returns constructed Rect set to
#Formula
(x, y, x + w, y + h)
##
. Does not validate input;
w or h may be negative.

#Param x  stored in fLeft ##
#Param y  stored in fTop ##
#Param w  added to x and stored in fRight ##
#Param h  added to y and stored in fBottom ##

#Return bounds at (x, y) with width w and height h ##

#Example
    SkRect rect = SkRect::MakeXYWH(5, 35, -15, 25);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect.sort();
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 5, 35, -10, 60  isEmpty: true
rect: -10, 35, 5, 60  isEmpty: false
##
##

#SeeAlso MakeLTRB SkIRect::MakeXYWH

##

# ------------------------------------------------------------------------------

#Method static SkRect SK_WARN_UNUSED_RESULT MakeFromIRect(const SkIRect& irect)
#Deprecated
##

# ------------------------------------------------------------------------------

#Method static SkRect Make(const SkISize& size)

#In Constructor
#Line # constructs from ISize returning (0, 0, width, height) ##
Returns constructed IRect set to (0, 0, size.width(), size.height()).
Does not validate input; size.width() or size.height() may be negative.

#Param size  integer values for Rect width and height ##

#Return bounds (0, 0, size.width(), size.height()) ##

#Example
    SkRect rect1 = SkRect::MakeSize({2, 35});
    SkRect rect2 = SkRect::MakeIWH(2, 35);
    SkDebugf("rect1 %c= rect2\n", rect1 == rect2 ? '=' : '!');
#StdOut
rect1 == rect2
##
##

#SeeAlso MakeWH MakeXYWH SkRect::MakeIWH SkIRect::MakeSize

##

# ------------------------------------------------------------------------------

#Method static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect)

#In Constructor
Returns constructed IRect set to irect, promoting integers to Scalar.
Does not validate input; fLeft may be greater than fRight, fTop may be greater
than fBottom.

#Param irect  integer unsorted bounds ##

#Return irect members converted to SkScalar ##

#Example
    SkIRect i_rect1 = {2, 35, 22, 53};
    SkRect f_rect = SkRect::Make(i_rect1);
    f_rect.offset(0.49f, 0.49f);
    SkIRect i_rect2;
    f_rect.round(&i_rect2);
    SkDebugf("i_rect1 %c= i_rect2\n", i_rect1 == i_rect2? '=' : '!');
##

#SeeAlso MakeLTRB

##

#Subtopic Constructor ##

#Subtopic Property
#Line # member values, center, validity ##
#Populate

# ------------------------------------------------------------------------------

#Method bool isEmpty() const

#In Property
#Line # returns true if width or height are zero or negative ##
Returns true if fLeft is equal to or greater than fRight, or if fTop is equal
to or greater than fBottom. Call sort() to reverse rectangles with negative
width() or height().

#Return true if width() or height() are zero or negative ##

#Example
    SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
    for (auto rect : tests) {
        SkDebugf("rect: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
                 rect.bottom(), rect.isEmpty() ? "" : " not");
        rect.sort();
        SkDebugf("sorted: {%g, %g, %g, %g} is" "%s empty\n", rect.left(), rect.top(), rect.right(),
                 rect.bottom(), rect.isEmpty() ? "" : " not");
    }
#StdOut
rect: {20, 40, 10, 50} is empty
sorted: {10, 40, 20, 50} is not empty
rect: {20, 40, 20, 50} is empty
sorted: {20, 40, 20, 50} is empty
##
##

#SeeAlso MakeEmpty sort SkIRect::isEmpty

##

# ------------------------------------------------------------------------------

#Method bool isSorted() const

#In Property
#Line # returns true if width or height are zero or positive ##
Returns true if fLeft is equal to or less than fRight, or if fTop is equal
to or less than fBottom. Call sort() to reverse rectangles with negative
width() or height().

#Return true if width() or height() are zero or positive ##

#Example
    SkRect tests[] = {{20, 40, 10, 50}, {20, 40, 20, 50}};
    for (auto rect : tests) {
        SkDebugf("rect: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(),
                 rect.bottom(), rect.isSorted() ? "" : " not");
        rect.sort();
        SkDebugf("sorted: {%g, %g, %g, %g} is" "%s sorted\n", rect.left(), rect.top(), rect.right(),
                 rect.bottom(), rect.isSorted() ? "" : " not");
    }
#StdOut
rect: {20, 40, 10, 50} is not sorted
sorted: {10, 40, 20, 50} is sorted
rect: {20, 40, 20, 50} is sorted
sorted: {20, 40, 20, 50} is sorted
##
##

#SeeAlso sort makeSorted isEmpty

##

# ------------------------------------------------------------------------------

#Method bool isFinite() const

#In Property
#Line # returns true if no member is infinite or NaN ##
Returns true if all values in the rectangle are finite: SK_ScalarMin or larger,
and SK_ScalarMax or smaller.

#Return true if no member is infinite or NaN ##

#Example
SkRect largest = { SK_ScalarMin, SK_ScalarMin, SK_ScalarMax, SK_ScalarMax };
    SkDebugf("largest is finite: %s\n", largest.isFinite() ? "true" : "false");
    SkDebugf("large width %g\n", largest.width());
    SkRect widest = SkRect::MakeWH(largest.width(), largest.height());
    SkDebugf("widest is finite: %s\n", widest.isFinite() ? "true" : "false");
#StdOut
largest is finite: true
large width inf
widest is finite: false
##
##

#SeeAlso SkScalarIsFinite SkScalarIsNaN

##

# ------------------------------------------------------------------------------

#Method SkScalar    x() const

#In Property
#Line # returns bounds left ##
Returns left edge of Rect, if sorted. Call isSorted to see if Rect is valid.
Call sort() to reverse fLeft and fRight if needed.

#Return fLeft ##

#Example
    SkRect unsorted = { 15, 5, 10, 25 };
    SkDebugf("unsorted.fLeft: %g unsorted.x(): %g\n", unsorted.fLeft, unsorted.x());
    SkRect sorted = unsorted.makeSorted();
    SkDebugf("sorted.fLeft: %g sorted.x(): %g\n", sorted.fLeft, sorted.x());
#StdOut
unsorted.fLeft: 15 unsorted.x(): 15
sorted.fLeft: 10 sorted.x(): 10
##
##

#SeeAlso fLeft left() y() SkIRect::x()

##

# ------------------------------------------------------------------------------

#Method SkScalar    y() const

#In Property
#Line # returns bounds top ##
Returns top edge of Rect, if sorted. Call isEmpty to see if Rect may be invalid,
and sort() to reverse fTop and fBottom if needed.

#Return fTop ##

#Example
    SkRect unsorted = { 15, 25, 10, 5 };
    SkDebugf("unsorted.fTop: %g unsorted.y(): %g\n", unsorted.fTop, unsorted.y());
    SkRect sorted = unsorted.makeSorted();
    SkDebugf("sorted.fTop: %g sorted.y(): %g\n", sorted.fTop, sorted.y());
#StdOut
unsorted.fTop: 25 unsorted.y(): 25
sorted.fTop: 5 sorted.y(): 5
##
##

#SeeAlso fTop top() x() SkIRect::y()

##

# ------------------------------------------------------------------------------

#Method SkScalar    left() const

#In Property
#Line # returns smaller bounds in x, if sorted ##
Returns left edge of Rect, if sorted. Call isSorted to see if Rect is valid.
Call sort() to reverse fLeft and fRight if needed.

#Return fLeft ##

#Example
    SkRect unsorted = { 15, 5, 10, 25 };
    SkDebugf("unsorted.fLeft: %g unsorted.left(): %g\n", unsorted.fLeft, unsorted.left());
    SkRect sorted = unsorted.makeSorted();
    SkDebugf("sorted.fLeft: %g sorted.left(): %g\n", sorted.fLeft, sorted.left());
#StdOut
unsorted.fLeft: 15 unsorted.left(): 15
sorted.fLeft: 10 sorted.left(): 10
##
##

#SeeAlso fLeft x() SkIRect::left()

##

# ------------------------------------------------------------------------------

#Method SkScalar    top() const

#In Property
#Line # returns smaller bounds in y, if sorted ##
Returns top edge of Rect, if sorted. Call isEmpty to see if Rect may be invalid,
and sort() to reverse fTop and fBottom if needed.

#Return fTop ##

#Example
    SkRect unsorted = { 15, 25, 10, 5 };
    SkDebugf("unsorted.fTop: %g unsorted.top(): %g\n", unsorted.fTop, unsorted.top());
    SkRect sorted = unsorted.makeSorted();
    SkDebugf("sorted.fTop: %g sorted.top(): %g\n", sorted.fTop, sorted.top());
#StdOut
unsorted.fTop: 25 unsorted.top(): 25
sorted.fTop: 5 sorted.top(): 5
##
##

#SeeAlso fTop y() SkIRect::top()

##

# ------------------------------------------------------------------------------

#Method SkScalar    right() const

#In Property
#Line # returns larger bounds in x, if sorted ##
Returns right edge of Rect, if sorted. Call isSorted to see if Rect is valid.
Call sort() to reverse fLeft and fRight if needed.

#Return fRight ##

#Example
    SkRect unsorted = { 15, 25, 10, 5 };
    SkDebugf("unsorted.fRight: %g unsorted.right(): %g\n", unsorted.fRight, unsorted.right());
    SkRect sorted = unsorted.makeSorted();
    SkDebugf("sorted.fRight: %g sorted.right(): %g\n", sorted.fRight, sorted.right());
#StdOut
unsorted.fRight: 10 unsorted.right(): 10
sorted.fRight: 15 sorted.right(): 15
##
##

#SeeAlso fRight SkIRect::right()

##

# ------------------------------------------------------------------------------

#Method SkScalar    bottom() const

#In Property
#Line # returns larger bounds in y, if sorted ##
Returns bottom edge of Rect, if sorted. Call isEmpty to see if Rect may be invalid,
and sort() to reverse fTop and fBottom if needed.

#Return fBottom ##

#Example
    SkRect unsorted = { 15, 25, 10, 5 };
    SkDebugf("unsorted.fBottom: %g unsorted.bottom(): %g\n", unsorted.fBottom, unsorted.bottom());
    SkRect sorted = unsorted.makeSorted();
    SkDebugf("sorted.fBottom: %g sorted.bottom(): %g\n", sorted.fBottom, sorted.bottom());
#StdOut
unsorted.fBottom: 5 unsorted.bottom(): 5
sorted.fBottom: 25 sorted.bottom(): 25
##
##

#SeeAlso fBottom SkIRect::bottom()

##

# ------------------------------------------------------------------------------

#Method SkScalar    width() const

#In Property
#Line # returns span in x ##
Returns span on the x-axis. This does not check if Rect is sorted, or if
result fits in 32-bit float; result may be negative or infinity.

#Return fRight minus fLeft ##

#Example
#Description
Compare with SkIRect::width() example.
##
    SkRect unsorted = { 15, 25, 10, 5 };
    SkDebugf("unsorted width: %g\n", unsorted.width());
    SkRect large = { -2147483647.f, 1, 2147483644.f, 2 };
    SkDebugf("large width: %.0f\n", large.width());
#StdOut
unsorted width: -5
large width: 4294967296
##
##

#SeeAlso height() SkIRect::width()

##

# ------------------------------------------------------------------------------

#Method SkScalar    height() const

#In Property
#Line # returns span in y ##
Returns span on the y-axis. This does not check if Rect is sorted, or if
result fits in 32-bit float; result may be negative or infinity.

#Return fBottom minus fTop ##

#Example
#Description
Compare with SkIRect::height() example.
##
    SkRect unsorted = { 15, 25, 10, 20 };
    SkDebugf("unsorted height: %g\n", unsorted.height());
    SkRect large = { 1, -2147483647.f, 2, 2147483644.f };
    SkDebugf("large height: %.0f\n", large.height());
#StdOut
unsorted height: -5
large height: 4294967296
##
##

#SeeAlso width() SkIRect::height()

##

# ------------------------------------------------------------------------------

#Method SkScalar    centerX() const

#In Property
#Line # returns midpoint in x ##
Returns average of left edge and right edge. Result does not change if Rect
is sorted. Result may overflow to infinity if Rect is far from the origin.

#Return midpoint in x ##

#Example
    SkRect tests[] = {{20, 30, 41, 51}, {-20, -30, -41, -51}};
    for (auto rect : tests) {
        SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX());
        rect.sort();
        SkDebugf("left: %3g right: %3g centerX: %3g\n", rect.left(), rect.right(), rect.centerX());
    }
#StdOut
left:  20 right:  41 centerX: 30.5
left:  20 right:  41 centerX: 30.5
left: -20 right: -41 centerX: -30.5
left: -41 right: -20 centerX: -30.5
##
##

#SeeAlso centerY

##

# ------------------------------------------------------------------------------

#Method SkScalar    centerY() const

#In Property
#Line # returns midpoint in y ##
Returns average of top edge and bottom edge. Result does not change if Rect
is sorted.

#Return midpoint in y ##

#Example
   SkRect rect = { 2e+38, 2e+38, 3e+38, 3e+38 };
   SkDebugf("left: %g right: %g centerX: %g ", rect.left(), rect.right(), rect.centerX());
   SkDebugf("safe mid x: %g\n", rect.left() / 2 + rect.right() / 2);
#StdOut
left: 2e+38 right: 3e+38 centerX: 2.5e+38 safe mid x: 2.5e+38
##
##

#SeeAlso centerX

##

#Subtopic Property ##

#Subtopic Operator

#Populate

# ------------------------------------------------------------------------------

#Method bool operator==(const SkRect& a, const SkRect& b)

#In Operator
#Line # returns true if members are equal ##
Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are
equal to the corresponding members in b.

a and b are not equal if either contain NaN. a and b are equal if members
contain zeroes width different signs.

#Param a  Rect to compare ##
#Param b  Rect to compare ##

#Return true if members are equal ##

#Example
    auto debugster = [](const SkRect& test) -> void {
        SkRect negZero = {-0.0f, -0.0f, 2, 2};
        SkDebugf("{%g, %g, %g, %g} %c= {%g, %g, %g, %g} %s numerically equal\n",
                 test.fLeft, test.fTop, test.fRight, test.fBottom,
                 negZero.fLeft, negZero.fTop, negZero.fRight, negZero.fBottom,
                 test == negZero ? '=' : '!',
                 test.fLeft == negZero.fLeft && test.fTop == negZero.fTop &&
                 test.fRight == negZero.fRight && test.fBottom == negZero.fBottom ?
                 "and are" : "yet are not");
    };
    SkRect tests[] = {{0, 0, 2, 2}, {-0, -0, 2, 2}, {0.0f, 0.0f, 2, 2}};
    SkDebugf("tests are %s" "equal\n", tests[0] == tests[1] && tests[1] == tests[2] ? "" : "not ");
    for (auto rect : tests) {
        debugster(rect);
    }
#StdOut
tests are equal
{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
{0, 0, 2, 2} == {-0, -0, 2, 2} and are numerically equal
##
##

#SeeAlso operator!=(const SkRect& a, const SkRect& b)

##

# ------------------------------------------------------------------------------

#Method bool operator!=(const SkRect& a, const SkRect& b)

#In Operator
#Line # returns true if members are unequal ##
Returns true if any in a: fLeft, fTop, fRight, and fBottom; does not
equal the corresponding members in b.

a and b are not equal if either contain NaN. a and b are equal if members
contain zeroes width different signs.

#Param a  Rect to compare ##
#Param b  Rect to compare ##

#Return true if members are not equal ##

#Example
    SkRect test = {0, 0, 2, SK_ScalarNaN};
    SkDebugf("test with NaN is %s" "equal to itself\n", test == test ? "" : "not ");
#StdOut
test with NaN is not equal to itself
##
##

#SeeAlso operator==(const SkRect& a, const SkRect& b)

##

#Subtopic Operator ##

#Subtopic As_Points
#Line # conversion to and from Points ##

#Populate

# ------------------------------------------------------------------------------

#Method void toQuad(SkPoint quad[4]) const

#In As_Points
#Line # returns four corners as Point ##
Returns four points in quad that enclose Rect ordered as: top-left, top-right,
bottom-right, bottom-left.

#Private
Consider adding param to control whether quad is clockwise or counterclockwise.
##

#Param quad  storage for corners of Rect ##

#Example
    SkRect rect = {1, 2, 3, 4};
    SkPoint corners[4];
    rect.toQuad(corners);
    SkDebugf("rect: {%g, %g, %g, %g}\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
    SkDebugf("corners:");
    for (auto corner : corners) {
        SkDebugf(" {%g, %g}", corner.fX, corner.fY);
    }
    SkDebugf("\n");
#StdOut
rect: {1, 2, 3, 4}
corners: {1, 2} {3, 2} {3, 4} {1, 4}
##
##

#SeeAlso SkPath::addRect

##

# ------------------------------------------------------------------------------

#Method void setBounds(const SkPoint pts[], int count)

#In As_Points
#Line # sets to upper and lower limits of Point array ##
Sets to bounds of Point array with count entries. If count is zero or smaller,
or if Point array contains an infinity or NaN, sets to (0, 0, 0, 0).

Result is either empty or sorted: fLeft is less than or equal to fRight, and
fTop is less than or equal to fBottom.

#Param pts  Point array ##
#Param count  entries in array ##

#Example
   SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}};
   for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
       SkRect rect;
       rect.setBounds(points, count);
       if (count > 0) {
           SkDebugf("added: %3g, %g ", points[count - 1].fX,  points[count - 1].fY);
       } else {
           SkDebugf("%14s", " ");
       }
       SkDebugf("count: %d rect: %g, %g, %g, %g\n", count,
               rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
   }
#StdOut
              count: 0 rect: 0, 0, 0, 0
added:   3, 4 count: 1 rect: 3, 4, 3, 4
added:   1, 2 count: 2 rect: 1, 2, 3, 4
added:   5, 6 count: 3 rect: 1, 2, 5, 6
added: nan, 8 count: 4 rect: 0, 0, 0, 0
##
##

#SeeAlso set setBoundsCheck SkPath::addPoly

##

# ------------------------------------------------------------------------------

#Method bool setBoundsCheck(const SkPoint pts[], int count)

#In As_Points
#Line # sets to upper and lower limits of Point array ##
Sets to bounds of Point array with count entries. Returns false if count is
zero or smaller, or if Point array contains an infinity or NaN; in these cases
sets Rect to (0, 0, 0, 0).

Result is either empty or sorted: fLeft is less than or equal to fRight, and
fTop is less than or equal to fBottom.

#Param pts  Point array ##
#Param count  entries in array ##

#Return true if all Point values are finite ##

#Example
   SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}};
   for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
       SkRect rect;
       bool success = rect.setBoundsCheck(points, count);
       if (count > 0) {
           SkDebugf("added: %3g, %g ", points[count - 1].fX,  points[count - 1].fY);
       } else {
           SkDebugf("%14s", " ");
       }
       SkDebugf("count: %d rect: %g, %g, %g, %g success: %s\n", count,
               rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, success ? "true" : "false");
   }
#StdOut
              count: 0 rect: 0, 0, 0, 0 success: true
added:   3, 4 count: 1 rect: 3, 4, 3, 4 success: true
added:   1, 2 count: 2 rect: 1, 2, 3, 4 success: true
added:   5, 6 count: 3 rect: 1, 2, 5, 6 success: true
added: nan, 8 count: 4 rect: 0, 0, 0, 0 success: false
##
##

#SeeAlso set setBounds SkPath::addPoly

##

#Subtopic As_Points ##

#Subtopic Set
#Line # replaces all values ##
#Populate

# ------------------------------------------------------------------------------

#Method void setBoundsNoCheck(const SkPoint pts[], int count)
#In Set
#Line # sets to upper and lower limits of Point array ##
Sets to bounds of Point pts array with count entries. If any Point in pts
contains infinity or NaN, all Rect dimensions are set to NaN.

#Param pts  Point array ##
#Param count  entries in array ##

#Example
   SkPoint points[] = {{3, 4}, {1, 2}, {SK_ScalarInfinity, 6}, {SK_ScalarNaN, 8}};
   for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
       SkRect rect;
       rect.setBoundsNoCheck(points, count);
       if (count > 0) {
           SkDebugf("added: %3g, %g ", points[count - 1].fX,  points[count - 1].fY);
       } else {
           SkDebugf("%14s", " ");
       }
       SkDebugf("count: %d rect: %g, %g, %g, %g\n", count,
               rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
   }
##

#SeeAlso setBoundsCheck
#Method ##

# ------------------------------------------------------------------------------

#Method void setEmpty()

#In Set
#Line # sets to (0, 0, 0, 0) ##
Sets Rect to (0, 0, 0, 0).

Many other rectangles are empty; if left is equal to or greater than right,
or if top is equal to or greater than bottom. Setting all members to zero
is a convenience, but does not designate a special empty rectangle.

#Example
    SkRect rect = {3, 4, 1, 2};
    for (int i = 0; i < 2; ++i) {
    SkDebugf("rect: {%g, %g, %g, %g} is %s" "empty\n", rect.fLeft, rect.fTop,
             rect.fRight, rect.fBottom, rect.isEmpty() ? "" : "not ");
    rect.setEmpty();
    }
#StdOut
rect: {3, 4, 1, 2} is empty
rect: {0, 0, 0, 0} is empty
##
##

#SeeAlso MakeEmpty SkIRect::setEmpty

##

# ------------------------------------------------------------------------------

#Method void set(const SkIRect& src)

#In Set
#Line # sets to SkScalar input (left, top, right, bottom) and others ##
Sets Rect to src, promoting src members from integer to Scalar.
Very large values in src may lose precision.

#Param src  integer Rect ##

#Example
    SkIRect i_rect = {3, 4, 1, 2};
    SkDebugf("i_rect: {%d, %d, %d, %d}\n", i_rect.fLeft, i_rect.fTop, i_rect.fRight, i_rect.fBottom);
    SkRect f_rect;
    f_rect.set(i_rect);
    SkDebugf("f_rect: {%g, %g, %g, %g}\n", f_rect.fLeft, f_rect.fTop, f_rect.fRight, f_rect.fBottom);
#StdOut
i_rect: {3, 4, 1, 2}
f_rect: {3, 4, 1, 2}
##
##

#SeeAlso  setLTRB SkIntToScalar

##

# ------------------------------------------------------------------------------

#Method void set(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)

#In Set
Sets Rect to (left, top, right, bottom).
left and right are not sorted; left is not necessarily less than right.
top and bottom are not sorted; top is not necessarily less than bottom.

#Param left  stored in fLeft ##
#Param top  stored in fTop ##
#Param right  stored in fRight ##
#Param bottom  stored in fBottom ##

#Example
    SkRect rect1 = {3, 4, 1, 2};
    SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
    SkRect rect2;
    rect2.set(3, 4, 1, 2);
    SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
#StdOut
rect1: {3, 4, 1, 2}
rect2: {3, 4, 1, 2}
##
##

#SeeAlso setLTRB setXYWH SkIRect::set

##

# ------------------------------------------------------------------------------

#Method void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)

#In Set
#Line # sets to SkScalar input (left, top, right, bottom) ##
Sets Rect to (left, top, right, bottom).
left and right are not sorted; left is not necessarily less than right.
top and bottom are not sorted; top is not necessarily less than bottom.

#Param left  stored in fLeft ##
#Param top  stored in fTop ##
#Param right  stored in fRight ##
#Param bottom  stored in fBottom ##

#Example
    SkRect rect1 = {3, 4, 1, 2};
    SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
    SkRect rect2;
    rect2.setLTRB(3, 4, 1, 2);
    SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
#StdOut
rect1: {3, 4, 1, 2}
rect2: {3, 4, 1, 2}
##
##

#SeeAlso set setXYWH SkIRect::set

##

# ------------------------------------------------------------------------------

#Method void set(const SkPoint pts[], int count)

#In Set
Sets to bounds of Point array with count entries. If count is zero or smaller,
or if Point array contains an infinity or NaN, sets Rect to (0, 0, 0, 0).

Result is either empty or sorted: fLeft is less than or equal to fRight, and
fTop is less than or equal to fBottom.

#Param pts  Point array ##
#Param count  entries in array ##

#Example
   SkPoint points[] = {{3, 4}, {1, 2}, {5, 6}, {SK_ScalarNaN, 8}};
   for (int count = 0; count <= (int) SK_ARRAY_COUNT(points); ++count) {
       SkRect rect;
       rect.set(points, count);
       if (count > 0) {
           SkDebugf("added: %3g, %g ", points[count - 1].fX,  points[count - 1].fY);
       } else {
           SkDebugf("%14s", " ");
       }
       SkDebugf("count: %d rect: %g, %g, %g, %g\n", count,
               rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
   }
#StdOut
              count: 0 rect: 0, 0, 0, 0
added:   3, 4 count: 1 rect: 3, 4, 3, 4
added:   1, 2 count: 2 rect: 1, 2, 3, 4
added:   5, 6 count: 3 rect: 1, 2, 5, 6
added: nan, 8 count: 4 rect: 0, 0, 0, 0
##
##

#SeeAlso setBounds setBoundsCheck SkPath::addPoly

##

# ------------------------------------------------------------------------------

#Method void set(const SkPoint& p0, const SkPoint& p1)

#In Set
Sets bounds to the smallest Rect enclosing Points p0 and p1. The result is
sorted and may be empty. Does not check to see if values are finite.

#Param p0  corner to include ##
#Param p1  corner to include ##

#Example
#Description
p0 and p1 may be swapped and have the same effect unless one contains NaN.
##
   SkPoint point1 = {SK_ScalarNaN, 8};
   SkPoint point2 = {3, 4};
   SkRect rect;
   rect.set(point1, point2);
   SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
   rect.set(point2, point1);
   SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
##

#SeeAlso setBounds setBoundsCheck

##

# ------------------------------------------------------------------------------

#Method void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height)

#In Set
#Line # sets to SkScalar input (x, y, width, height) ##
Sets Rect to
#Formula
(x, y, x + width, y + height)
##
. Does not validate input;
width or height may be negative.

#Param x  stored in fLeft ##
#Param y  stored in fTop ##
#Param width  added to x and stored in fRight ##
#Param height  added to y and stored in fBottom ##

#Example
    SkRect rect;
    rect.setXYWH(5, 35, -15, 25);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect.sort();
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 5, 35, -10, 60  isEmpty: true
rect: -10, 35, 5, 60  isEmpty: false
##
##

#SeeAlso MakeXYWH setLTRB set SkIRect::setXYWH

##

# ------------------------------------------------------------------------------

#Method void setWH(SkScalar width, SkScalar height)

#In Set
#Line # sets to SkScalar input (0, 0, width, height) ##
Sets Rect to (0, 0, width, height). Does not validate input;
width or height may be negative.

#Param width  stored in fRight ##
#Param height  stored in fBottom ##

#Example
    SkRect rect;
    rect.setWH(-15, 25);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect.sort();
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 0, 0, -15, 25  isEmpty: true
rect: -15, 0, 0, 25  isEmpty: false
##
##

#SeeAlso MakeWH setXYWH isetWH

##

#Subtopic Set ##

#Subtopic From_Integers
#Line # sets Scalar values from integer input ##

#Populate

# ------------------------------------------------------------------------------

#Method void iset(int left, int top, int right, int bottom)

#In From_Integers
#Line # sets to int input (left, top, right, bottom) ##
Sets Rect to (left, top, right, bottom).
All parameters are promoted from integer to Scalar.
left and right are not sorted; left is not necessarily less than right.
top and bottom are not sorted; top is not necessarily less than bottom.

#Param left  promoted to SkScalar and stored in fLeft ##
#Param top  promoted to SkScalar and stored in fTop ##
#Param right  promoted to SkScalar and stored in fRight ##
#Param bottom  promoted to SkScalar and stored in fBottom ##

#Example
    SkRect rect1 = {3, 4, 1, 2};
    SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
    SkRect rect2;
    rect2.iset(3, 4, 1, 2);
    SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
#StdOut
rect1: {3, 4, 1, 2}
rect2: {3, 4, 1, 2}
##
##

#SeeAlso set setLTRB SkIRect::set SkIntToScalar

##

# ------------------------------------------------------------------------------

#Method void isetWH(int width, int height)

#In From_Integers
#Line # sets to int input (0, 0, width, height) ##
Sets Rect to (0, 0, width, height).
width and height may be zero or negative. width and height are promoted from
integer to SkScalar, large values may lose precision.

#Param width  promoted to SkScalar and stored in fRight ##
#Param height  promoted to SkScalar and stored in fBottom ##

#Example
    SkRect rect1 = {0, 0, 1, 2};
    SkDebugf("rect1: {%g, %g, %g, %g}\n", rect1.fLeft, rect1.fTop, rect1.fRight, rect1.fBottom);
    SkRect rect2;
    rect2.isetWH(1, 2);
    SkDebugf("rect2: {%g, %g, %g, %g}\n", rect2.fLeft, rect2.fTop, rect2.fRight, rect2.fBottom);
#StdOut
rect1: {0, 0, 1, 2}
rect2: {0, 0, 1, 2}
##
##

#SeeAlso MakeWH MakeXYWH iset() SkIRect:MakeWH

##

#Subtopic From_Integers ##

#Subtopic Inset_Outset_Offset
#Line # moves sides ##

#Populate

# ------------------------------------------------------------------------------

#Method SkRect makeOffset(SkScalar dx, SkScalar dy) const

#In Inset_Outset_Offset
#Line # constructs from translated sides ##
Returns Rect offset by (dx, dy).

If dx is negative, Rect returned is moved to the left.
If dx is positive, Rect returned is moved to the right.
If dy is negative, Rect returned is moved upward.
If dy is positive, Rect returned is moved downward.

#Param dx  added to fLeft and fRight ##
#Param dy  added to fTop and fBottom ##

#Return Rect offset on axes, with original width and height ##

#Example
    SkRect rect = { 10, 50, 20, 60 };
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect = rect.makeOffset(15, 32);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 10, 50, 20, 60  isEmpty: false
rect: 25, 82, 35, 92  isEmpty: false
##
##

#SeeAlso offset() makeInset makeOutset SkIRect::makeOffset

##

# ------------------------------------------------------------------------------

#Method SkRect makeInset(SkScalar dx, SkScalar dy) const

#In Inset_Outset_Offset
#Line # constructs from sides moved symmetrically about the center ##
Returns Rect, inset by (dx, dy).

If dx is negative, Rect returned is wider.
If dx is positive, Rect returned is narrower.
If dy is negative, Rect returned is taller.
If dy is positive, Rect returned is shorter.

#Param dx  added to fLeft and subtracted from fRight ##
#Param dy  added to fTop and subtracted from fBottom ##

#Return Rect inset symmetrically left and right, top and bottom ##

#Example
    SkRect rect = { 10, 50, 20, 60 };
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect = rect.makeInset(15, 32);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 10, 50, 20, 60  isEmpty: false
rect: 25, 82, 5, 28  isEmpty: true
##
##

#SeeAlso inset() makeOffset makeOutset SkIRect::makeInset

##

# ------------------------------------------------------------------------------

#Method SkRect makeOutset(SkScalar dx, SkScalar dy) const

#In Inset_Outset_Offset
#Line # constructs from sides moved symmetrically about the center ##
Returns Rect, outset by (dx, dy).

If dx is negative, Rect returned is narrower.
If dx is positive, Rect returned is wider.
If dy is negative, Rect returned is shorter.
If dy is positive, Rect returned is taller.

#Param dx  subtracted to fLeft and added from fRight ##
#Param dy  subtracted to fTop and added from fBottom ##

#Return Rect outset symmetrically left and right, top and bottom ##

#Example
    SkRect rect = { 10, 50, 20, 60 };
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
    rect = rect.makeOutset(15, 32);
    SkDebugf("rect: %g, %g, %g, %g  isEmpty: %s\n", rect.left(), rect.top(), rect.right(),
              rect.bottom(), rect.isEmpty() ? "true" : "false");
#StdOut
rect: 10, 50, 20, 60  isEmpty: false
rect: -5, 18, 35, 92  isEmpty: false
##
##

#SeeAlso outset() makeOffset makeInset SkIRect::makeOutset

##

# ------------------------------------------------------------------------------

#Method void offset(SkScalar dx, SkScalar dy)

#In Inset_Outset_Offset
#Line # translates sides without changing width and height ##
Offsets Rect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom.

If dx is negative, moves Rect to the left.
If dx is positive, moves Rect to the right.
If dy is negative, moves Rect upward.
If dy is positive, moves Rect downward.

#Param dx  offset added to fLeft and fRight ##
#Param dy  offset added to fTop and fBottom ##

#Example
    SkRect rect = { 10, 14, 50, 73 };
    rect.offset(5, 13);
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
rect: 15, 27, 55, 86
##
##

#SeeAlso offsetTo makeOffset SkIRect::offset

##

# ------------------------------------------------------------------------------

#Method void offset(const SkPoint& delta)

#In Inset_Outset_Offset
Offsets Rect by adding delta.fX to fLeft, fRight; and by adding delta.fY to
fTop, fBottom.

If delta.fX is negative, moves Rect to the left.
If delta.fX is positive, moves Rect to the right.
If delta.fY is negative, moves Rect upward.
If delta.fY is positive, moves Rect downward.

#Param delta  added to Rect ##

#Example
    SkRect rect = { 10, 14, 50, 73 };
    rect.offset({5, 13});
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
rect: 15, 27, 55, 86
##
##

#SeeAlso offsetTo makeOffset SkIRect::offset

##

# ------------------------------------------------------------------------------

#Method void offsetTo(SkScalar newX, SkScalar newY)

#In Inset_Outset_Offset
#Line # translates to (x, y) without changing width and height ##
Offsets Rect so that fLeft equals newX, and fTop equals newY. width and height
are unchanged.

#Param newX  stored in fLeft, preserving width() ##
#Param newY  stored in fTop, preserving height() ##

#Example
    SkRect rect = { 10, 14, 50, 73 };
    rect.offsetTo(15, 27);
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
rect: 15, 27, 55, 86
##
##

#SeeAlso offset makeOffset setXYWH SkIRect::offsetTo

##

# ------------------------------------------------------------------------------

#Method void inset(SkScalar dx, SkScalar dy)

#In Inset_Outset_Offset
#Line # moves the sides symmetrically about the center ##
Insets Rect by (dx, dy).

If dx is positive, makes Rect narrower.
If dx is negative, makes Rect wider.
If dy is positive, makes Rect shorter.
If dy is negative, makes Rect taller.

#Param dx  added to fLeft and subtracted from fRight ##
#Param dy  added to fTop and subtracted from fBottom ##

#Example
    SkRect rect = { 10, 14, 50, 73 };
    rect.inset(5, 13);
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
rect: 15, 27, 45, 60
##
##

#SeeAlso outset makeInset SkIRect::inset

##

# ------------------------------------------------------------------------------

#Method void outset(SkScalar dx, SkScalar dy)

#In Inset_Outset_Offset
#Line # moves the sides symmetrically about the center ##
Outsets Rect by (dx, dy).

If dx is positive, makes Rect wider.
If dx is negative, makes Rect narrower.
If dy is positive, makes Rect taller.
If dy is negative, makes Rect shorter.

#Param dx  subtracted to fLeft and added from fRight ##
#Param dy  subtracted to fTop and added from fBottom ##

#Example
    SkRect rect = { 10, 14, 50, 73 };
    rect.outset(5, 13);
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
rect: 5, 1, 55, 86
##
##

#SeeAlso inset makeOutset SkIRect::outset

##

#Subtopic Inset_Outset_Offset ##

#Subtopic Intersection
#Line # sets to shared bounds ##

Rects intersect when they enclose a common area. To intersect, each of the pair
must describe area; fLeft is less than fRight, and fTop is less than fBottom;
empty() returns false. The intersection of Rect pair can be described by:

#Formula
(max(a.fLeft, b.fLeft), max(a.fTop, b.fTop),
 min(a.fRight, b.fRight), min(a.fBottom, b.fBottom))
##
.

The intersection is only meaningful if the resulting Rect is not empty and
describes an area: fLeft is less than fRight, and fTop is less than fBottom.

#Populate

# ------------------------------------------------------------------------------

#Method    bool contains(SkScalar x, SkScalar y) const

#In Intersection
#Line # returns true if points are equal or inside ##
Returns true if: fLeft <= x < fRight && fTop <= y < fBottom.
Returns false if SkRect is empty.

#Param x  test SkPoint x-coordinate ##
#Param y  test SkPoint y-coordinate ##

#Return true if (x, y) is inside SkRect ##

#Example
    SkRect rect = { 30, 50, 40, 60 };
    SkPoint tests[] = { { 30, 50 }, { 39, 49 }, { 29, 59 } };
    for (auto contained : tests) {
        SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g)\n",
                 rect.left(), rect.top(), rect.right(), rect.bottom(),
                 rect.contains(contained.x(), contained.y()) ? "contains" : "does not contain",
                 contained.x(), contained.y());
    }
#StdOut
rect: (30, 50, 40, 60) contains (30, 50)
rect: (30, 50, 40, 60) does not contain (39, 49)
rect: (30, 50, 40, 60) does not contain (29, 59)
##
##

#SeeAlso SkIRect::contains SkRRect::contains

##

# ------------------------------------------------------------------------------

#Method    bool contains(const SkRect& r) const

#In Intersection
Returns true if Rect contains r.
Returns false if Rect is empty or r is empty.

Rect contains r when Rect area completely includes r area.

#Param r  Rect contained ##

#Return true if all sides of Rect are outside r ##

#Example
    SkRect rect = { 30, 50, 40, 60 };
    SkRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
    for (auto contained : tests) {
        SkDebugf("rect: (%g, %g, %g, %g) %s (%g, %g, %g, %g)\n",
                 rect.left(), rect.top(), rect.right(), rect.bottom(),
                 rect.contains(contained) ? "contains" : "does not contain",
                 contained.left(), contained.top(), contained.right(), contained.bottom());
    }
#StdOut
rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
##
##

#SeeAlso SkIRect::contains

##

# ------------------------------------------------------------------------------

#Method    bool contains(const SkIRect& r) const

#In Intersection
Returns true if Rect contains r.
Returns false if Rect is empty or r is empty.

Rect contains r when Rect area completely includes r area.

#Param r  IRect contained ##

#Return true if all sides of Rect are outside r ##

#Example
    SkRect rect = { 30, 50, 40, 60 };
    SkIRect tests[] = { { 30, 50, 31, 51}, { 39, 49, 40, 50}, { 29, 59, 30, 60} };
    for (auto contained : tests) {
        SkDebugf("rect: (%g, %g, %g, %g) %s (%d, %d, %d, %d)\n",
                 rect.left(), rect.top(), rect.right(), rect.bottom(),
                 rect.contains(contained) ? "contains" : "does not contain",
                 contained.left(), contained.top(), contained.right(), contained.bottom());
    }
#StdOut
rect: (30, 50, 40, 60) contains (30, 50, 31, 51)
rect: (30, 50, 40, 60) does not contain (39, 49, 40, 50)
rect: (30, 50, 40, 60) does not contain (29, 59, 30, 60)
##
##

#SeeAlso SkIRect::contains

##

# ------------------------------------------------------------------------------

#Method bool intersect(const SkRect& r)

#In Intersection
#Line # sets to shared area; returns true if not empty ##
Returns true if Rect intersects r, and sets Rect to intersection.
Returns false if Rect does not intersect r, and leaves Rect unchanged.

Returns false if either r or Rect is empty, leaving Rect unchanged.

#Param r  limit of result ##

#Return true if r and Rect have area in common ##

#Example
#Description
Two SkDebugf calls are required. If the calls are combined, their arguments
may not be evaluated in left to right order: the printed intersection may
be before or after the call to intersect.
##
    SkRect leftRect =  { 10, 40, 50, 80 };
    SkRect rightRect = { 30, 60, 70, 90 };
    SkDebugf("%s intersection: ", leftRect.intersect(rightRect) ? "" : "no ");
    SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
                                 leftRect.right(), leftRect.bottom());
#StdOut
 intersection: 30, 60, 50, 80
##
##

#SeeAlso intersects Intersects join SkIRect::intersect

##

# ------------------------------------------------------------------------------

#Method bool intersect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)

#In Intersection
Constructs Rect to intersect from (left, top, right, bottom). Does not sort
construction.

Returns true if Rect intersects construction, and sets Rect to intersection.
Returns false if Rect does not intersect construction, and leaves Rect unchanged.

Returns false if either construction or Rect is empty, leaving Rect unchanged.

#Param left  x-axis minimum of constructed Rect ##
#Param top  y-axis minimum of constructed Rect ##
#Param right  x-axis maximum of constructed Rect ##
#Param bottom  y-axis maximum of constructed Rect ##

#Return true if construction and Rect have area in common ##

#Example
#Description
Two SkDebugf calls are required. If the calls are combined, their arguments
may not be evaluated in left to right order: the printed intersection may
be before or after the call to intersect.
##
    SkRect leftRect =  { 10, 40, 50, 80 };
    SkDebugf("%s intersection: ", leftRect.intersect(30, 60, 70, 90) ? "" : "no ");
    SkDebugf("%g, %g, %g, %g\n", leftRect.left(), leftRect.top(),
                                 leftRect.right(), leftRect.bottom());
#StdOut
 intersection: 30, 60, 50, 80
##
##

#SeeAlso intersects Intersects join SkIRect::intersect

##

# ------------------------------------------------------------------------------

#Method bool SK_WARN_UNUSED_RESULT intersect(const SkRect& a, const SkRect& b)

#In Intersection
Returns true if a intersects b, and sets Rect to intersection.
Returns false if a does not intersect b, and leaves Rect unchanged.

Returns false if either a or b is empty, leaving Rect unchanged.

#Param a  Rect to intersect ##
#Param b  Rect to intersect ##

#Return true if a and b have area in common ##

#Example
    SkRect result;
    bool intersected = result.intersect({ 10, 40, 50, 80 }, { 30, 60, 70, 90 });
    SkDebugf("%s intersection: %g, %g, %g, %g\n", intersected ? "" : "no ",
             result.left(), result.top(), result.right(), result.bottom());
#StdOut
 intersection: 30, 60, 50, 80
##
##

#SeeAlso intersects Intersects join SkIRect::intersect

##

# ------------------------------------------------------------------------------

#Method    bool intersects(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const

#In Intersection
#Line # returns true if areas overlap ##
Constructs Rect to intersect from (left, top, right, bottom). Does not sort
construction.

Returns true if Rect intersects construction.
Returns false if either construction or Rect is empty, or do not intersect.

#Param left  x-axis minimum of constructed Rect ##
#Param top  y-axis minimum of constructed Rect ##
#Param right  x-axis maximum of constructed Rect ##
#Param bottom  y-axis maximum of constructed Rect ##

#Return true if construction and Rect have area in common ##

#Example
    SkRect rect = { 10, 40, 50, 80 };
    SkDebugf("%s intersection", rect.intersects(30, 60, 70, 90) ? "" : "no ");
#StdOut
 intersection
##
##

#SeeAlso intersect Intersects SkIRect::Intersects

##

# ------------------------------------------------------------------------------

#Method    bool intersects(const SkRect& r) const

#In Intersection
Returns true if Rect intersects r.
Returns false if either r or Rect is empty, or do not intersect.

#Param r  Rect to intersect ##

#Return true if r and Rect have area in common ##

#Example
    SkRect rect = { 10, 40, 50, 80 };
    SkDebugf("%s intersection", rect.intersects({30, 60, 70, 90}) ? "" : "no ");
#StdOut
 intersection
##
##

#SeeAlso intersect Intersects SkIRect::Intersects

##

# ------------------------------------------------------------------------------

#Method    static bool Intersects(const SkRect& a, const SkRect& b)

#In Intersection
#Line # returns true if areas overlap ##
Returns true if a intersects b.
Returns false if either a or b is empty, or do not intersect.

#Param a  Rect to intersect ##
#Param b  Rect to intersect ##

#Return true if a and b have area in common ##

#Example
    SkDebugf("%s intersection", SkRect::Intersects({10, 40, 50, 80}, {30, 60, 70, 90}) ? "" : "no ");
#StdOut
 intersection
##
##

#SeeAlso intersect intersects SkIRect::Intersects

##

#Subtopic Intersection ##

#Subtopic Join
#Line # sets to union of bounds ##

#Populate

# ------------------------------------------------------------------------------

#Method    void join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)

#In Join
#Line # sets to union of bounds ##
Constructs Rect to intersect from (left, top, right, bottom). Does not sort
construction.

Sets Rect to the union of itself and the construction.

Has no effect if construction is empty. Otherwise, if Rect is empty, sets
Rect to construction.

#Param left  x-axis minimum of constructed Rect ##
#Param top  y-axis minimum of constructed Rect ##
#Param right  x-axis maximum of constructed Rect ##
#Param bottom  y-axis maximum of constructed Rect ##

#Example
    SkRect rect = { 10, 20, 15, 25};
    rect.join(50, 60, 55, 65);
    SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
 join: 10, 20, 55, 65
##
##

#SeeAlso joinNonEmptyArg joinPossiblyEmptyRect SkIRect::join

##

# ------------------------------------------------------------------------------

#Method    void join(const SkRect& r)

#In Join
Sets Rect to the union of itself and r.

Has no effect if r is empty. Otherwise, if Rect is empty, sets
Rect to r.

#Param r  expansion Rect ##

#Example
    SkRect rect = { 10, 20, 15, 25};
    rect.join({50, 60, 55, 65});
    SkDebugf("join: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
 join: 10, 20, 55, 65
##
##

#SeeAlso joinNonEmptyArg joinPossiblyEmptyRect SkIRect::join

##

# ------------------------------------------------------------------------------

#Method    void joinNonEmptyArg(const SkRect& r)

#In Join
#Line # sets to union of bounds, asserting that argument is not empty ##
Sets Rect to the union of itself and r.

Asserts if r is empty and SK_DEBUG is defined.
If Rect is empty, sets Rect to r.

May produce incorrect results if r is empty.

#Param r  expansion Rect ##

#Example
#Description
Since Rect is not sorted, first result is copy of toJoin.
##
    SkRect rect = { 10, 100, 15, 0};
    SkRect sorted = rect.makeSorted();
    SkRect toJoin = { 50, 60, 55, 65 };
    rect.joinNonEmptyArg(toJoin);
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
    sorted.joinNonEmptyArg(toJoin);
    SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom);
#StdOut
rect: 50, 60, 55, 65
sorted: 10, 0, 55, 100
##
##

#SeeAlso join joinPossiblyEmptyRect SkIRect::join

##

# ------------------------------------------------------------------------------

#Method    void joinPossiblyEmptyRect(const SkRect& r)

#In Join
#Line # sets to union of bounds; skips empty check for both ##
Sets Rect to the union of itself and the construction.

May produce incorrect results if Rect or r is empty.

#Param r  expansion Rect ##

#Example
#Description
Since Rect is not sorted, first result is not useful.
##
    SkRect rect = { 10, 100, 15, 0};
    SkRect sorted = rect.makeSorted();
    SkRect toJoin = { 50, 60, 55, 65 };
    rect.joinPossiblyEmptyRect(toJoin);
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
    sorted.joinPossiblyEmptyRect(toJoin);
    SkDebugf("sorted: %g, %g, %g, %g\n", sorted.fLeft, sorted.fTop, sorted.fRight, sorted.fBottom);
#StdOut
rect: 10, 60, 55, 65
sorted: 10, 0, 55, 100
##
##

#SeeAlso joinNonEmptyArg join SkIRect::join

##

#Subtopic Join ##

#Subtopic Rounding
#Line # adjust to integer bounds ##

#Populate

#Method    void round(SkIRect* dst) const

#In Rounding
#Line # sets members to nearest integer value ##
Sets IRect by adding 0.5 and discarding the fractional portion of Rect
members, using
#Formula
(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
 SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom))
##
.

#Param dst  storage for IRect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
    SkIRect round;
    rect.round(&round);
    SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 31, 51, 41, 61
##
##

#SeeAlso roundIn roundOut SkScalarRoundToInt

##

# ------------------------------------------------------------------------------

#Method    void roundOut(SkIRect* dst) const

#In Rounding
#Line # sets members to nearest integer value away from opposite ##
Sets IRect by discarding the fractional portion of fLeft and fTop; and
rounding up fRight and fBottom, using
#Formula
(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
 SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom))
##
.

#Param dst  storage for IRect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
    SkIRect round;
    rect.roundOut(&round);
    SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 30, 50, 41, 61
##
##

#SeeAlso roundIn round SkScalarRoundToInt

##

# ------------------------------------------------------------------------------

#Method    void roundOut(SkRect* dst) const

#In Rounding
Sets Rect by discarding the fractional portion of fLeft and fTop; and
rounding up fRight and fBottom, using
#Formula
(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
 SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom))
##
.

#Param dst  storage for Rect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
    SkRect round;
    rect.roundOut(&round);
    SkDebugf("round: %g, %g, %g, %g\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 30, 50, 41, 61
##
##

#SeeAlso roundIn round SkScalarRoundToInt

##

# ------------------------------------------------------------------------------

#Method    void roundIn(SkIRect* dst) const

#In Rounding
#Line # sets members to nearest integer value towards opposite ##
Sets Rect by rounding up fLeft and fTop; and
discarding the fractional portion of fRight and fBottom, using

#Formula
(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop),
 SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom))
##
.

#Param dst  storage for IRect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
    SkIRect round;
    rect.roundIn(&round);
    SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 31, 51, 40, 60
##
##

#SeeAlso roundOut round SkScalarRoundToInt

##

# ------------------------------------------------------------------------------

#Method    SkIRect round() const

#In Rounding
Returns IRect by adding 0.5 and discarding the fractional portion of Rect
members, using
#Formula
(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
 SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom))
##
.

#Return  rounded IRect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
    SkIRect round = rect.round();
    SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 31, 51, 41, 61
##
##

#SeeAlso roundOut roundIn SkScalarRoundToInt

##

# ------------------------------------------------------------------------------

#Method    SkIRect roundOut() const

#In Rounding
Sets IRect by discarding the fractional portion of fLeft and fTop; and
rounding up fRight and fBottom, using
#Formula
(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
 SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom))
##
.

#Return  rounded IRect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 40.5f, 60.5f };
    SkIRect round = rect.roundOut();
    SkDebugf("round: %d, %d, %d, %d\n", round.fLeft, round.fTop, round.fRight, round.fBottom);
#StdOut
round: 30, 50, 41, 61
##
##

#SeeAlso round roundIn SkScalarRoundToInt

##

#Subtopic Rounding ##

#Subtopic Sorting
#Line # orders sides ##

#Populate

# ------------------------------------------------------------------------------

#Method    void sort()

#In Sorting
#Line # orders sides from smaller to larger ##
Swaps fLeft and fRight if fLeft is greater than fRight; and swaps
fTop and fBottom if fTop is greater than fBottom. Result may be empty;
and width() and height() will be zero or positive.

#Example
    SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f };
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
    rect.sort();
    SkDebugf("sorted: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
#StdOut
rect: 30.5, 50.5, 20.5, 10.5
sorted: 20.5, 10.5, 30.5, 50.5
##
##

#SeeAlso makeSorted SkIRect::sort isSorted

##

# ------------------------------------------------------------------------------

#Method    SkRect makeSorted() const

#In Sorting
#In Constructor
#Line # constructs Rect, ordering sides from smaller to larger ##
Returns Rect with fLeft and fRight swapped if fLeft is greater than fRight; and
with fTop and fBottom swapped if fTop is greater than fBottom. Result may be empty;
and width() and height() will be zero or positive.

#Return  sorted Rect ##

#Example
    SkRect rect = { 30.5f, 50.5f, 20.5f, 10.5f };
    SkDebugf("rect: %g, %g, %g, %g\n", rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
    SkRect sort = rect.makeSorted();
    SkDebugf("sorted: %g, %g, %g, %g\n", sort.fLeft, sort.fTop, sort.fRight, sort.fBottom);
#StdOut
rect: 30.5, 50.5, 20.5, 10.5
sorted: 20.5, 10.5, 30.5, 50.5
##
##

#SeeAlso sort SkIRect::makeSorted isSorted

##

#Subtopic Sorting ##

# ------------------------------------------------------------------------------

#Method    const SkScalar* asScalars() const
#In Property
#Line # returns pointer to members as array ##
Returns pointer to first Scalar in Rect, to treat it as an array with four
entries.

#Return  pointer to fLeft ##

#Example
   SkRect rect = {7, 11, 13, 17};
SkDebugf("rect.asScalars() %c= &rect.fLeft\n", rect.asScalars() == &rect.fLeft? '=' : '!');
#StdOut
rect.asScalars() == &rect.fLeft
##
##

#SeeAlso toQuad

##

# ------------------------------------------------------------------------------

#Method    void dump(bool asHex) const
#In Property
#Line # sends text representation to standard output using floats ##
Writes text representation of Rect to standard output. Set asHex to true to
generate exact binary representations of floating point numbers.

#Param asHex  true if SkScalar values are written as hexadecimal ##

#Example
   SkRect rect = {20, 30, 40, 50};
    for (bool dumpAsHex : { false, true } ) {
        rect.dump(dumpAsHex);
        SkDebugf("\n");
    }
#StdOut
SkRect::MakeLTRB(20, 30, 40, 50);

SkRect::MakeLTRB(SkBits2Float(0x41a00000), /* 20.000000 */
                 SkBits2Float(0x41f00000), /* 30.000000 */
                 SkBits2Float(0x42200000), /* 40.000000 */
                 SkBits2Float(0x42480000)  /* 50.000000 */);
##
##

#SeeAlso dumpHex

##

# ------------------------------------------------------------------------------

#Method    void dump() const

Writes text representation of Rect to standard output. The representation may be
directly compiled as C++ code. Floating point values are written
with limited precision; it may not be possible to reconstruct original Rect
from output.

#Example
SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6};
rect.dump();
SkRect copy = SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not ");
#StdOut
SkRect::MakeLTRB(0.857143f, 0.666667f, 2.6f, 7);
rect is not equal to copy
##
##

#SeeAlso dumpHex

##

# ------------------------------------------------------------------------------

#Method    void dumpHex() const
#In Property
#Line # sends text representation to standard output using hexadecimal ##
Writes text representation of Rect to standard output. The representation may be
directly compiled as C++ code. Floating point values are written
in hexadecimal to preserve their exact bit pattern. The output reconstructs the
original Rect.

Use instead of dump() when submitting
#A bug reports against Skia # https://bug.skia.org ##
.

#Example
   SkRect rect = {6.f / 7, 2.f / 3, 26.f / 10, 42.f / 6};
rect.dumpHex();
SkRect copy = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab), /* 0.666667 */
                 SkBits2Float(0x40266666), /* 2.600000 */
                 SkBits2Float(0x40e00000)  /* 7.000000 */);
SkDebugf("rect is " "%s" "equal to copy\n", rect == copy ? "" : "not ");
#StdOut
SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab), /* 0.666667 */
                 SkBits2Float(0x40266666), /* 2.600000 */
                 SkBits2Float(0x40e00000)  /* 7.000000 */);
rect is equal to copy
##
##

#SeeAlso dump

##

#Method static SkRect SK_WARN_UNUSED_RESULT MakeLargest()
#Deprecated
##

#Struct SkRect ##

#Topic Rect ##