aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkRRect_Reference.bmh
blob: 633239adde728dd7204379598eeb1f1c5489280f (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
#Topic RRect
#Alias Round_Rect ##
#Alias RRect_Reference ##

#Class SkRRect

SkRRect describes a rounded rectangle with a bounds and a pair of radii for each corner.
The bounds and radii can be set so that SkRRect describes: a rectangle with sharp corners;
a Circle; an Oval; or a rectangle with one or more rounded corners.

SkRRect allows implementing CSS properties that describe rounded corners.
SkRRect may have up to eight different radii, one for each axis on each of its four
corners.

SkRRect may modify the provided parameters when initializing bounds and radii.
If either axis radii is zero or less: radii are stored as zero; corner is square.
If corner curves overlap, radii are proportionally reduced to fit within bounds.

#Subtopic Overview
#Populate
##

#Subtopic Constructor
#Populate
##

#Subtopic Operator
#Populate
##

#Subtopic Member_Function
#Populate
##

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

#Method SkRRect()
#In Constructor
#Line # creates with zeroed bounds and corner radii ##

Initializes bounds at (0, 0), the origin, with zero width and height.
Initializes corner radii to (0, 0), and sets type of kEmpty_Type.

#Return empty Round_Rect ##

#Example
#Height 60
    SkRRect rrect;
    SkPaint p;
    p.setStyle(SkPaint::kStroke_Style);
    p.setStrokeWidth(10);
    canvas->drawRRect(rrect, p);
    rrect.setRect({10, 10, 100, 50});
    canvas->drawRRect(rrect, p);
##

#SeeAlso setEmpty isEmpty

#Method ##

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

#Method SkRRect(const SkRRect& rrect)
#In Constructor
#Line # copies bounds and corner radii ##

Initializes to copy of rrect bounds and corner radii.

#Param rrect  bounds and corner to copy ##

#Return copy of rrect ##

#Bug 8115
#Example
#Height 60
    SkRRect rrect = SkRRect::MakeRect({10, 10, 100, 50});
    SkRRect rrect2(rrect);
    rrect2.inset(20, 20);
    SkPaint p;
    p.setStyle(SkPaint::kStroke_Style);
    p.setStrokeWidth(10);
    canvas->drawRRect(rrect, p);
    canvas->drawRRect(rrect2, p);
##

#SeeAlso operator=(const SkRRect& rrect) MakeRect

#Method ##

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

#Method SkRRect& operator=(const SkRRect& rrect)
#In Operator
#Line # copies bounds and corner radii ##

Copies rrect bounds and corner radii.

#Param rrect  bounds and corner to copy ##

#Return copy of rrect ##

#Example
#Height 110
    SkRRect rrect = SkRRect::MakeRect({40, 40, 100, 70});
    SkRRect rrect2 = rrect;
    rrect2.inset(-20, -20);
    SkPaint p;
    p.setStyle(SkPaint::kStroke_Style);
    p.setStrokeWidth(10);
    canvas->drawRRect(rrect, p);
    canvas->drawRRect(rrect2, p);
##

#SeeAlso SkRRect(const SkRRect& rrect) MakeRect

#Method ##

# ------------------------------------------------------------------------------
#Subtopic Type
#Line # specialization of Round_Rect geometry ##

#PhraseDef list_of_rrect_types
kEmpty_Type, kRect_Type, kOval_Type, kSimple_Type, kNinePatch_Type,
kComplex_Type
##

#Enum Type
#Line # specialization of Round_Rect geometry ##

#Code
    enum Type {
        kEmpty_Type,
        kRect_Type,
        kOval_Type,
        kSimple_Type,
        kNinePatch_Type,
        kComplex_Type,
        kLastType = kComplex_Type,
    };
##

Type describes possible specializations of Round_Rect. Each Type is
exclusive; a Round_Rect may only have one type. 

Type members become progressively less restrictive; larger values of
Type have more degrees of freedom than smaller values.

#Const kEmpty_Type 0
#Line # zero width or height ##
Round_Rect has zero width or height. All radii are zero.
##
#Const kRect_Type 1
#Line # non-zero width and height, and zeroed radii ##
Round_Rect has width and height. All radii are zero.
##
#Const kOval_Type 2
#Line # non-zero width and height filled with radii ##
Round_Rect has width and height. All four x-radii are equal,
and at least half the width. All four y-radii are equal,
and at least half the height.
##
#Const kSimple_Type 3
#Line # non-zero width and height with equal radii ##
Round_Rect has width and height. All four x-radii are equal and
greater than zero, and all four y-radii are equal and greater than
zero. Either x-radii are less than half the width, or y-radii is
less than half the height, or both.
##
#Const kNinePatch_Type 4
#Line # non-zero width and height with axis-aligned radii ##
Round_Rect has width and height. Left x-radii are equal, top
y-radii are equal, right x-radii are equal, and bottom y-radii
are equal. The radii do not describe Rect, Oval, or simple type.

The centers of the corner ellipses form an axis-aligned rectangle
that divides the Round_Rect into nine rectangular patches; an
interior rectangle, four edges, and four corners.
##
#Const kComplex_Type 5
#Line # non-zero width and height with arbitrary radii ##
both radii are non-zero.
##
#Const kLastType 5
#Line # largest Type value ##
##

#Example
#Height 128
    struct Radii { SkVector data[4]; };
    auto drawRRectType = [=](const SkRect& rect, const Radii& radii) {
        SkRRect rrect;
        rrect.setRectRadii(rect, radii.data);
        SkPaint paint;
        paint.setAntiAlias(true);
        const char* typeStr[] = { "empty", "rect", "oval", "simple", "nine patch", "complex" };
        paint.setTextAlign(SkPaint::kCenter_Align);
        canvas->drawString(typeStr[(int) rrect.type()], rect.centerX(), rect.bottom() + 20, paint);
        paint.setStyle(SkPaint::kStroke_Style);       
        canvas->drawRRect(rrect, paint);
    };
    drawRRectType({ 45,  30,  45,  30}, {{{ 5,  5}, { 5,  5}, { 5,  5}, { 5,  5}}});
    drawRRectType({ 90,  10, 140,  30}, {{{ 0,  0}, { 0,  0}, { 0,  0}, { 0,  0}}});
    drawRRectType({160,  10, 210,  30}, {{{25, 10}, {25, 10}, {25, 10}, {25, 10}}});
    drawRRectType({ 20,  80,  70, 100}, {{{ 5,  5}, { 5,  5}, { 5,  5}, { 5,  5}}});
    drawRRectType({ 90,  80, 140, 100}, {{{ 5,  5}, {10,  5}, {10,  5}, { 5,  5}}});
    drawRRectType({160,  80, 210, 100}, {{{ 5,  5}, {10,  5}, { 5,  5}, { 5,  5}}});
##

#SeeAlso Rect Path

#Enum ##

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

#Method Type getType() const
#In Property
#Line # returns Type ##

Returns Type, one of: #list_of_rrect_types#.

#Return Type ##

#Example
#Height 100
#Description 
rrect2 is not a Rect; inset() has made it empty.
##
    SkRRect rrect = SkRRect::MakeRect({10, 10, 100, 50});
    SkRRect rrect2(rrect);
    rrect2.inset(20, 20);
    SkPaint p;
    p.setStyle(SkPaint::kStroke_Style);
    p.setStrokeWidth(10);
    std::string str("Type ");
    str += SkRRect::kRect_Type == rrect2.getType() ? "=" : "!"; 
    str += "= SkRRect::kRect_Type";
    canvas->drawString(str.c_str(), 20, 80, SkPaint());
    canvas->drawRRect(rrect2, p);
##

#SeeAlso Type type

#Method ##

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

#Method Type type() const
#In Property
#Line # returns Type ##

Returns Type, one of: #list_of_rrect_types#.

#Return Type ##

#Example
#Height 100
#Description 
inset() has made rrect2 empty.
##
    SkRRect rrect = SkRRect::MakeRect({10, 10, 100, 50});
    SkRRect rrect2(rrect);
    rrect2.inset(20, 20);
    SkPaint p;
    p.setStyle(SkPaint::kStroke_Style);
    p.setStrokeWidth(10);
    std::string str("Type ");
    str += SkRRect::kEmpty_Type == rrect2.type() ? "=" : "!"; 
    str += "= SkRRect::kEmpty_Type";
    canvas->drawString(str.c_str(), 20, 80, SkPaint());
    canvas->drawRRect(rrect2, p);
##

#SeeAlso Type getType

#Method ##

#Subtopic Type ##

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

#Method inline bool isEmpty() const
#In Property
#Line # returns true if width or height are zero ##
Returns true if rect().fLeft is equal to rect().fRight, or if rect().fTop is equal
to rect().fBottom.

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

#Example
#Height 100
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    paint.setTextSize(16);
    SkRRect rrect = SkRRect::MakeRectXY({30, 10, 100, 60}, 10, 5);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isEmpty() ? "empty" : "not empty", 64, 90, paint);
    rrect.inset(40, 0);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isEmpty() ? "empty" : "not empty", 64, 90, paint);
##

#SeeAlso SkRect::isEmpty height width

#Method ##

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

#Method inline bool isRect() const
#In Property
#Line # returns true if not empty, and one radius at each corner is zero ##
Returns true if not empty, and if either x-axis or y-axis radius at each corner
is zero.

#Return true if not empty, and one radius at each corner is zero ##

#Example
#Height 100
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    paint.setTextSize(16);
    SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isRect() ? "rect" : "not rect", 64, 90, paint);
    SkVector radii[] = {{10, 10}, {0, 0}, {0, 0}, {0, 0}};
    rrect.setRectRadii(rrect.getBounds(), radii);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isRect() ? "rect" : "not rect", 64, 90, paint);
##

#SeeAlso isEmpty radii

#Method ##

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

#Method inline bool isOval() const
#In Property
#Line # returns true if not empty, axes radii are equal, radii fill bounds ##
Returns true if not empty, if all x-axis radii are equal, if all y-axis radii
are equal, x-axis radii are at least half the width, and y-axis radii are at
least half the height.

#Return true if has identical geometry to Oval ##

#Example
#Height 100
#Description
The first radii are scaled down proportionately until both x-axis and y-axis fit
within the bounds. After scaling, x-axis radius is smaller than half the width;
left Round_Rect is not an oval. The second radii are equal to half the
dimensions; right Round_Rect is an oval.
##
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    paint.setTextSize(16);
    SkRRect rrect = SkRRect::MakeRectXY({30, 10, 100, 60}, 40, 30);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isOval() ? "oval" : "not oval", 64, 90, paint);
    rrect.setRectXY(rrect.getBounds(), 35, 25);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isOval() ? "oval" : "not oval", 64, 90, paint);
##

#SeeAlso isEmpty isSimple SkCanvas::drawOval

#Method ##

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

#Method inline bool isSimple() const
#In Property
#Line # returns true if not empty, Rect or Oval; and axes radii are equal ##
Returns true if not empty, if all x-axis radii are equal but not zero,
if all y-axis radii are equal but not zero; and x-axis radius is less than half
width(), or y-axis radius is less than half height().

#Return true if not empty, Rect or Oval; and axes radii are equal ##

#Bug 8107
#Example
#Height 100
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    paint.setTextSize(16);
    SkVector radii[] = {{40, 30}, {40, 30}, {40, 30}, {40, 30}};
    SkRRect rrect;
    rrect.setRectRadii({30, 10, 100, 60}, radii);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isSimple() ? "simple" : "not simple", 64, 90, paint);
    radii[0].fX = 35;
    rrect.setRectRadii(rrect.getBounds(), radii);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isSimple() ? "simple" : "not simple", 64, 90, paint);
##

#SeeAlso isEmpty isRect isOval isNinePatch

#Method ##

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

#Method inline bool isNinePatch() const
#In Property
#Line # returns true if not empty, Rect, Oval or simple; and radii are axis-aligned ##
Returns true if isEmpty, isRect, isOval, and isSimple return false; and if
left x-axis radii are equal, right x-axis radii are equal, top y-axis radii are
equal, and bottom y-axis radii are equal.

#Return true if not empty, Rect, Oval or simple; and radii are axis-aligned ##

#Bug 8107
#Example
#Height 100
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    paint.setTextSize(16);
    SkVector radii[] = {{20, 30}, {40, 30}, {40, 30}, {20, 30}};
    SkRRect rrect;
    rrect.setRectRadii({30, 10, 100, 60}, radii);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isNinePatch() ? "9 patch" : "not 9 patch", 64, 90, paint);
    radii[0].fX = 35;
    rrect.setRectRadii(rrect.getBounds(), radii);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isNinePatch() ? "9 patch" : "not 9 patch", 64, 90, paint);
##

#SeeAlso isEmpty isRect isOval isSimple isComplex

#Method ##

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

#Method inline bool isComplex() const
#In Property
#Line # returns true if not empty, Rect, Oval, simple, or nine-patch ##

Returns true if isEmpty, isRect, isOval, isSimple, and isNinePatch return false.
If true: width and height are greater than zero, at least one corner radii are
both greater than zero; left x-axis radii are not equal, or right x-axis radii
are not equal, or top y-axis radii are not equal, or bottom y-axis radii are not
equal.

#Return true if not empty, Rect, Oval, simple, or nine-patch ##

#Example
#Height 100
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    paint.setTextSize(16);
    SkVector radii[] = {{25, 30}, {40, 30}, {40, 30}, {20, 30}};
    SkRRect rrect;
    rrect.setRectRadii({30, 10, 100, 60}, radii);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isComplex() ? "complex" : "not complex", 64, 90, paint);
    radii[0].fX = 20;
    rrect.setRectRadii(rrect.getBounds(), radii);
    canvas->translate(128, 0);
    canvas->drawRRect(rrect, paint);
    canvas->drawString(rrect.isComplex() ? "complex" : "not complex", 64, 90, paint);
##

#SeeAlso isEmpty isRect isOval isSimple isNinePatch

#Method ##

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

#Method SkScalar width() const
#In Property
#Line # returns span in x-axis ##
Returns span on the x-axis. This does not check if result fits in 32-bit float;
result may be infinity.

#Return bounds().fRight minus bounds().fLeft ##

#Example
#Description
SkRRect::MakeRect sorts its input, so width() is always zero or larger.
##
    SkRRect unsorted = SkRRect::MakeRect({ 15, 25, 10, 5 });
    SkDebugf("unsorted width: %g\n", unsorted.width());
    SkRRect large = SkRRect::MakeRect({ -FLT_MAX, 1, FLT_MAX, 2 });
    SkDebugf("large width: %.0f\n", large.width());
#StdOut
unsorted width: 5
large width: inf
##
##

#SeeAlso SkRect::width height getBounds

#Method ##

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

#Method SkScalar height() const
#In Property
#Line # returns span in y-axis ##
Returns span on the y-axis. This does not check if result fits in 32-bit float;
result may be infinity.

#Return bounds().fBottom minus bounds().fTop ##

#Example
#Description
SkRRect::MakeRect sorts its input, so height() is always zero or larger.
##
    SkRRect unsorted = SkRRect::MakeRect({ 15, 25, 10, 20 });
    SkDebugf("unsorted height: %g\n", unsorted.height());
    SkRRect large = SkRRect::MakeRect({ 1, -FLT_MAX, 2, FLT_MAX });
    SkDebugf("large height: %.0f\n", large.height());
#StdOut
unsorted height: 5
large height: inf
##
##

#SeeAlso SkRect.height width getBounds

#Method ##

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

#Method SkVector getSimpleRadii() const
#In Property
#Line # returns corner radii for simple types ##

Returns top-left corner x-radii. If type() returns kEmpty_Type, kRect_Type, 
kOval_Type, or kSimple_Type, returns a value representative of all corner radii.
If type() returns kNinePatch_Type or kComplex_Type, at least one of the
remaining three corners has a different value.

#Return corner radii for simple types ##

#Example
#Height 100
    auto drawDetails = [=](const SkRRect& rrect) {
        SkPaint paint;
        paint.setAntiAlias(true);
        paint.setTextAlign(SkPaint::kCenter_Align);
        paint.setTextSize(12);
        canvas->drawRRect(rrect, paint);
        SkVector corner = rrect.getSimpleRadii();
        std::string label = "corner: " + std::to_string(corner.fX).substr(0, 3) + ", " +
                        std::to_string(corner.fY).substr(0, 3);
        canvas->drawString(label.c_str(), 64, 90, paint);
        canvas->translate(128, 0);
    };
    SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});
    drawDetails(rrect);
    rrect.setRectXY(rrect.getBounds(), 5, 8);
    drawDetails(rrect);
##

#SeeAlso radii getBounds getType isSimple

#Method ##

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

#Method void setEmpty()
#In Set
#Line # zeroes width, height, and corner radii ##

Sets bounds to zero width and height at (0, 0), the origin. Sets
corner radii to zero and sets type to kEmpty_Type.

#Example
#Height 80
#Description
Nothing blue is drawn because Round_Rect is set to empty.
##
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});
    canvas->drawRRect(rrect, paint);
    rrect.setEmpty();
    paint.setColor(SK_ColorBLUE);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso MakeEmpty setRect

#Method ##

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

#Method void setRect(const SkRect& rect)
#In Set
#Line # sets Round_Rect bounds with zeroed corners ##

Sets bounds to sorted rect, and sets corner radii to zero.
If set bounds has width and height, and sets type to kRect_Type;
otherwise, sets type to kEmpty_Type.

#Param rect  bounds to set ##

#Example
#Height 90
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});
    canvas->drawRRect(rrect, paint);
    rrect.setRect({60, 30, 120, 80});
    paint.setColor(SK_ColorBLUE);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso MakeRect setRectXY

#Method ##

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

#Method static SkRRect MakeEmpty()
#In Constructor
#Line # creates with zeroed bounds and corner radii ##

Initializes bounds at (0, 0), the origin, with zero width and height.
Initializes corner radii to (0, 0), and sets type of kEmpty_Type.

#Return empty Round_Rect ##

#Example
#Height 90
    SkRRect rrect = SkRRect::MakeEmpty();
    SkRRect rrect2(rrect);
    rrect2.inset(-20, -20);
    SkPaint p;
    p.setStyle(SkPaint::kStroke_Style);
    p.setStrokeWidth(10);
    std::string str("Type ");
    str += SkRRect::kEmpty_Type == rrect2.type() ? "=" : "!"; 
    str += "= SkRRect::kEmpty_Type";
    canvas->drawString(str.c_str(), 20, 80, SkPaint());
    canvas->drawRRect(rrect2, p);
##

#SeeAlso SkRRect() SkRect::MakeEmpty

#Method ##

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

#Method static SkRRect MakeRect(const SkRect& r)
#In Constructor
#Line # copies bounds and zeroes corner radii ##

Initializes to copy of r bounds and zeroes corner radii.

#Param r  bounds to copy ##

#Return copy of r ##

#Example
#Height 70
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRect({30, 10, 100, 60});
    canvas->drawRRect(rrect, paint);
    rrect.setOval(rrect.getBounds());
    paint.setColor(SK_ColorBLUE);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso setRect MakeOval MakeRectXY

#Method ##

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

#Method static SkRRect MakeOval(const SkRect& oval)
#In Constructor
#Line # creates Oval to fit bounds ##

Sets bounds to oval, x-axis radii to half oval.width(), and all y-axis radii
to half oval.height(). If oval bounds is empty, sets to kEmpty_Type.
Otherwise, sets to kOval_Type.

#Param oval  bounds of Oval ##

#Return Oval ##

#Example
#Height 70
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeOval({30, 10, 100, 60});
    canvas->drawRRect(rrect, paint);
    rrect.setRect(rrect.getBounds());
    paint.setColor(SK_ColorBLUE);
    paint.setBlendMode(SkBlendMode::kDifference);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso setOval MakeRect MakeRectXY

#Method ##

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

#Method static SkRRect MakeRectXY(const SkRect& rect, SkScalar xRad, SkScalar yRad)
#In Constructor
#Line # creates rounded rectangle ##

Sets to rounded rectangle with the same radii for all four corners.
If rect is empty, sets to kEmpty_Type.
Otherwise, if xRad and yRad are zero, sets to kRect_Type.
Otherwise, if xRad is at least half rect.width() and yRad is at least half
rect.height(), sets to kOval_Type.
Otherwise, sets to kSimple_Type.

#Param rect  bounds of rounded rectangle ##
#Param xRad  x-axis radius of corners ##
#Param yRad  y-axis radius of corners ##

#Return rounded rectangle ##

#Example
#Height 70
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRectXY({30, 10, 100, 60}, 20, 20);
    canvas->drawRRect(rrect, paint);
    rrect.setRect(rrect.getBounds());
    paint.setColor(SK_ColorBLUE);
    paint.setBlendMode(SkBlendMode::kModulate);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso setRectXY

#Method ##

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

#Method void setOval(const SkRect& oval)
#In Set
#Line # replaces with Oval to fit bounds ##

Sets bounds to oval, x-axis radii to half oval.width(), and all y-axis radii
to half oval.height(). If oval bounds is empty, sets to kEmpty_Type.
Otherwise, sets to kOval_Type.

#Param oval  bounds of Oval ##

#Example
#Height 70
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRectXY({30, 10, 100, 60}, 20, 20);
    canvas->drawRRect(rrect, paint);
    rrect.setOval(rrect.getBounds());
    paint.setColor(SK_ColorWHITE);
    paint.setBlendMode(SkBlendMode::kExclusion);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso MakeOval

#Method ##

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

#Method void setRectXY(const SkRect& rect, SkScalar xRad, SkScalar yRad)
#In Set
#Line # replaces with rounded rectangle ##

Sets to rounded rectangle with the same radii for all four corners.
If rect is empty, sets to kEmpty_Type.
Otherwise, if xRad or yRad is zero, sets to kRect_Type.
Otherwise, if xRad is at least half rect.width() and yRad is at least half
rect.height(), sets to kOval_Type.
Otherwise, sets to kSimple_Type.

#Param rect  bounds of rounded rectangle ##
#Param xRad  x-axis radius of corners ##
#Param yRad  y-axis radius of corners ##

#Example
#Height 70
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRectXY({30, 10, 100, 60}, 20, 20);
    canvas->drawRRect(rrect, paint);
    rrect.setRectXY(rrect.getBounds(), 5, 5);
    paint.setColor(SK_ColorWHITE);
    paint.setBlendMode(SkBlendMode::kExclusion);
    canvas->drawRRect(rrect, paint);
##

#SeeAlso MakeRectXY SkPath::addRoundRect

#Method ##

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

#Method void setNinePatch(const SkRect& rect, SkScalar leftRad, SkScalar topRad,
                      SkScalar rightRad, SkScalar bottomRad)
#In Set
#Line # replaces with rounded rectangle ##

Sets bounds to rect. Sets radii to (leftRad, topRad), (rightRad, topRad),
(rightRad, bottomRad), (leftRad, bottomRad).

If rect is empty, sets to kEmpty_Type.
Otherwise, if leftRad and rightRad are zero, sets to kRect_Type.
Otherwise, if topRad and bottomRad are zero, sets to kRect_Type.
Otherwise, if leftRad and rightRad are equal and at least half rect.width(), and
topRad and bottomRad are equal at least half rect.height(), sets to kOval_Type.
Otherwise, if leftRad and rightRad are equal, and topRad and bottomRad are equal,
sets to kSimple_Type. Otherwise, sets to kNinePatch_Type.

Nine patch refers to the nine parts defined by the radii: one center rectangle,
four edge patches, and four corner patches.

#Param rect  bounds of rounded rectangle ##
#Param leftRad  left-top and left-bottom x-axis radius ##
#Param topRad  left-top and right-top y-axis radius ##
#Param rightRad  right-top and right-bottom x-axis radius ##
#Param bottomRad  left-bottom and right-bottom y-axis radius ##

#Example
#Height 70
    SkPaint paint;
    paint.setAntiAlias(true);
    SkRRect rrect;
    rrect.setNinePatch({30, 10, 100, 60}, 10, 20, 20, 10);
    canvas->drawRRect(rrect, paint);
    paint.setColor(SK_ColorWHITE);
    const SkRect r = rrect.getBounds();
    canvas->drawLine(r.fLeft, r.fTop + rrect.radii(SkRRect::kUpperLeft_Corner).fY,
                     r.fRight, r.fTop + rrect.radii(SkRRect::kUpperRight_Corner).fY, paint);
    canvas->drawLine(r.fLeft, r.fBottom - rrect.radii(SkRRect::kLowerLeft_Corner).fY,
                     r.fRight, r.fBottom - rrect.radii(SkRRect::kLowerRight_Corner).fY, paint);
    canvas->drawLine(r.fLeft + rrect.radii(SkRRect::kUpperLeft_Corner).fX, r.fTop,
                     r.fLeft + rrect.radii(SkRRect::kLowerLeft_Corner).fX, r.fBottom, paint);
    canvas->drawLine(r.fRight - rrect.radii(SkRRect::kUpperRight_Corner).fX, r.fTop,
                     r.fRight - rrect.radii(SkRRect::kLowerRight_Corner).fX, r.fBottom, paint);
##

#SeeAlso setRectRadii

#Method ##

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

#Method void setRectRadii(const SkRect& rect, const SkVector radii[4])
#In Set
#Line # replaces with rounded rectangle ##

Sets bounds to rect. Sets radii array for individual control of all for corners.

If rect is empty, sets to kEmpty_Type.
Otherwise, if one of each corner radii are zero, sets to kRect_Type.
Otherwise, if all x-axis radii are equal and at least half rect.width(), and
all y-axis radii are equal at least half rect.height(), sets to kOval_Type.
Otherwise, if all x-axis radii are equal, and all y-axis radii are equal,
sets to kSimple_Type. Otherwise, sets to kNinePatch_Type.

#Param rect  bounds of rounded rectangle ##
#Param radii  corner x-axis and y-axis radii ##

#Example
#Height 128
    SkPaint paint;
    paint.setStrokeWidth(15);
    paint.setStrokeCap(SkPaint::kSquare_Cap);
    paint.setAntiAlias(true);
    float intervals[] = { 5, 21.75f };
    paint.setStyle(SkPaint::kStroke_Style);
    paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
    SkPath path;
    SkRRect rrect;
    SkVector corners[] = {{15, 17}, {17, 19}, {19, 15}, {15, 15}};
    rrect.setRectRadii({20, 20, 100, 100}, corners);
    path.addRRect(rrect, SkPath::kCW_Direction);
    canvas->drawPath(path, paint);
    path.rewind();
    path.addRRect(rrect, SkPath::kCCW_Direction, 1);
    canvas->translate(120, 0);
    canvas->drawPath(path, paint);
##

#SeeAlso setNinePatch SkPath::addRoundRect

#Method ##

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

#Enum Corner
#Line # corner radii order ##

#Code
    enum Corner {
        kUpperLeft_Corner,
        kUpperRight_Corner,
        kLowerRight_Corner,
        kLowerLeft_Corner,
    };
##

The radii are stored: top-left, top-right, bottom-right, bottom-left.

#Const kUpperLeft_Corner 0
#Line # index of top-left corner radii ##
##
#Const kUpperRight_Corner 1
#Line # index of top-right corner radii ##
##
#Const kLowerRight_Corner 2
#Line # index of bottom-right corner radii ##
##
#Const kLowerLeft_Corner 3
#Line # index of bottom-left corner radii ##
##

#Example
#Height 70
    SkPaint paint;
    paint.setAntiAlias(true);
    SkRRect rrect;
    SkVector corners[] = {{25, 17}, {17, 19}, {19, 15}, {15, 15}};
    rrect.setRectRadii({30, 10, 100, 60}, corners);
    canvas->drawRRect(rrect, paint);
    paint.setColor(SK_ColorWHITE);
    const SkRect r = rrect.getBounds();
    canvas->drawLine(r.fLeft, r.fTop + rrect.radii(SkRRect::kUpperLeft_Corner).fY,
                     r.fRight, r.fTop + rrect.radii(SkRRect::kUpperRight_Corner).fY, paint);
    canvas->drawLine(r.fLeft, r.fBottom - rrect.radii(SkRRect::kLowerLeft_Corner).fY,
                     r.fRight, r.fBottom - rrect.radii(SkRRect::kLowerRight_Corner).fY, paint);
    canvas->drawLine(r.fLeft + rrect.radii(SkRRect::kUpperLeft_Corner).fX, r.fTop,
                     r.fLeft + rrect.radii(SkRRect::kLowerLeft_Corner).fX, r.fBottom, paint);
    canvas->drawLine(r.fRight - rrect.radii(SkRRect::kUpperRight_Corner).fX, r.fTop,
                     r.fRight - rrect.radii(SkRRect::kLowerRight_Corner).fX, r.fBottom, paint);
##

#SeeAlso radii

#Enum ##

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

#Method const SkRect& rect() const
#In Property
#Line # returns bounds ##
Returns bounds. Bounds may have zero width or zero height. Bounds right is
greater than or equal to left; bounds bottom is greater than or equal to top.
Result is identical to getBounds.

#Return bounding box ##

#Example
    for (SkScalar left : { SK_ScalarNaN, SK_ScalarInfinity, 100.f, 50.f, 25.f} ) {
        SkRRect rrect1 = SkRRect::MakeRectXY({left, 20, 60, 220}, 50, 200);
        SkDebugf("left bounds: (%g) %g\n", left, rrect1.rect().fLeft);
    }
#StdOut
left bounds: (nan) 0
left bounds: (inf) 0
left bounds: (100) 60
left bounds: (50) 50
left bounds: (25) 25
##
##

#SeeAlso getBounds

#Method ##

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

#Method SkVector radii(Corner corner) const
#In Property
#Line # returns x-axis and y-axis radii for one corner ##
Returns Scalar pair for radius of curve on x-axis and y-axis for one corner.
Both radii may be zero. If not zero, both are positive and finite.


#Param corner  one of: kUpperLeft_Corner, kUpperRight_Corner,
                       kLowerRight_Corner, kLowerLeft_Corner 
##

#Return x-axis and y-axis radii for one corner ##

#Example
#Description
Finite values are scaled proportionately to fit; other values are set to zero.
Scaled values cannot be larger than 25, half the bounding Round_Rect width.
Small scaled values are halved to scale in proportion to the y-axis corner
radius, which is twice the bounds height.
##
    for (SkScalar radiusX : { SK_ScalarNaN, SK_ScalarInfinity, 100.f, 50.f, 25.f} ) {
        SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, radiusX, 200);
        SkDebugf("left corner: (%g) %g\n", radiusX, rrect1.radii(SkRRect::kUpperLeft_Corner).fX);
    }
#StdOut
left corner: (nan) 0
left corner: (inf) 0
left corner: (100) 25
left corner: (50) 25
left corner: (25) 12.5
##
##

#SeeAlso Corner

#Method ##

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

#Method const SkRect& getBounds() const
#In Property
#Line # returns bounds ##
Returns bounds. Bounds may have zero width or zero height. Bounds right is
greater than or equal to left; bounds bottom is greater than or equal to top.
Result is identical to rect().

#Return bounding box ##

#Example
#Height 120
    SkPaint paint;
    SkRRect rrect = SkRRect::MakeRectXY({20, 20, 220, 100}, 15, 15);
    canvas->drawRRect(rrect, paint);
    paint.setColor(SK_ColorWHITE);
    rrect = SkRRect::MakeOval(rrect.getBounds());
    canvas->drawRRect(rrect, paint);
##

#SeeAlso rect

#Method ##

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

#Method bool operator==(const SkRRect& a, const SkRRect& b)
#In Operator
#Line # returns true if members are equal ##
Returns true if bounds and radii in a are equal to bounds and radii 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 bounds and radii to compare ##
#Param b  Rect bounds and radii to compare ##

#Return true if members are equal ##

#Example
    SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, 50, 200);
    SkRRect rrect2 = SkRRect::MakeRectXY(rrect1.rect(), 25, 100);
    SkRRect rrect3 = SkRRect::MakeOval(rrect1.rect());
    canvas->drawRRect(rrect1, SkPaint());
    std::string str = "rrect1 " + std::string(rrect1 == rrect2 ? "=" : "!") + "= rrect2";
    canvas->drawString(str.c_str(), 10, 240, SkPaint());
    canvas->translate(70, 0);
    canvas->drawRRect(rrect2, SkPaint());
    canvas->translate(70, 0);
    canvas->drawRRect(rrect3, SkPaint());
    str = "rrect2 " + std::string(rrect2 == rrect3 ? "=" : "!") + "= rrect3";
    canvas->drawString(str.c_str(), -20, 240, SkPaint());
##

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

#Method ##

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

#Method bool operator!=(const SkRRect& a, const SkRRect& b)
#In Operator
#Line # returns true if members are unequal ##
Returns true if bounds and radii in a are not equal to bounds and radii 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 bounds and radii to compare ##
#Param b  Rect bounds and radii to compare ##

#Return true if members are not equal ##

#Example
    SkRRect rrect1 = SkRRect::MakeRectXY({10, 20, 60, 220}, 50, 100);
    SkRRect rrect2 = SkRRect::MakeRectXY(rrect1.rect(), 50, 50);
    SkRRect rrect3 = SkRRect::MakeOval(rrect1.rect());
    canvas->drawRRect(rrect1, SkPaint());
    std::string str = "rrect1 " + std::string(rrect1 == rrect2 ? "=" : "!") + "= rrect2";
    canvas->drawString(str.c_str(), 10, 240, SkPaint());
    canvas->translate(70, 0);
    canvas->drawRRect(rrect2, SkPaint());
    canvas->translate(70, 0);
    canvas->drawRRect(rrect3, SkPaint());
    str = "rrect2 " + std::string(rrect2 == rrect3 ? "=" : "!") + "= rrect3";
    canvas->drawString(str.c_str(), -20, 240, SkPaint());
##

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

#Method ##

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

#Method void inset(SkScalar dx, SkScalar dy, SkRRect* dst) const
#In Inset_Outset_Offset
#Line # insets bounds and radii ##

Copies Round_Rect to dst, then insets dst bounds by dx and dy, and adjusts dst
radii by dx and dy. dx and dy may be positive, negative, or zero. dst may be
Round_Rect.

If either corner radius is zero, the corner has no curvature and is unchanged.
Otherwise, if adjusted radius becomes negative, pins radius to zero.
If dx exceeds half dst bounds width, dst bounds left and right are set to 
bounds x-axis center. If dy exceeds half dst bounds height, dst bounds top and
bottom are set to bounds y-axis center.

If dx or dy cause the bounds to become infinite, dst bounds is zeroed.

#Param dx  added to rect().fLeft, and subtracted from rect().fRight ##
#Param dy  added to rect().fTop, and subtracted from rect().fBottom ##
#Param dst  insets bounds and radii ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);
    for (int index = 0; index < 25; ++index) {
       canvas->drawRRect(rrect, paint);
       rrect.inset(-3, 3, &rrect);
    }
##

#SeeAlso outset offset makeOffset

#Method ##

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

#Method void inset(SkScalar dx, SkScalar dy)
#In Inset_Outset_Offset
#Line # insets bounds and radii ##
Insets bounds by dx and dy, and adjusts radii by dx and dy. dx and dy may be
positive, negative, or zero.

If either corner radius is zero, the corner has no curvature and is unchanged.
Otherwise, if adjusted radius becomes negative, pins radius to zero.
If dx exceeds half bounds width, bounds left and right are set to 
bounds x-axis center. If dy exceeds half bounds height, bounds top and
bottom are set to bounds y-axis center.

If dx or dy cause the bounds to become infinite, bounds is zeroed.

#Param dx  added to rect().fLeft, and subtracted from rect().fRight ##
#Param dy  added to rect().fTop, and subtracted from rect().fBottom ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkRRect rrect = SkRRect::MakeRectXY({10, 20, 180, 220}, 50, 100);
    for (int index = 0; index < 25; ++index) {
       canvas->drawRRect(rrect, paint);
       rrect.inset(3, 3);
    }
##

#SeeAlso outset offset makeOffset


#Method ##

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

#Method void outset(SkScalar dx, SkScalar dy, SkRRect* dst) const
#In Inset_Outset_Offset
#Line # outsets bounds and radii ##

Outsets dst bounds by dx and dy, and adjusts radii by dx and dy. dx and dy may be
positive, negative, or zero.

If either corner radius is zero, the corner has no curvature and is unchanged.
Otherwise, if adjusted radius becomes negative, pins radius to zero.
If dx exceeds half dst bounds width, dst bounds left and right are set to 
bounds x-axis center. If dy exceeds half dst bounds height, dst bounds top and
bottom are set to bounds y-axis center.

If dx or dy cause the bounds to become infinite, dst bounds is zeroed.

#Param dx  subtracted from rect().fLeft, and added to rect().fRight ##
#Param dy  subtracted from rect().fTop, and added to rect().fBottom ##
#Param dst  outset bounds and radii ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);
    for (int index = 0; index < 25; ++index) {
       canvas->drawRRect(rrect, paint);
       rrect.outset(-3, 3, &rrect);
    }
##

#SeeAlso inset offset makeOffset


#Method ##

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

#Method void outset(SkScalar dx, SkScalar dy)
#In Inset_Outset_Offset
#Line # outsets bounds and radii ##

Outsets bounds by dx and dy, and adjusts radii by dx and dy. dx and dy may be
positive, negative, or zero.

If either corner radius is zero, the corner has no curvature and is unchanged.
Otherwise, if adjusted radius becomes negative, pins radius to zero.
If dx exceeds half bounds width, bounds left and right are set to 
bounds x-axis center. If dy exceeds half bounds height, bounds top and
bottom are set to bounds y-axis center.

If dx or dy cause the bounds to become infinite, bounds is zeroed.

#Param dx  subtracted from rect().fLeft, and added to rect().fRight ##
#Param dy  subtracted from rect().fTop, and added to rect().fBottom ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);
    for (int index = 0; index < 25; ++index) {
       canvas->drawRRect(rrect, paint);
       rrect.outset(3, 3);
    }
##

#SeeAlso inset offset makeOffset

#Method ##

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

#Method void offset(SkScalar dx, SkScalar dy)
#In Inset_Outset_Offset
#Line # offsets bounds and radii ##

Translates Round_Rect by (dx, dy).

#Param dx  offset added to rect().fLeft and rect().fRight ##
#Param dy  offset added to rect().fTop and rect().fBottom ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);
    for (int index = 0; index < 25; ++index) {
       canvas->drawRRect(rrect, paint);
       rrect.offset(3, 3);
    }
##

#SeeAlso makeOffset inset outset

#Method ##

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

#Method SkRRect SK_WARN_UNUSED_RESULT makeOffset(SkScalar dx, SkScalar dy) const
#In Inset_Outset_Offset
#Line # offsets bounds and radii ##

Returns Round_Rect translated by (dx, dy).

#Param dx  offset added to rect().fLeft and rect().fRight ##
#Param dy  offset added to rect().fTop and rect().fBottom ##

#Return Round_Rect bounds offset by (dx, dy), with unchanged corner radii ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkRRect rrect = SkRRect::MakeRectXY({100, 20, 140, 220}, 50, 100);
    for (int index = 0; index < 25; ++index) {
       canvas->drawRRect(rrect, paint);
       rrect = rrect.makeOffset(-3, 3);
    }
##

#SeeAlso offset inset outset

#Method ##

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

#Method bool contains(const SkRect& rect) const
#In Intersection
#Line # returns true if Rect is inside ##

Returns true if rect is inside the bounds and corner radii, and if
Round_Rect and rect are not empty.

#Param rect  area tested for containment ##

#Return true if Round_Rect contains rect ##

#Example
#Height 110
    SkRect test = {10, 10, 110, 80};
    SkRRect rrect = SkRRect::MakeRect(test);
    SkRRect oval = SkRRect::MakeOval(test);
    test.inset(10, 10);
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    canvas->drawString(rrect.contains(test) ? "contains" : "does not contain", 55, 100, paint);
    canvas->drawString(oval.contains(test) ? "contains" : "does not contain", 185, 100, paint);    
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRRect(rrect, paint);
    canvas->drawRect(test, paint);
    canvas->translate(120, 0);
    canvas->drawRRect(oval, paint);
    canvas->drawRect(test, paint);
##

#SeeAlso SkRect::contains

#Method ##

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

#Method bool isValid() const
#In Utility
#Line # returns if type() matches bounds and radii  ##
Returns true if bounds and radii values are finite and describe a Round_Rect
Type that matches getType. All Round_Rect methods construct valid types,
even if the input values are not valid. Invalid Round_Rect data can only
be generated by corrupting memory.

#Return true if bounds and radii match type() ##

#Example
#Height 110
    SkRRect rrect = SkRRect::MakeRect({10, 10, 110, 80});
    SkRRect corrupt = rrect;
    *((float*) &corrupt) = 120;
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    canvas->drawString(rrect.isValid() ? "is valid" : "is corrupted", 55, 100, paint);
    canvas->drawString(corrupt.isValid() ? "is valid" : "is corrupted", 185, 100, paint);    
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRRect(rrect, paint);
    canvas->translate(120, 0);
    canvas->drawRRect(corrupt, paint);
##

#SeeAlso Type getType

#Method ##

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

#Const kSizeInMemory 48
#Line # storage space for Round_Rect ##

Space required to serialize SkRRect into a buffer. Always a multiple of four.

#Const ##

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

#Method size_t writeToMemory(void* buffer) const
#In Utility
#Line # writes Round_Rect to buffer ##

Writes Round_Rect to buffer. Writes kSizeInMemory bytes, and returns
kSizeInMemory, the number of bytes written.

#Param buffer  storage for Round_Rect ##

#Return bytes written, kSizeInMemory ##

#Example
#Height 110
    SkRRect rrect = SkRRect::MakeRect({10, 10, 110, 80});
    char storage[SkRRect::kSizeInMemory];
    rrect.writeToMemory(storage);
    SkRRect copy;
    copy.readFromMemory(storage, sizeof(storage));
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    canvas->drawString("rrect", 55, 100, paint);
    canvas->drawString("copy", 185, 100, paint);    
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRRect(rrect, paint);
    canvas->translate(120, 0);
    canvas->drawRRect(copy, paint);
##

#SeeAlso readFromMemory

#Method ##

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

#Method size_t readFromMemory(const void* buffer, size_t length)
#In Utility
#Line # reads Round_Rect from buffer ##

Reads Round_Rect from buffer, reading kSizeInMemory bytes.
Returns kSizeInMemory, bytes read if length is at least kSizeInMemory.
Otherwise, returns zero.

#Param buffer  memory to read from ##
#Param length  size of buffer ##

#Return  bytes read, or 0 if length is less than kSizeInMemory
##

#Example
#Height 110
    SkVector radii[] = {{5, 5},  {10, 10}, {15, 15}, {5, 5}};
    SkRRect rrect;
    rrect.setRectRadii({10, 10, 110, 80}, radii);
    char storage[SkRRect::kSizeInMemory];
    rrect.writeToMemory(storage);
    SkRRect copy;
    copy.readFromMemory(storage, sizeof(storage));
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    canvas->drawString("rrect", 55, 100, paint);
    canvas->drawString("copy", 185, 100, paint);    
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRRect(rrect, paint);
    canvas->translate(120, 0);
    canvas->drawRRect(copy, paint);
##

#SeeAlso writeToMemory

#Method ##

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

#Method bool transform(const SkMatrix& matrix, SkRRect* dst) const
#In Inset_Outset_Offset
#Line # scales and offsets into copy ##

Transforms by Round_Rect by matrix, storing result in dst.
Returns true if Round_Rect transformed can be represented by another Round_Rect.
Returns false if matrix contains transformations other than scale and translate.

Asserts in debug builds if Round_Rect equals dst.

#Param matrix  SkMatrix specifying the transform ##
#Param dst  SkRRect to store the result ##

#Return  true if transformation succeeded.
##

#Example
#Height 110
    SkVector radii[] = {{5, 5},  {10, 10}, {15, 15}, {5, 5}};
    SkRRect rrect;
    rrect.setRectRadii({10, 10, 110, 80}, radii);
    SkRRect transformed;
    SkMatrix matrix = SkMatrix::MakeRectToRect(rrect.rect(), {140, 30, 220, 80},
                                               SkMatrix::kCenter_ScaleToFit);
    bool success = rrect.transform(matrix, &transformed);
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextAlign(SkPaint::kCenter_Align);
    canvas->drawString("rrect", 55, 100, paint);
    canvas->drawString(success ? "transformed" : "transform failed", 185, 100, paint);    
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRRect(rrect, paint);
    canvas->drawRRect(transformed, paint);
##

#SeeAlso SkPath::transform

#Method ##

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

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

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

#Example
SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3});
for (bool dumpAsHex : { false, true } ) {
    rrect.dump(dumpAsHex);
}
#StdOut
SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f);
const SkPoint corners[] = {
    { 0, 0 },
    { 0, 0 },
    { 0, 0 },
    { 0, 0 },
};
SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab), /* 0.666667 */
                 SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab)  /* 0.666667 */);
const SkPoint corners[] = {
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
};
##
##

#SeeAlso dumpHex SkRect::dump SkPath::dump SkPathMeasure::dump

#Method ##

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

#Method void dump() const
#In Utility
#Line # sends text representation using floats to standard output ##
Writes text representation of Round_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
Round_Rect from output.

#Example
SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3});
rrect.dump();
SkRect bounds = SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f);
const SkPoint corners[] = {
    { 0, 0 },
    { 0, 0 },
    { 0, 0 },
    { 0, 0 },
};
SkRRect copy;
copy.setRectRadii(bounds, corners);
SkDebugf("rrect is " "%s" "equal to copy\n", rrect == copy ? "" : "not ");
#StdOut
SkRect::MakeLTRB(0.857143f, 0.666667f, 0.857143f, 0.666667f);
const SkPoint corners[] = {
    { 0, 0 },
    { 0, 0 },
    { 0, 0 },
    { 0, 0 },
};
rrect is not equal to copy
##
##

#SeeAlso dumpHex SkRect::dump SkPath::dump SkPathMeasure::dump

#Method ##

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

#Method void dumpHex() const
#In Utility
#Line # sends text representation using hexadecimal to standard output ##
Writes text representation of Round_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 Round_Rect.

#Example
SkRRect rrect = SkRRect::MakeRect({6.f / 7, 2.f / 3, 6.f / 7, 2.f / 3});
rrect.dumpHex();
SkRect bounds = SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab), /* 0.666667 */
                 SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab)  /* 0.666667 */);
const SkPoint corners[] = {
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
};
SkRRect copy;
copy.setRectRadii(bounds, corners);
SkDebugf("rrect is " "%s" "equal to copy\n", rrect == copy ? "" : "not ");
#StdOut
SkRect::MakeLTRB(SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab), /* 0.666667 */
                 SkBits2Float(0x3f5b6db7), /* 0.857143 */
                 SkBits2Float(0x3f2aaaab)  /* 0.666667 */);
const SkPoint corners[] = {
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
    { SkBits2Float(0x00000000), SkBits2Float(0x00000000) }, /* 0.000000 0.000000 */
};
rrect is equal to copy
##
##

#SeeAlso dump SkRect::dumpHex SkPath::dumpHex

#Method ##

#Class SkRRect ##

#Topic RRect ##