huangcm
2025-02-24 69ed55dec4b2116a19e4cca4393cbc014fce5fb2
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
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
#Topic Paint
#Alias Paint_Reference ##
 
#Class SkPaint
 
#Code
#Populate
##
 
Paint controls options applied when drawing and measuring. Paint collects all
options outside of the Canvas_Clip and Canvas_Matrix.
 
Various options apply to text, strokes and fills, and images.
 
Some options may not be implemented on all platforms; in these cases, setting
the option has no effect. Some options are conveniences that duplicate Canvas
functionality; for instance, text size is identical to matrix scale.
 
Paint options are rarely exclusive; each option modifies a stage of the drawing
pipeline and multiple pipeline stages may be affected by a single Paint.
 
Paint collects effects and filters that describe single-pass and multiple-pass
algorithms that alter the drawing geometry, color, and transparency. For instance,
Paint does not directly implement dashing or blur, but contains the objects that do so.
 
The objects contained by Paint are opaque, and cannot be edited outside of the Paint
to affect it. The implementation is free to defer computations associated with the
Paint, or ignore them altogether. For instance, some GPU implementations draw all
Path geometries with Anti_Aliasing, regardless of how SkPaint::kAntiAlias_Flag
is set in Paint.
 
Paint describes a single color, a single font, a single image quality, and so on.
Multiple colors are drawn either by using multiple paints or with objects like
Shader attached to Paint.
 
#Method SkPaint()
#Line # constructs with default values ##
Constructs Paint with default values.
 
#Table
#Legend
# attribute              # default value            ##
#Legend ##
# Anti_Alias             # false                    ##
# Blend_Mode             # SkBlendMode::kSrcOver    ##
# Color                  # SK_ColorBLACK            ##
# Color_Alpha            # 255                      ##
# Color_Filter           # nullptr                  ##
# Dither                 # false                    ##
# Draw_Looper            # nullptr                  ##
# Filter_Quality         # kNone_SkFilterQuality    ##
# Image_Filter           # nullptr                  ##
# Miter_Limit            # 4                        ##
# Mask_Filter            # nullptr                  ##
# Path_Effect            # nullptr                  ##
# Shader                 # nullptr                  ##
# Style                  # kFill_Style              ##
# Stroke_Cap             # kButt_Cap                ##
# Stroke_Join            # kMiter_Join              ##
# Stroke_Width           # 0                        ##
#Table ##
 
The miter limit may be overridden at compile time by defining
paint default values. The overrides may be included in "SkUserConfig.h" or predefined by the
build system.
 
#Return  default initialized Paint ##
 
#Example
#ToDo mark this as no output ##
#Height 1
###$  $ redefine markup character so preprocessor commands appear normally
#ifndef SkUserConfig_DEFINED
#define SkUserConfig_DEFINED
 
#define SkPaintDefaults_Flags      0x01   // always enable antialiasing
#define SkPaintDefaults_TextSize   24.f   // double default font size
#define SkPaintDefaults_Hinting    3      // use full hinting
#define SkPaintDefaults_MiterLimit 10.f   // use HTML Canvas miter limit setting
 
#endif
$$$#  # restore original markup character
##
 
 
##
 
#Method SkPaint(const SkPaint& paint)
#Line # makes a shallow copy ##
#Populate
 
#Example
#ToDo why is this double-spaced on Fiddle? ##
    SkPaint paint1;
    paint1.setColor(SK_ColorRED);
    SkPaint paint2(paint1);
    paint2.setColor(SK_ColorBLUE);
    SkDebugf("SK_ColorRED %c= paint1.getColor()\n", SK_ColorRED == paint1.getColor() ? '=' : '!');
    SkDebugf("SK_ColorBLUE %c= paint2.getColor()\n", SK_ColorBLUE == paint2.getColor() ? '=' : '!');
 
    #StdOut
        SK_ColorRED == paint1.getColor()
        SK_ColorBLUE == paint2.getColor()
    ##
##
 
##
 
#Method SkPaint(SkPaint&& paint)
#Line # moves paint without copying it ##
#Populate
 
#Example
        SkPaint paint;
        float intervals[] = { 5, 5 };
        paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 2.5f));
        SkPaint dashed(std::move(paint));
        SkDebugf("path effect unique: %s\n", dashed.getPathEffect()->unique() ? "true" : "false");
 
        #StdOut
            path effect unique: true
        ##
    ##
 
##
 
# ------------------------------------------------------------------------------
 
#Method void reset()
#In Constructors
#Line # sets to default values ##
#Populate
 
#Example
    SkPaint paint1, paint2;
    paint1.setColor(SK_ColorRED);
    paint1.reset();
    SkDebugf("paint1 %c= paint2", paint1 == paint2 ? '=' : '!');
 
    #StdOut
        paint1 == paint2
    ##
##
 
##
 
# ------------------------------------------------------------------------------
 
#Method ~SkPaint()
#Line # decreases Reference_Count of owned objects ##
#Populate
 
#NoExample
##
 
##
 
 
# ------------------------------------------------------------------------------
 
#Subtopic Management
#Line # paint copying, moving, comparing ##
##
 
#Method SkPaint& operator=(const SkPaint& paint)
#In Management
#Line # makes a shallow copy ##
#Populate
 
#Example
    SkPaint paint1, paint2;
    paint1.setColor(SK_ColorRED);
    paint2 = paint1;
    SkDebugf("SK_ColorRED %c= paint1.getColor()\n", SK_ColorRED == paint1.getColor() ? '=' : '!');
    SkDebugf("SK_ColorRED %c= paint2.getColor()\n", SK_ColorRED == paint2.getColor() ? '=' : '!');
 
    #StdOut
        SK_ColorRED == paint1.getColor()
        SK_ColorRED == paint2.getColor()
    ##
##
 
##
 
# ------------------------------------------------------------------------------
 
#Method SkPaint& operator=(SkPaint&& paint)
#In Management
#Line # moves paint without copying it ##
#Populate
 
#Example
    SkPaint paint1, paint2;
    paint1.setColor(SK_ColorRED);
    paint2 = std::move(paint1);
    SkDebugf("SK_ColorRED == paint2.getColor()\n", SK_ColorRED == paint2.getColor() ? '=' : '!');
 
    #StdOut
        SK_ColorRED == paint2.getColor()
    ##
##
 
##
 
# ------------------------------------------------------------------------------
 
#Method bool operator==(const SkPaint& a, const SkPaint& b)
#Line # compares paints for equality ##
#Populate
 
#Example
        SkPaint paint1, paint2;
        paint1.setColor(SK_ColorRED);
        paint2.setColor(0xFFFF0000);
        SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
        float intervals[] = { 5, 5 };
        paint1.setPathEffect(SkDashPathEffect::Make(intervals, 2, 2.5f));
        paint2.setPathEffect(SkDashPathEffect::Make(intervals, 2, 2.5f));
        SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
 
        #StdOut
            paint1 == paint2
            paint1 != paint2
        ##
    ##
#SeeAlso operator!=(const SkPaint& a, const SkPaint& b)
##
 
# ------------------------------------------------------------------------------
 
#Method bool operator!=(const SkPaint& a, const SkPaint& b)
#Line # compares paints for inequality ##
#Populate
 
#Example
    SkPaint paint1, paint2;
    paint1.setColor(SK_ColorRED);
    paint2.setColor(0xFFFF0000);
    SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
    SkDebugf("paint1 %c= paint2\n", paint1 != paint2 ? '!' : '=');
 
    #StdOut
        paint1 == paint2
        paint1 == paint2
    ##
##
#SeeAlso operator==(const SkPaint& a, const SkPaint& b)
##
 
# ------------------------------------------------------------------------------
 
#Method uint32_t getHash() const
#In Management
#Line # returns a shallow hash for equality checks ##
#Populate
 
#Example
    SkPaint paint1, paint2;
    paint1.setColor(SK_ColorRED);
    paint2.setColor(0xFFFF0000);
    SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
    SkDebugf("paint1.getHash() %c= paint2.getHash()\n",
             paint1.getHash() == paint2.getHash() ? '=' : '!');
 
    #StdOut
        paint1 == paint2
        paint1.getHash() == paint2.getHash()
    ##
##
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Anti_Alias
#Alias Anti_Alias
#Substitute anti-alias
##
#Alias Anti_Aliased
#Substitute anti-aliased
##
#Alias Anti_Aliasing
#Substitute anti-aliasing
##
#In Related_Function
#Line # approximating coverage with transparency ##
 
Anti_Alias drawing approximates partial pixel coverage with transparency.
If kAntiAlias_Flag is clear, pixel centers contained by the shape edge are drawn opaque.
If kAntiAlias_Flag is set, pixels are drawn with Color_Alpha equal to their coverage.
 
The rule for Aliased pixels is inconsistent across platforms. A shape edge
passing through the pixel center may, but is not required to, draw the pixel.
 
Raster_Engine draws Aliased pixels whose centers are on or to the right of the start of an
active Path edge, and whose center is to the left of the end of the active Path edge.
 
#ToDo  add illustration of raster pixels ##
 
A platform may only support Anti_Aliased drawing. Some GPU-backed platforms use
Supersampling to Anti_Alias all drawing, and have no mechanism to selectively
Alias.
 
The amount of coverage computed for Anti_Aliased pixels also varies across platforms.
 
Anti_Alias is disabled by default.
Anti_Alias can be enabled by default by setting SkPaintDefaults_Flags to kAntiAlias_Flag
at compile time.
 
#Example
    #Width 512
    #Description
        A red line is drawn with transparency on the edges to make it look smoother.
        A blue line draws only where the pixel centers are contained.
        The lines are drawn into Bitmap, then drawn magnified to make the
        Aliasing easier to see.
    ##
 
    void draw(SkCanvas* canvas) {
        SkBitmap bitmap;
        bitmap.allocN32Pixels(50, 50);
        SkCanvas offscreen(bitmap);
        SkPaint paint;
        paint.setStyle(SkPaint::kStroke_Style);
        paint.setStrokeWidth(10);
        for (bool antialias : { false, true }) {
            paint.setColor(antialias ? SK_ColorRED : SK_ColorBLUE);
            paint.setAntiAlias(antialias);
            bitmap.eraseColor(0);
            offscreen.drawLine(5, 5, 15, 30, paint);
            canvas->drawLine(5, 5, 15, 30, paint);
            canvas->save();
            canvas->scale(10, 10);
            canvas->drawBitmap(bitmap, antialias ? 12 : 0, 0);
            canvas->restore();
            canvas->translate(15, 0);
        }
    }
##
#Subtopic Anti_Alias ##
 
#Method bool isAntiAlias() const
#In Anti_alias
#Line # returns true if Anti_Alias is set ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("paint.isAntiAlias() %c= !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)\n",
                paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) ? '=' : '!');
        paint.setAntiAlias(true);
        SkDebugf("paint.isAntiAlias() %c= !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)\n",
                paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag) ? '=' : '!');
 
    #StdOut
        paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
        paint.isAntiAlias() == !!(paint.getFlags() & SkPaint::kAntiAlias_Flag)
    ##
    ##
##
 
#Method void setAntiAlias(bool aa)
#In Anti_alias
#Line # sets or clears Anti_Alias ##
#Populate
 
#Example
        SkPaint paint1, paint2;
        paint1.setAntiAlias(true);
        paint2.setFlags(paint2.getFlags() | SkPaint::kAntiAlias_Flag);
        SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
 
        #StdOut
            paint1 == paint2
        ##
    ##
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Dither
#Line # distributing color error ##
 
Dither increases fidelity by adjusting the color of adjacent pixels.
This can help to smooth color transitions and reducing banding in gradients.
Dithering lessens visible banding from kRGB_565_SkColorType
and kRGBA_8888_SkColorType gradients,
and improves rendering into a kRGB_565_SkColorType Surface.
 
Dithering is always enabled for linear gradients drawing into
kRGB_565_SkColorType Surface and kRGBA_8888_SkColorType Surface.
Dither cannot be enabled for kAlpha_8_SkColorType Surface and
kRGBA_F16_SkColorType Surface.
 
Dither is disabled by default.
Dither can be enabled by default by setting SkPaintDefaults_Flags to kDither_Flag
at compile time.
 
Some platform implementations may ignore dithering. Set #Formula # SK_IGNORE_GPU_DITHER ##
to ignore Dither on GPU_Surface.
 
#Example
#Description
Dithering in the bottom half more closely approximates the requested color by
alternating nearby colors from pixel to pixel.
##
void draw(SkCanvas* canvas) {
    SkBitmap bm16;
    bm16.allocPixels(SkImageInfo::Make(32, 32, kRGB_565_SkColorType, kOpaque_SkAlphaType));
    SkCanvas c16(bm16);
    SkPaint colorPaint;
    for (auto dither : { false, true } ) {
        colorPaint.setDither(dither);
        for (auto colors : { 0xFF333333, 0xFF666666, 0xFF999999, 0xFFCCCCCC } ) {
            for (auto mask : { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFFFFFFFF } ) {
                 colorPaint.setColor(colors & mask);
                 c16.drawRect({0, 0, 8, 4}, colorPaint);
                 c16.translate(8, 0);
            }
            c16.translate(-32, 4);
        }
    }
    canvas->scale(8, 8);
    canvas->drawBitmap(bm16, 0, 0);
}
##
 
#Example
#Description
Dithering introduces subtle adjustments to color to smooth gradients.
Drawing the gradient repeatedly with SkBlendMode::kPlus exaggerates the
dither, making it easier to see.
##
void draw(SkCanvas* canvas) {
    canvas->clear(0);
    SkBitmap bm32;
    bm32.allocPixels(SkImageInfo::Make(20, 10, kN32_SkColorType, kPremul_SkAlphaType));
    SkCanvas c32(bm32);
    SkPoint points[] = {{0, 0}, {20, 0}};
    SkColor colors[] = {0xFF334455, 0xFF662211 };
    SkPaint paint;
    paint.setShader(SkGradientShader::MakeLinear(
                     points, colors, nullptr, SK_ARRAY_COUNT(colors),
                     SkShader::kClamp_TileMode, 0, nullptr));
    paint.setDither(true);
    c32.drawPaint(paint);
    canvas->scale(12, 12);
    canvas->drawBitmap(bm32, 0, 0);
    paint.setBlendMode(SkBlendMode::kPlus);
    canvas->drawBitmap(bm32, 0, 11, &paint);
    canvas->drawBitmap(bm32, 0, 11, &paint);
    canvas->drawBitmap(bm32, 0, 11, &paint);
}
##
#SeeAlso Gradient kRGB_565_SkColorType
#Subtopic Dither ##
 
#Method bool isDither() const
#In Dither
#Line # returns true if Dither is set ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("paint.isDither() %c= !!(paint.getFlags() & SkPaint::kDither_Flag)\n",
                paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag) ? '=' : '!');
        paint.setDither(true);
        SkDebugf("paint.isDither() %c= !!(paint.getFlags() & SkPaint::kDither_Flag)\n",
                paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag) ? '=' : '!');
 
    #StdOut
        paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
        paint.isDither() == !!(paint.getFlags() & SkPaint::kDither_Flag)
    ##
    ##
 
##
 
#Method void setDither(bool dither)
#In Dither
#Line # sets or clears Dither ##
#Populate
 
#Example
        SkPaint paint1, paint2;
        paint1.setDither(true);
        paint2.setFlags(paint2.getFlags() | SkPaint::kDither_Flag);
        SkDebugf("paint1 %c= paint2\n", paint1 == paint2 ? '=' : '!');
 
        #StdOut
            paint1 == paint2
        ##
    ##
 
    #SeeAlso kRGB_565_SkColorType
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Device_Text
#Line # increase precision of glyph position ##
 
Font_Anti_Alias and Font_Subpixel increase the precision of glyph position.
 
When set, Flags kLCDRenderText_Flag takes advantage of the organization of RGB stripes that
create a color, and relies
on the small size of the stripe and visual perception to make the color fringing imperceptible.
Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
the color components as RGB or BGR.
 
Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
As the opaqueness
of the color increases, the edge of the glyph appears to move towards the outside of the pixel.
 
Either or both techniques can be enabled.
kLCDRenderText_Flag and kSubpixelText_Flag are clear by default.
Font_Anti_Alias or Font_Subpixel can be enabled by default by setting SkPaintDefaults_Flags to
kLCDRenderText_Flag or kSubpixelText_Flag (or both) at compile time.
 
#Example
    #Description
        Four commas are drawn normally and with combinations of Font_Anti_Alias and Font_Subpixel.
        When Font_Subpixel is disabled, the comma Glyphs are identical, but not evenly spaced.
        When Font_Subpixel is enabled, the comma Glyphs are unique, but appear evenly spaced.
    ##
 
    SkBitmap bitmap;
    bitmap.allocN32Pixels(24, 33);
    SkCanvas offscreen(bitmap);
    offscreen.clear(SK_ColorWHITE);
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(20);
    for (bool lcd : { false, true }) {
        paint.setLCDRenderText(lcd);
        for (bool subpixel : { false, true }) {
            paint.setSubpixelText(subpixel);
            offscreen.drawString(",,,,", 0, 4, paint);
            offscreen.translate(0, 7);
        }
    }
    canvas->drawBitmap(bitmap, 4, 12);
    canvas->scale(9, 9);
    canvas->drawBitmap(bitmap, 4, -1);
##
#Subtopic Device_Text ##
 
#Subtopic Linear_Text
#Line # selects text rendering as Glyph or Path ##
 
Font_Linear selects whether text is rendered as a Glyph or as a Path.
If Font_Linear is set, it has the same effect as setting Hinting to SkFontHinting::kNormal.
If Font_Linear is clear, it is the same as setting Hinting to SkFontHinting::kNone.
#Subtopic Linear_Text ##
 
#Subtopic Subpixel_Text
#Line # uses pixel transparency to represent fractional offset ##
 
Flags kSubpixelText_Flag uses the pixel transparency to represent a fractional offset.
As the opaqueness
of the color increases, the edge of the glyph appears to move towards the outside of the pixel.
#Subtopic Subpixel_Text ##
 
#Subtopic LCD_Text
#Line # text relying on the order of RGB stripes ##
 
When set, Font_Anti_Alias takes advantage of the organization of RGB stripes that
create a color, and relies
on the small size of the stripe and visual perception to make the color fringing imperceptible.
Font_Anti_Alias can be enabled on devices that orient stripes horizontally or vertically, and that order
the color components as RGB or BGR.
#Subtopic LCD_Text ##
 
# ------------------------------------------------------------------------------
#Subtopic Embedded_Bitmaps
#Line # custom sized bitmap Glyphs ##
 
Font_Embedded_Bitmaps allows selecting custom sized bitmap Glyphs.
Flags kEmbeddedBitmapText_Flag when set chooses an embedded bitmap glyph over an outline contained
in a font if the platform supports this option.
 
FreeType selects the bitmap glyph if available when kEmbeddedBitmapText_Flag is set, and selects
the outline glyph if kEmbeddedBitmapText_Flag is clear.
Windows may select the bitmap glyph but is not required to do so.
OS_X and iOS do not support this option.
 
Font_Embedded_Bitmaps is disabled by default.
Font_Embedded_Bitmaps can be enabled by default by setting SkPaintDefaults_Flags to
kEmbeddedBitmapText_Flag at compile time.
 
#Example
    #ToDo image will only output on Ubuntu ... how to handle that in fiddle? ##
    #Platform !fiddle
    #Description
        The "hintgasp" TrueType font in the Skia resources/fonts directory
        includes an embedded bitmap Glyph at odd font sizes. This example works
        on platforms that use FreeType as their Font_Engine.
        Windows may, but is not required to, return a bitmap glyph if
        kEmbeddedBitmapText_Flag is set.
    ##
    #Image  embeddedbitmap.png
 
    SkBitmap bitmap;
    bitmap.allocN32Pixels(30, 15);
    bitmap.eraseColor(0);
    SkCanvas offscreen(bitmap);
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(13);
    paint.setTypeface(MakeResourceAsTypeface("fonts/hintgasp.ttf"));
    for (bool embedded : { false, true}) {
        paint.setEmbeddedBitmapText(embedded);
        offscreen.drawString("A", embedded ? 5 : 15, 15, paint);
    }
    canvas->drawBitmap(bitmap, 0, 0);
    canvas->scale(10, 10);
    canvas->drawBitmap(bitmap, -2, 1);
##
#Subtopic Embedded_Bitmaps ##
 
# ------------------------------------------------------------------------------
#Subtopic Automatic_Hinting
#Line # always adjust glyph paths ##
 
If Hinting is set to SkFontHinting::kNormal or SkFontHinting::kFull, Font_Force_Hinting
instructs the Font_Manager to always hint Glyphs.
Font_Force_Hinting has no effect if Hinting is set to SkFontHinting::kNone or
SkFontHinting::kSlight.
 
Font_Force_Hinting only affects platforms that use FreeType as the Font_Manager.
#Subtopic Automatic_Hinting ##
 
# ------------------------------------------------------------------------------
 
#Subtopic Fake_Bold
#Line # approximate font styles ##
 
Font_Embolden approximates the bold font style accompanying a normal font when a bold font face
is not available. Skia does not provide font substitution; it is up to the client to find the
bold font face using the platform Font_Manager.
 
Use Text_Skew_X to approximate an italic font style when the italic font face
is not available.
 
A FreeType based port may define SK_USE_FREETYPE_EMBOLDEN at compile time to direct
the font engine to create the bold Glyphs. Otherwise, the extra bold is computed
by increasing the stroke width and setting the Style to kStrokeAndFill_Style as needed.
 
Font_Embolden is disabled by default.
 
#Example
#Height 128
void draw(SkCanvas* canvas) {
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(40);
    canvas->drawString("OjYy_-", 10, 35, paint);
    paint.setFakeBoldText(true);
    canvas->drawString("OjYy_-", 10, 75, paint);
    // create a custom fake bold by varying the stroke width
    paint.setFakeBoldText(false);
    paint.setStyle(SkPaint::kStrokeAndFill_Style);
    paint.setStrokeWidth(40.f / 48);
    canvas->drawString("OjYy_-", 10, 115, paint);
}
##
#Subtopic Fake_Bold ##
 
# ------------------------------------------------------------------------------
#Subtopic Filter_Quality_Methods
#Line # get and set Filter_Quality ##
 
Filter_Quality trades speed for image filtering when the image is scaled.
A lower Filter_Quality draws faster, but has less fidelity.
A higher Filter_Quality draws slower, but looks better.
If the image is drawn without scaling, the Filter_Quality choice will not result
in a noticeable difference.
 
Filter_Quality is used in Paint passed as a parameter to
#List
# SkCanvas::drawBitmap ##
# SkCanvas::drawBitmapRect ##
# SkCanvas::drawImage ##
# SkCanvas::drawImageRect ##
  #ToDo probably more... ##
#List ##
and when Paint has a Shader specialization that uses Image or Bitmap.
 
Filter_Quality is kNone_SkFilterQuality by default.
 
#Example
#Image 3
void draw(SkCanvas* canvas) {
    SkPaint paint;
    canvas->scale(.2f, .2f);
    for (SkFilterQuality q : { kNone_SkFilterQuality, kLow_SkFilterQuality,
                               kMedium_SkFilterQuality, kHigh_SkFilterQuality } ) {
        paint.setFilterQuality(q);
        canvas->drawImage(image.get(), 0, 0, &paint);
        canvas->translate(550, 0);
        if (kLow_SkFilterQuality == q) canvas->translate(-1100, 550);
    }
}
##
#Subtopic Filter_Quality_Methods ##
 
#Method SkFilterQuality getFilterQuality() const
#In Filter_Quality_Methods
#Line # returns Filter_Quality, image filtering level ##
#Populate
 
#Example
    SkPaint paint;
    SkDebugf("kNone_SkFilterQuality %c= paint.getFilterQuality()\n",
            kNone_SkFilterQuality == paint.getFilterQuality() ? '=' : '!');
 
    #StdOut
        kNone_SkFilterQuality == paint.getFilterQuality()
    ##
##
 
##
 
 
#Method void setFilterQuality(SkFilterQuality quality)
#In Filter_Quality_Methods
#Line # sets Filter_Quality, the image filtering level ##
#Populate
 
#Example
    SkPaint paint;
    paint.setFilterQuality(kHigh_SkFilterQuality);
    SkDebugf("kHigh_SkFilterQuality %c= paint.getFilterQuality()\n",
            kHigh_SkFilterQuality == paint.getFilterQuality() ? '=' : '!');
 
    #StdOut
        kHigh_SkFilterQuality == paint.getFilterQuality()
    ##
##
 
#SeeAlso SkFilterQuality Image_Scaling
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Color_Methods
#Line # get and set Color ##
 
#Table
#Legend
# name                  # description                                          ##
#Legend ##
# getColor              # returns Color_Alpha and RGB, one drawing color ##
# setColor              # sets Color_Alpha and RGB, one drawing color    ##
#Table ##
 
Color specifies the red, blue, green, and Color_Alpha
values used to draw a filled or stroked shape in a 32-bit value. Each component
occupies 8-bits, ranging from zero: no contribution; to 255: full intensity.
All values in any combination are valid.
 
Color is not Premultiplied; Color_Alpha sets the transparency independent of
RGB: red, blue, and green.
 
The bit positions of Color_Alpha and RGB are independent of the bit
positions on the output device, which may have more or fewer bits, and may have
a different arrangement.
 
#Table
#Legend
# bit positions # Color_Alpha # red # blue # green ##
#Legend ##
#               # 31 - 24     # 23 - 16       # 15 - 8         # 7 - 0           ##
#Table ##
 
#Example
#Height 128
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        paint.setColor(0x8000FF00);  // transparent green
        canvas->drawCircle(50, 50, 40, paint);
        paint.setARGB(128, 255, 0, 0); // transparent red
        canvas->drawCircle(80, 50, 40, paint);
        paint.setColor(SK_ColorBLUE);
        paint.setAlpha(0x80);
        canvas->drawCircle(65, 65, 40, paint);
    }
##
#Subtopic Color_Methods ##
 
#Method SkColor getColor() const
#In Color_Methods
#Line # returns Color_Alpha and RGB, one drawing color ##
#Populate
 
#Example
        SkPaint paint;
        paint.setColor(SK_ColorYELLOW);
        SkColor y = paint.getColor();
        SkDebugf("Yellow is %d%% red, %d%% green, and %d%% blue.\n", (int) (SkColorGetR(y) / 2.55f),
                (int) (SkColorGetG(y) / 2.55f), (int) (SkColorGetB(y) / 2.55f));
 
        #StdOut
            Yellow is 100% red, 100% green, and 0% blue.
        ##
    ##
 
    #SeeAlso getColor4f SkColor
 
##
 
#Method SkColor4f getColor4f() const
#In Color_Methods
#Line # returns Color_Alpha and RGB, one drawing color ##
#Populate
 
#Example
        SkPaint paint;
        paint.setColor(SK_ColorYELLOW);
        SkColor4f y = paint.getColor4f();
        SkDebugf("Yellow is %d%% red, %d%% green, and %d%% blue.\n", (int) (y.fR * 100),
                (int) (y.fG * 100), (int) (y.fB * 100));
 
        #StdOut
            Yellow is 100% red, 100% green, and 0% blue.
        ##
    ##
 
    #SeeAlso getColor SkColor
##
 
 
#Method void setColor(SkColor color)
#In Color_Methods
#Line # sets Color_Alpha and RGB, one drawing color ##
#Populate
 
#Example
        SkPaint green1, green2;
        unsigned a = 255;
        unsigned r = 0;
        unsigned g = 255;
        unsigned b = 0;
        green1.setColor((a << 24) + (r << 16) + (g << 8) + (b << 0));
        green2.setColor(0xFF00FF00);
        SkDebugf("green1 %c= green2\n", green1 == green2 ? '=' : '!');
 
        #StdOut
            green1 == green2
        ##
    ##
 
    #SeeAlso SkColor setColor4f setARGB SkColorSetARGB
 
##
 
#Method void setColor4f(const SkColor4f& color, SkColorSpace* colorSpace)
#In Color_Methods
#Line # sets Color_Alpha and RGB, one drawing color ##
#Populate
 
#Example
        SkPaint green1, green2;
        green1.setColor4f({0, 1, 0, 1}, nullptr);  // R=0 G=1 B=0 A=1
        green2.setColor(0xFF00FF00); // A=255 R=0 G=255 B=0
        SkDebugf("green1 %c= green2\n", green1 == green2 ? '=' : '!');
 
        #StdOut
            green1 == green2
        ##
    ##
 
    #SeeAlso SkColor setColor setARGB SkColorSetARGB
 
##
 
#Subtopic Alpha_Methods
#Line # get and set Alpha ##
 
Color_Alpha sets the transparency independent of RGB: red, blue, and green.
#Subtopic Alpha_Methods ##
 
#Method uint8_t getAlpha() const
#In Alpha_Methods
#Line # returns Color_Alpha, color opacity ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("255 %c= paint.getAlpha()\n", 255 == paint.getAlpha() ? '=' : '!');
 
        #StdOut
            255 == paint.getAlpha()
        ##
    ##
 
##
 
#Method void setAlpha(U8CPU a)
#In Alpha_Methods
#Line # sets Color_Alpha, color opacity ##
#Populate
 
#Example
        SkPaint paint;
        paint.setColor(0x00112233);
        paint.setAlpha(0x44);
        SkDebugf("0x44112233 %c= paint.getColor()\n", 0x44112233 == paint.getColor() ? '=' : '!');
 
        #StdOut
            0x44112233 == paint.getColor()
        ##
    ##
 
##
 
#Method void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
#In Color_Methods
#Line # sets color by component ##
#Populate
 
#Example
        SkPaint transRed1, transRed2;
        transRed1.setARGB(255 / 2, 255, 0, 0);
        transRed2.setColor(SkColorSetARGB(255 / 2, 255, 0, 0));
        SkDebugf("transRed1 %c= transRed2", transRed1 == transRed2 ? '=' : '!');
 
        #StdOut
            transRed1 == transRed2
        ##
    ##
 
    #SeeAlso setColor SkColorSetARGB
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Style
#Line # geometry filling, stroking ##
 
Style specifies if the geometry is filled, stroked, or both filled and stroked.
Some shapes ignore Style and are always drawn filled or stroked.
 
#Subtopic Fill
Set Style to kFill_Style to fill the shape.
The fill covers the area inside the geometry for most shapes.
#Subtopic Fill ##
 
#Subtopic Stroke
Set Style to kStroke_Style to stroke the shape.
 
The stroke covers the area described by following the shape edge with a pen or brush of
Stroke_Width. The area covered where the shape starts and stops is described by Stroke_Cap.
The area covered where the shape turns a corner is described by Stroke_Join.
The stroke is centered on the shape; it extends equally on either side of the shape edge.
#Subtopic Stroke ##
 
As Stroke_Width gets smaller, the drawn path frame is thinner. Stroke_Width less than one
may have gaps, and if kAntiAlias_Flag is set, Color_Alpha will increase to visually decrease coverage.
 
#SeeAlso Path_Fill_Type Path_Effect Style_Fill Style_Stroke
#Subtopic Style ##
 
#Subtopic Hairline
Stroke_Width of zero has a special meaning and switches drawing to use Hairline.
Hairline draws the thinnest continuous frame. If kAntiAlias_Flag is clear, adjacent pixels
flow horizontally, vertically,or diagonally.
 
#ToDo  what is the description of Anti_Aliased hairlines? ##
 
Path drawing with Hairline may hit the same pixel more than once. For instance, Path containing
two lines in one Path_Contour will draw the corner point once, but may both lines may draw the adjacent
pixel. If kAntiAlias_Flag is set, transparency is applied twice, resulting in a darker pixel. Some
GPU-backed implementations apply transparency at a later drawing stage, avoiding double hit pixels
while stroking.
 
#SeeAlso Path_Fill_Type Path_Effect Style_Fill Style_Stroke
#Subtopic Hairline ##
 
#Enum Style
#Line # stroke, fill, or both ##
 
#Code
#Populate
##
 
#Code
#In Constant
#Filter kStyle
#Populate
##
 
Set Style to fill, stroke, or both fill and stroke geometry.
The stroke and fill
share all paint attributes; for instance, they are drawn with the same color.
 
Use kStrokeAndFill_Style to avoid hitting the same pixels twice with a stroke draw and
a fill draw.
 
#Const  kFill_Style 0
#Line # set to fill geometry ##
    Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text.
    Bitmap, Image, Patches, Region, Sprites, and Vertices are painted as if
    kFill_Style is set, and ignore the set Style.
    The Path_Fill_Type specifies additional rules to fill the area outside the path edge,
    and to create an unfilled hole inside the shape.
    Style is set to kFill_Style by default.
##
 
#Const kStroke_Style 1
#Line # set to stroke geometry ##
    Applies to Rect, Region, Round_Rect, Arcs, Circles, Ovals, Path, and Text.
    Arcs, Lines, and points, are always drawn as if kStroke_Style is set,
    and ignore the set Style.
    The stroke construction is unaffected by the Path_Fill_Type.
##
 
#Const kStrokeAndFill_Style 2
#Line # sets to stroke and fill geometry ##
    Applies to Rect, Region, Round_Rect, Circles, Ovals, Path, and Text.
    Path is treated as if it is set to SkPath::kWinding_FillType,
    and the set Path_Fill_Type is ignored.
##
 
#Const kStyleCount 3
#Line # number of different Style values defined ##
May be used to verify that Style is a legal value.
##
 
#Enum Style ##
 
#Method Style getStyle() const
#In Style
#Line # returns Style: stroke, fill, or both ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("SkPaint::kFill_Style %c= paint.getStyle()\n",
                SkPaint::kFill_Style == paint.getStyle() ? '=' : '!');
 
        #StdOut
            SkPaint::kFill_Style == paint.getStyle()
        ##
    ##
 
#SeeAlso Style setStyle
##
 
#Method void setStyle(Style style)
#In Style
#Line # sets Style: stroke, fill, or both ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setStrokeWidth(5);
            SkRegion region;
            region.op(140, 10, 160, 30, SkRegion::kUnion_Op);
            region.op(170, 40, 190, 60, SkRegion::kUnion_Op);
            SkBitmap bitmap;
            bitmap.setInfo(SkImageInfo::MakeA8(50, 50), 50);
            uint8_t pixels[50][50];
            for (int x = 0; x < 50; ++x) {
                for (int y = 0; y < 50; ++y) {
                    pixels[y][x] = (x + y) % 5 ? 0xFF : 0x00;
                }
            }
            bitmap.setPixels(pixels);
            for (auto style : { SkPaint::kFill_Style,
                                SkPaint::kStroke_Style,
                                SkPaint::kStrokeAndFill_Style }) {
                paint.setStyle(style);
                canvas->drawLine(10, 10, 60, 60, paint);
                canvas->drawRect({80, 10, 130, 60}, paint);
                canvas->drawRegion(region, paint);
                canvas->drawBitmap(bitmap, 200, 10, &paint);
                canvas->translate(0, 80);
            }
        }
    ##
 
#SeeAlso Style getStyle
##
 
# ------------------------------------------------------------------------------
#Subtopic Stroke_Width
#Line # thickness perpendicular to geometry ##
 
Stroke_Width sets the width for stroking. The width is the thickness
of the stroke perpendicular to the path direction when the paint style is
set to kStroke_Style or kStrokeAndFill_Style.
 
When width is greater than zero, the stroke encompasses as many pixels partially
or fully as needed. When the width equals zero, the paint enables hairlines;
the stroke is always one pixel wide.
 
The stroke dimensions are scaled by the canvas matrix, but Hairline stroke
remains one pixel wide regardless of scaling.
 
The default width for the paint is zero.
 
#Example
#Height 170
    #Platform raster gpu
    #Description
        The pixels hit to represent thin lines vary with the angle of the
        line and the platform implementation.
    ##
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        for (bool antialias : { false, true }) {
            paint.setAntiAlias(antialias);
            for (int width = 0; width <= 4; ++width) {
                SkScalar offset = antialias * 100 + width * 20;
                paint.setStrokeWidth(width * 0.25f);
                canvas->drawLine(10 + offset,  10, 20 + offset,  60, paint);
                canvas->drawLine(10 + offset, 110, 60 + offset, 160, paint);
            }
        }
    }
##
 
#Method SkScalar getStrokeWidth() const
 
#In Stroke_Width
#Line # returns thickness of the stroke ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("0 %c= paint.getStrokeWidth()\n", 0 == paint.getStrokeWidth() ? '=' : '!');
 
        #StdOut
            0 == paint.getStrokeWidth()
        ##
    ##
 
##
 
#Method void setStrokeWidth(SkScalar width)
 
#In Stroke_Width
#Line # sets thickness of the stroke ##
#Populate
 
#Example
        SkPaint paint;
        paint.setStrokeWidth(5);
        paint.setStrokeWidth(-1);
        SkDebugf("5 %c= paint.getStrokeWidth()\n", 5 == paint.getStrokeWidth() ? '=' : '!');
 
        #StdOut
            5 == paint.getStrokeWidth()
        ##
    ##
 
##
 
#Subtopic Stroke_Width ##
# ------------------------------------------------------------------------------
#Subtopic Miter_Limit
#Line # maximum length of stroked corners ##
 
Miter_Limit specifies the maximum miter length,
relative to the stroke width.
 
Miter_Limit is used when the Stroke_Join
is set to kMiter_Join, and the Style is either kStroke_Style
or kStrokeAndFill_Style.
 
If the miter at a corner exceeds this limit, kMiter_Join
is replaced with kBevel_Join.
 
Miter_Limit can be computed from the corner angle using:
#Formula # miter limit = 1 / sin ( angle / 2 ) ##.
 
Miter_Limit default value is 4.
The default may be changed at compile time by setting SkPaintDefaults_MiterLimit
in "SkUserConfig.h" or as a define supplied by the build environment.
 
Here are some miter limits and the angles that triggers them.
#Table
#Legend
    # miter limit    # angle in degrees ##
#Legend ##
    # 10             # 11.48            ##
    # 9              # 12.76            ##
    # 8              # 14.36            ##
    # 7              # 16.43            ##
    # 6              # 19.19            ##
    # 5              # 23.07            ##
    # 4              # 28.96            ##
    # 3              # 38.94            ##
    # 2              # 60               ##
    # 1              # 180              ##
#Table ##
 
#Example
    #Height 170
    #Width 384
    #Description
        This example draws a stroked corner and the miter length beneath.
        When the miter limit is decreased slightly, the miter join is replaced
        by a bevel join.
    ##
    void draw(SkCanvas* canvas) {
        SkPoint pts[] = {{ 10, 50 }, { 110, 80 }, { 10, 110 }};
        SkVector v[] = { pts[0] - pts[1], pts[2] - pts[1] };
        SkScalar angle1 = SkScalarATan2(v[0].fY, v[0].fX);
        SkScalar angle2 = SkScalarATan2(v[1].fY, v[1].fX);
        const SkScalar strokeWidth = 20;
        SkScalar miterLimit = 1 / SkScalarSin((angle2 - angle1) / 2);
        SkScalar miterLength = strokeWidth * miterLimit;
        SkPath path;
        path.moveTo(pts[0]);
        path.lineTo(pts[1]);
        path.lineTo(pts[2]);
        SkPaint paint;  // set to default kMiter_Join
        paint.setAntiAlias(true);
        paint.setStyle(SkPaint::kStroke_Style);
        paint.setStrokeMiter(miterLimit);
        paint.setStrokeWidth(strokeWidth);
        canvas->drawPath(path, paint);
        paint.setStrokeWidth(1);
        canvas->drawLine(pts[1].fX - miterLength / 2, pts[1].fY + 50,
                         pts[1].fX + miterLength / 2, pts[1].fY + 50, paint);
        canvas->translate(200, 0);
        miterLimit *= 0.99f;
        paint.setStrokeMiter(miterLimit);
        paint.setStrokeWidth(strokeWidth);
        canvas->drawPath(path, paint);
        paint.setStrokeWidth(1);
        canvas->drawLine(pts[1].fX - miterLength / 2, pts[1].fY + 50,
                         pts[1].fX + miterLength / 2, pts[1].fY + 50, paint);
    }
##
 
#Method SkScalar getStrokeMiter() const
 
#In Miter_Limit
#Line # returns Miter_Limit, angles with sharp corners ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("default miter limit == %g\n", paint.getStrokeMiter());
 
        #StdOut
        default miter limit == 4
        ##
    ##
 
    #SeeAlso Miter_Limit setStrokeMiter Join
 
##
 
#Method void setStrokeMiter(SkScalar miter)
 
#In Miter_Limit
#Line # sets Miter_Limit, angles with sharp corners ##
#Populate
 
#Example
        SkPaint paint;
        paint.setStrokeMiter(8);
        paint.setStrokeMiter(-1);
        SkDebugf("default miter limit == %g\n", paint.getStrokeMiter());
 
        #StdOut
        default miter limit == 8
        ##
    ##
 
    #SeeAlso Miter_Limit getStrokeMiter Join
 
##
 
#Subtopic Miter_Limit ##
# ------------------------------------------------------------------------------
#Subtopic Stroke_Cap
#Line # decorations at ends of open strokes ##
#Subtopic Stroke_Cap ##
 
#Enum Cap
#Line # start and end geometry on stroked shapes ##
 
#Code
#Populate
##
 
#Code
#In Constant
#Filter kCap
#Populate
##
 
Stroke_Cap draws at the beginning and end of an open Path_Contour.
 
    #Const kButt_Cap 0
    #Line # no stroke extension ##
        Does not extend the stroke past the beginning or the end.
    ##
    #Const kRound_Cap 1
    #Line # adds circle ##
        Adds a circle with a diameter equal to Stroke_Width at the beginning
        and end.
    ##
    #Const kSquare_Cap 2
    #Line # adds square ##
        Adds a square with sides equal to Stroke_Width at the beginning
        and end. The square sides are parallel to the initial and final direction
        of the stroke.
    ##
    #Const kLast_Cap 2
    #Line # largest Stroke_Cap value ##
        Equivalent to the largest value for Stroke_Cap.
    ##
    #Const kDefault_Cap 0
    #Line # equivalent to kButt_Cap ##
        Stroke_Cap is set to kButt_Cap by default.
    ##
 
    #Const kCapCount 3
    #Line # number of different Stroke_Cap values defined ##
        May be used to verify that Stroke_Cap is a legal value.
    ##
#Enum ##
 
Stroke describes the area covered by a pen of Stroke_Width as it
follows the Path_Contour, moving parallel to the contour direction.
 
If the Path_Contour is not terminated by SkPath::kClose_Verb, the contour has a
visible beginning and end.
 
Path_Contour may start and end at the same point; defining Zero_Length_Contour.
 
kButt_Cap and Zero_Length_Contour is not drawn.
kRound_Cap and Zero_Length_Contour draws a circle of diameter Stroke_Width
at the contour point.
kSquare_Cap and Zero_Length_Contour draws an upright square with a side of
Stroke_Width at the contour point.
 
Stroke_Cap is kButt_Cap by default.
 
#Example
#Height 200
    SkPaint paint;
    paint.setStyle(SkPaint::kStroke_Style);
    paint.setStrokeWidth(20);
    SkPath path;
    path.moveTo(30, 30);
    path.lineTo(30, 30);
    path.moveTo(70, 30);
    path.lineTo(90, 40);
    for (SkPaint::Cap c : { SkPaint::kButt_Cap, SkPaint::kRound_Cap, SkPaint::kSquare_Cap } ) {
        paint.setStrokeCap(c);
        canvas->drawPath(path, paint);
        canvas->translate(0, 70);
    }
##
 
#Method Cap getStrokeCap() const
 
#In Stroke_Cap
#Line # returns Cap, the area drawn at path ends ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("kButt_Cap %c= default stroke cap\n",
                SkPaint::kButt_Cap == paint.getStrokeCap() ? '=' : '!');
 
        #StdOut
            kButt_Cap == default stroke cap
        ##
    ##
 
    #SeeAlso Stroke_Cap setStrokeCap
##
 
#Method void setStrokeCap(Cap cap)
 
#In Stroke_Cap
#Line # sets Cap, the area drawn at path ends ##
#Populate
 
#Example
        SkPaint paint;
        paint.setStrokeCap(SkPaint::kRound_Cap);
        paint.setStrokeCap((SkPaint::Cap) SkPaint::kCapCount);
        SkDebugf("kRound_Cap %c= paint.getStrokeCap()\n",
                SkPaint::kRound_Cap == paint.getStrokeCap() ? '=' : '!');
 
        #StdOut
            kRound_Cap == paint.getStrokeCap()
        ##
    ##
 
    #SeeAlso Stroke_Cap getStrokeCap
##
 
# ------------------------------------------------------------------------------
#Subtopic Stroke_Join
#Line # decoration at corners of strokes ##
#Subtopic Stroke_Join ##
 
Stroke_Join draws at the sharp corners of an open or closed Path_Contour.
 
Stroke describes the area covered by a pen of Stroke_Width as it
follows the Path_Contour, moving parallel to the contour direction.
 
If the contour direction changes abruptly, because the tangent direction leading
to the end of a curve within the contour does not match the tangent direction of
the following curve, the pair of curves meet at Stroke_Join.
 
#Example
#Height 200
    SkPaint paint;
    paint.setStyle(SkPaint::kStroke_Style);
    paint.setStrokeWidth(20);
    SkPath path;
    path.moveTo(30, 20);
    path.lineTo(40, 40);
    path.conicTo(70, 20, 100, 20, .707f);
    for (SkPaint::Join j : { SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join } ) {
        paint.setStrokeJoin(j);
        canvas->drawPath(path, paint);
        canvas->translate(0, 70);
    }
##
 
#Enum Join
#Line # corner geometry on stroked shapes ##
#Code
#Populate
##
 
#Code
#In Constant
#Filter kJoin
#Populate
##
 
Join specifies how corners are drawn when a shape is stroked. Join
affects the four corners of a stroked rectangle, and the connected segments in a
stroked path.
 
Choose miter join to draw sharp corners. Choose round join to draw a circle with a
radius equal to the stroke width on top of the corner. Choose bevel join to minimally
connect the thick strokes.
 
The fill path constructed to describe the stroked path respects the join setting but may
not contain the actual join. For instance, a fill path constructed with round joins does
not necessarily include circles at each connected segment.
 
#Const kMiter_Join 0
#Line # extends to Miter_Limit ##
    Extends the outside corner to the extent allowed by Miter_Limit.
    If the extension exceeds Miter_Limit, kBevel_Join is used instead.
##
 
#Const kRound_Join 1
#Line # adds circle ##
    Adds a circle with a diameter of Stroke_Width at the sharp corner.
##
 
#Const kBevel_Join 2
#Line # connects outside edges ##
    Connects the outside edges of the sharp corner.
##
 
#Const kLast_Join 2
#Line # equivalent to the largest value for Stroke_Join ##
##
 
#Const kDefault_Join 1
#Line # equivalent to kMiter_Join ##
    Stroke_Join is set to kMiter_Join by default.
##
 
#Const kJoinCount 3
#Line # number of different Stroke_Join values defined ##
    May be used to verify that Stroke_Join is a legal value.
##
 
#Example
#Width 462
void draw(SkCanvas* canvas) {
    SkPath path;
    path.moveTo(10, 50);
    path.quadTo(35, 110, 60, 210);
    path.quadTo(105, 110, 130, 10);
    SkPaint paint;  // set to default kMiter_Join
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    paint.setStrokeWidth(20);
    canvas->drawPath(path, paint);
    canvas->translate(150, 0);
    paint.setStrokeJoin(SkPaint::kBevel_Join);
    canvas->drawPath(path, paint);
    canvas->translate(150, 0);
    paint.setStrokeJoin(SkPaint::kRound_Join);
    canvas->drawPath(path, paint);
}
##
 
#SeeAlso setStrokeJoin getStrokeJoin setStrokeMiter getStrokeMiter
 
#Enum ##
 
#Method Join getStrokeJoin() const
 
#In Stroke_Join
#Line # returns Join, geometry on path corners ##
#Populate
 
#Example
        SkPaint paint;
        SkDebugf("kMiter_Join %c= default stroke join\n",
                SkPaint::kMiter_Join == paint.getStrokeJoin() ? '=' : '!');
 
        #StdOut
            kMiter_Join == default stroke join
        ##
    ##
 
    #SeeAlso Stroke_Join setStrokeJoin
##
 
#Method void setStrokeJoin(Join join)
 
#In Stroke_Join
#Line # sets Join, geometry on path corners ##
#Populate
 
#Example
        SkPaint paint;
        paint.setStrokeJoin(SkPaint::kMiter_Join);
        paint.setStrokeJoin((SkPaint::Join) SkPaint::kJoinCount);
        SkDebugf("kMiter_Join %c= paint.getStrokeJoin()\n",
                SkPaint::kMiter_Join == paint.getStrokeJoin() ? '=' : '!');
 
        #StdOut
            kMiter_Join == paint.getStrokeJoin()
        ##
    ##
 
    #SeeAlso Stroke_Join getStrokeJoin
##
 
#SeeAlso Miter_Limit
 
# ------------------------------------------------------------------------------
#Subtopic Fill_Path
#Line # make Path from Path_Effect, stroking ##
 
Fill_Path creates a Path by applying the Path_Effect, followed by the Style_Stroke.
 
If Paint contains Path_Effect, Path_Effect operates on the source Path; the result
replaces the destination Path. Otherwise, the source Path is replaces the
destination Path.
 
Fill Path can request the Path_Effect to restrict to a culling rectangle, but
the Path_Effect is not required to do so.
 
If Style is kStroke_Style or kStrokeAndFill_Style,
and Stroke_Width is greater than zero, the Stroke_Width, Stroke_Cap, Stroke_Join,
and Miter_Limit operate on the destination Path, replacing it.
 
Fill Path can specify the precision used by Stroke_Width to approximate the stroke geometry.
 
If the Style is kStroke_Style and the Stroke_Width is zero, getFillPath
returns false since Hairline has no filled equivalent.
 
#SeeAlso Style_Stroke Stroke_Width Path_Effect
 
#Subtopic Fill_Path ##
 
#Method bool getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect,
                     SkScalar resScale = 1) const
#In Fill_Path
#Line # returns fill path equivalent to stroke ##
#Populate
 
#Example
    #Height 192
    #Description
    A very small Quad stroke is turned into a filled path with increasing levels of precision.
    At the lowest precision, the Quad stroke is approximated by a rectangle.
    At the highest precision, the filled path has high fidelity compared to the original stroke.
    ##
        void draw(SkCanvas* canvas) {
            SkPaint strokePaint;
            strokePaint.setAntiAlias(true);
            strokePaint.setStyle(SkPaint::kStroke_Style);
            strokePaint.setStrokeWidth(.1f);
            SkPath strokePath;
            strokePath.moveTo(.08f, .08f);
            strokePath.quadTo(.09f, .08f, .17f, .17f);
            SkPath fillPath;
            SkPaint outlinePaint(strokePaint);
            outlinePaint.setStrokeWidth(2);
            SkMatrix scale = SkMatrix::MakeScale(300, 300);
            for (SkScalar precision : { 0.01f, .1f, 1.f, 10.f, 100.f } ) {
                strokePaint.getFillPath(strokePath, &fillPath, nullptr, precision);
                fillPath.transform(scale);
                canvas->drawPath(fillPath, outlinePaint);
                canvas->translate(60, 0);
                if (1.f == precision) canvas->translate(-180, 100);
            }
            strokePath.transform(scale);
            strokePaint.setStrokeWidth(30);
            canvas->drawPath(strokePath, strokePaint);
        }
    ##
 
##
 
#Method bool getFillPath(const SkPath& src, SkPath* dst) const
 
#In Fill_Path
#Populate
 
#Example
    #Height 128
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setStyle(SkPaint::kStroke_Style);
            paint.setStrokeWidth(10);
            SkPath strokePath;
            strokePath.moveTo(20, 20);
            strokePath.lineTo(100, 100);
            canvas->drawPath(strokePath, paint);
            SkPath fillPath;
            paint.getFillPath(strokePath, &fillPath);
            paint.setStrokeWidth(2);
            canvas->translate(40, 0);
            canvas->drawPath(fillPath, paint);
        }
    ##
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Shader_Methods
#Line # get and set Shader ##
 
Shader defines the colors used when drawing a shape.
Shader may be an image, a gradient, or a computed fill.
If Paint has no Shader, then Color fills the shape.
 
Shader is modulated by Color_Alpha component of Color.
If Shader object defines only Color_Alpha, then Color modulated by Color_Alpha describes
the fill.
 
The drawn transparency can be modified without altering Shader, by changing Color_Alpha.
 
#Example
void draw(SkCanvas* canvas) {
   SkPaint paint;
   SkPoint center = { 50, 50 };
   SkScalar radius = 50;
   const SkColor colors[] = { 0xFFFFFFFF, 0xFF000000 };
   paint.setShader(SkGradientShader::MakeRadial(center, radius, colors,
        nullptr, SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode));
   for (SkScalar a : { 0.3f, 0.6f, 1.0f } ) {
       paint.setAlpha((int) (a * 255));
       canvas->drawCircle(center.fX, center.fY, radius, paint);
       canvas->translate(70, 70);
   }
}
##
 
If Shader generates only Color_Alpha then all components of Color modulate the output.
 
#Example
void draw(SkCanvas* canvas) {
   SkPaint paint;
   SkBitmap bitmap;
   bitmap.setInfo(SkImageInfo::MakeA8(5, 1), 5);  // bitmap only contains alpha
   uint8_t pixels[5] = { 0x22, 0x55, 0x88, 0xBB, 0xFF };
   bitmap.setPixels(pixels);
   paint.setShader(SkShader::MakeBitmapShader(bitmap,
            SkShader::kMirror_TileMode, SkShader::kMirror_TileMode));
   for (SkColor c : { SK_ColorRED, SK_ColorBLUE, SK_ColorGREEN } ) {
       paint.setColor(c);  // all components in color affect shader
       canvas->drawCircle(50, 50, 50, paint);
       canvas->translate(70, 70);
   }
}
##
 
#Method SkShader* getShader() const
 
#In Shader_Methods
#Line # returns Shader, multiple drawing colors; gradients ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("nullptr %c= shader\n", paint.getShader() ? '!' : '=');
           paint.setShader(SkShader::MakeEmptyShader());
           SkDebugf("nullptr %c= shader\n", paint.getShader() ? '!' : '=');
        }
 
        #StdOut
            nullptr == shader
            nullptr != shader
        ##
    ##
 
##
 
#Method sk_sp<SkShader> refShader() const
 
#In Shader_Methods
#Line # references Shader, multiple drawing colors; gradients ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint1, paint2;
           paint1.setShader(SkShader::MakeEmptyShader());
           SkDebugf("shader unique: %s\n", paint1.getShader()->unique() ? "true" : "false");
           paint2.setShader(paint1.refShader());
           SkDebugf("shader unique: %s\n", paint1.getShader()->unique() ? "true" : "false");
        }
 
        #StdOut
            shader unique: true
            shader unique: false
        ##
    ##
 
##
 
#Method void setShader(sk_sp<SkShader> shader)
 
#In Shader_Methods
#Line # sets Shader, multiple drawing colors; gradients ##
#Populate
 
#Example
    #Height 64
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setColor(SK_ColorBLUE);
            paint.setShader(SkShader::MakeColorShader(SK_ColorRED));
            canvas->drawRect(SkRect::MakeWH(40, 40), paint);
            paint.setShader(nullptr);
            canvas->translate(50, 0);
            canvas->drawRect(SkRect::MakeWH(40, 40), paint);
        }
    ##
 
##
 
#Subtopic Shader_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Color_Filter_Methods
#Line # get and set Color_Filter ##
 
Color_Filter alters the color used when drawing a shape.
Color_Filter may apply Blend_Mode, transform the color through a matrix, or composite multiple filters.
If Paint has no Color_Filter, the color is unaltered.
 
The drawn transparency can be modified without altering Color_Filter, by changing Color_Alpha.
 
#Example
#Height 128
void draw(SkCanvas* canvas) {
    SkPaint paint;
    paint.setColorFilter(SkColorMatrixFilter::MakeLightingFilter(0xFFFFFF, 0xFF0000));
    for (SkColor c : { SK_ColorBLACK, SK_ColorGREEN } ) {
        paint.setColor(c);
        canvas->drawRect(SkRect::MakeXYWH(10, 10, 50, 50), paint);
        paint.setAlpha(0x80);
        canvas->drawRect(SkRect::MakeXYWH(60, 60, 50, 50), paint);
        canvas->translate(100, 0);
    }
}
##
 
#Method SkColorFilter* getColorFilter() const
 
#In Color_Filter_Methods
#Line # returns Color_Filter, how colors are altered ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("nullptr %c= color filter\n", paint.getColorFilter() ? '!' : '=');
           paint.setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, SkBlendMode::kSrcIn));
           SkDebugf("nullptr %c= color filter\n", paint.getColorFilter() ? '!' : '=');
        }
 
        #StdOut
            nullptr == color filter
            nullptr != color filter
        ##
    ##
##
 
#Method sk_sp<SkColorFilter> refColorFilter() const
 
#In Color_Filter_Methods
#Line # references Color_Filter, how colors are altered ##
#Populate
 
#Example
    void draw(SkCanvas* canvas) {
        SkPaint paint1, paint2;
        paint1.setColorFilter(SkColorFilter::MakeModeFilter(0xFFFF0000, SkBlendMode::kSrcATop));
        SkDebugf("color filter unique: %s\n", paint1.getColorFilter()->unique() ? "true" : "false");
        paint2.setColorFilter(paint1.refColorFilter());
        SkDebugf("color filter unique: %s\n", paint1.getColorFilter()->unique() ? "true" : "false");
    }
 
        #StdOut
            color filter unique: true
            color filter unique: false
        ##
    ##
##
 
#Method void setColorFilter(sk_sp<SkColorFilter> colorFilter)
 
#In Color_Filter_Methods
#Line # sets Color_Filter, alters color ##
#Populate
 
#Example
    #Height 64
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           paint.setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorLTGRAY, SkBlendMode::kSrcIn));
           canvas->drawRect(SkRect::MakeWH(50, 50), paint);
           paint.setColorFilter(nullptr);
           canvas->translate(70, 0);
           canvas->drawRect(SkRect::MakeWH(50, 50), paint);
        }
    ##
 
##
 
#Subtopic Color_Filter_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Blend_Mode_Methods
#Line # get and set Blend_Mode ##
 
Blend_Mode describes how Color combines with the destination color.
The default setting, SkBlendMode::kSrcOver, draws the source color
over the destination color.
 
#Example
void draw(SkCanvas* canvas) {
    SkPaint normal, blender;
    normal.setColor(0xFF58a889);
    blender.setColor(0xFF8958a8);
    canvas->clear(0);
    for (SkBlendMode m : { SkBlendMode::kSrcOver, SkBlendMode::kSrcIn, SkBlendMode::kSrcOut } ) {
        normal.setBlendMode(SkBlendMode::kSrcOver);
        canvas->drawOval(SkRect::MakeXYWH(30, 30, 30, 80), normal);
        blender.setBlendMode(m);
        canvas->drawOval(SkRect::MakeXYWH(10, 50, 80, 30), blender);
        canvas->translate(70, 70);
    }
}
##
 
#SeeAlso Blend_Mode
 
#Method SkBlendMode getBlendMode() const
 
#In Blend_Mode_Methods
#Line # returns Blend_Mode, how colors combine with Device ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("kSrcOver %c= getBlendMode\n",
                    SkBlendMode::kSrcOver == paint.getBlendMode() ? '=' : '!');
           paint.setBlendMode(SkBlendMode::kSrc);
           SkDebugf("kSrcOver %c= getBlendMode\n",
                    SkBlendMode::kSrcOver == paint.getBlendMode() ? '=' : '!');
        }
 
        #StdOut
            kSrcOver == getBlendMode
            kSrcOver != getBlendMode
        ##
    ##
 
##
 
#Method bool isSrcOver() const
 
#In Blend_Mode_Methods
#Line # returns true if Blend_Mode is SkBlendMode::kSrcOver ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("isSrcOver %c= true\n", paint.isSrcOver() ? '=' : '!');
           paint.setBlendMode(SkBlendMode::kSrc);
           SkDebugf("isSrcOver %c= true\n", paint.isSrcOver() ? '=' : '!');
        }
 
        #StdOut
            isSrcOver == true
            isSrcOver != true
        ##
    ##
 
##
 
#Method void setBlendMode(SkBlendMode mode)
 
#In Blend_Mode_Methods
#Line # sets Blend_Mode, how colors combine with destination ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("isSrcOver %c= true\n", paint.isSrcOver() ? '=' : '!');
           paint.setBlendMode(SkBlendMode::kSrc);
           SkDebugf("isSrcOver %c= true\n", paint.isSrcOver() ? '=' : '!');
        }
 
        #StdOut
            isSrcOver == true
            isSrcOver != true
        ##
    ##
 
##
 
#Subtopic Blend_Mode_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Path_Effect_Methods
#Line # get and set Path_Effect ##
 
Path_Effect modifies the path geometry before drawing it.
Path_Effect may implement dashing, custom fill effects and custom stroke effects.
If Paint has no Path_Effect, the path geometry is unaltered when filled or stroked.
 
#Example
#Height 160
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setStyle(SkPaint::kStroke_Style);
            paint.setStrokeWidth(16);
            SkScalar intervals[] = {30, 10};
            paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 1));
            canvas->drawRoundRect({20, 20, 120, 120}, 20, 20, paint);
        }
##
 
#SeeAlso Path_Effect
 
#Method SkPathEffect* getPathEffect() const
 
#In Path_Effect_Methods
#Line # returns Path_Effect, modifications to path geometry; dashing ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("nullptr %c= path effect\n", paint.getPathEffect() ? '!' : '=');
           paint.setPathEffect(SkCornerPathEffect::Make(10));
           SkDebugf("nullptr %c= path effect\n", paint.getPathEffect() ? '!' : '=');
        }
 
        #StdOut
            nullptr == path effect
            nullptr != path effect
        ##
    ##
 
##
 
 
#Method sk_sp<SkPathEffect> refPathEffect() const
 
#In Path_Effect_Methods
#Line # references Path_Effect, modifications to path geometry; dashing ##
#Populate
 
#Example
    void draw(SkCanvas* canvas) {
        SkPaint paint1, paint2;
        SkScalar intervals[] = {1, 2};
        paint1.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 10));
        SkDebugf("path effect unique: %s\n", paint1.getPathEffect()->unique() ? "true" : "false");
        paint2.setPathEffect(paint1.refPathEffect());
        SkDebugf("path effect unique: %s\n", paint1.getPathEffect()->unique() ? "true" : "false");
    }
 
        #StdOut
            path effect unique: true
            path effect unique: false
        ##
    ##
 
##
 
 
#Method void setPathEffect(sk_sp<SkPathEffect> pathEffect)
 
#In Path_Effect_Methods
#Line # sets Path_Effect, modifications to path geometry; dashing ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setPathEffect(SkDiscretePathEffect::Make(3, 5));
            canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);
        }
    ##
 
##
 
#Subtopic Path_Effect_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Mask_Filter_Methods
#Line # get and set Mask_Filter ##
 
Mask_Filter uses coverage of the shape drawn to create Mask_Alpha.
Mask_Filter takes a Mask, and returns a Mask.
 
Mask_Filter may change the geometry and transparency of the shape, such as
creating a blur effect. Set Mask_Filter to nullptr to prevent Mask_Filter from
modifying the draw.
 
#Example
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        paint.setMaskFilter(SkMaskFilter::MakeBlur(kSolid_SkBlurStyle, 3));
        canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);
    }
##
 
#Method SkMaskFilter* getMaskFilter() const
 
#In Mask_Filter_Methods
#Line # returns Mask_Filter, alterations to Mask_Alpha ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("nullptr %c= mask filter\n", paint.getMaskFilter() ? '!' : '=');
           paint.setMaskFilter(SkMaskFilter::MakeBlur(kOuter_SkBlurStyle, 3));
           SkDebugf("nullptr %c= mask filter\n", paint.getMaskFilter() ? '!' : '=');
        }
 
        #StdOut
            nullptr == mask filter
            nullptr != mask filter
        ##
    ##
 
##
 
#Method sk_sp<SkMaskFilter> refMaskFilter() const
 
#In Mask_Filter_Methods
#Line # references Mask_Filter, alterations to Mask_Alpha ##
#Populate
 
#Example
    void draw(SkCanvas* canvas) {
        SkPaint paint1, paint2;
        paint1.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 1));
        SkDebugf("mask filter unique: %s\n", paint1.getMaskFilter()->unique() ? "true" : "false");
        paint2.setMaskFilter(paint1.refMaskFilter());
        SkDebugf("mask filter unique: %s\n", paint1.getMaskFilter()->unique() ? "true" : "false");
    }
 
        #StdOut
            mask filter unique: true
            mask filter unique: false
        ##
    ##
 
##
 
#Method void setMaskFilter(sk_sp<SkMaskFilter> maskFilter)
 
#In Mask_Filter_Methods
#Line # sets Mask_Filter, alterations to Mask_Alpha ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setStyle(SkPaint::kStroke_Style);
            paint.setStrokeWidth(10);
            paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 10));
            canvas->drawRect(SkRect::MakeXYWH(40, 40, 175, 175), paint);
        }
    ##
 
##
 
#Subtopic Mask_Filter_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Typeface_Methods
#Line # get and set Typeface ##
 
Typeface identifies the font used when drawing and measuring text.
Typeface may be specified by name, from a file, or from a data stream.
The default Typeface defers to the platform-specific default font
implementation.
 
#Example
#Height 100
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        paint.setTypeface(SkTypeface::MakeFromName(nullptr, SkFontStyle()));
        paint.setAntiAlias(true);
        paint.setTextSize(36);
        canvas->drawString("A Big Hello!", 10, 40, paint);
        paint.setTypeface(nullptr);
        paint.setFakeBoldText(true);
        canvas->drawString("A Big Hello!", 10, 80, paint);
    }
##
 
#Subtopic Typeface_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Image_Filter_Methods
#Line # get and set Image_Filter ##
 
Image_Filter operates on the pixel representation of the shape, as modified by Paint
with Blend_Mode set to SkBlendMode::kSrcOver. Image_Filter creates a new bitmap,
which is drawn to the device using the set Blend_Mode.
 
Image_Filter is higher level than Mask_Filter; for instance, an Image_Filter
can operate on all channels of Color, while Mask_Filter generates Alpha only.
Image_Filter operates independently of and can be used in combination with
Mask_Filter.
 
#Example
    #ToDo explain why the two draws are so different ##
    #Function
    ###$
    #include "SkBlurImageFilter.h"
    $$$#
    ##
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        paint.setStyle(SkPaint::kStroke_Style);
        paint.setStrokeWidth(2);
        SkRegion region;
        region.op( 10, 10, 50, 50, SkRegion::kUnion_Op);
        region.op( 10, 50, 90, 90, SkRegion::kUnion_Op);
        paint.setImageFilter(SkBlurImageFilter::Make(5.0f, 5.0f, nullptr));
        canvas->drawRegion(region, paint);
        paint.setImageFilter(nullptr);
        paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, 5));
        canvas->translate(100, 100);
        canvas->drawRegion(region, paint);
    }
##
 
#Method SkImageFilter* getImageFilter() const
 
#In Image_Filter_Methods
#Line # returns Image_Filter, alter pixels; blur ##
#Populate
 
#Example
        #Function
        ###$
        #include "SkBlurImageFilter.h"
        $$$#
        ##
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("nullptr %c= image filter\n", paint.getImageFilter() ? '!' : '=');
           paint.setImageFilter(SkBlurImageFilter::Make(kOuter_SkBlurStyle, 3, nullptr, nullptr));
           SkDebugf("nullptr %c= image filter\n", paint.getImageFilter() ? '!' : '=');
        }
 
        #StdOut
            nullptr == image filter
            nullptr != image filter
        ##
    ##
 
##
 
#Method sk_sp<SkImageFilter> refImageFilter() const
 
#In Image_Filter_Methods
#Line # references Image_Filter, alter pixels; blur ##
#Populate
 
#Example
    void draw(SkCanvas* canvas) {
        SkPaint paint1, paint2;
        paint1.setImageFilter(SkOffsetImageFilter::Make(25, 25, nullptr));
        SkDebugf("image filter unique: %s\n", paint1.getImageFilter()->unique() ? "true" : "false");
        paint2.setImageFilter(paint1.refImageFilter());
        SkDebugf("image filter unique: %s\n", paint1.getImageFilter()->unique() ? "true" : "false");
    }
 
        #StdOut
            image filter unique: true
            image filter unique: false
        ##
    ##
 
##
 
#Method void setImageFilter(sk_sp<SkImageFilter> imageFilter)
 
#In Image_Filter_Methods
#Line # sets Image_Filter, alter pixels; blur ##
#Populate
 
#Example
    #Height 160
    void draw(SkCanvas* canvas) {
        SkBitmap bitmap;
        bitmap.allocN32Pixels(100, 100);
        SkCanvas offscreen(bitmap);
        SkPaint paint;
        paint.setAntiAlias(true);
        paint.setColor(SK_ColorWHITE);
        paint.setTextSize(96);
        offscreen.clear(0);
        offscreen.drawString("e", 20, 70, paint);
        paint.setImageFilter(
               SkLightingImageFilter::MakePointLitDiffuse(SkPoint3::Make(80, 100, 10),
               SK_ColorWHITE, 1, 2, nullptr, nullptr));
        canvas->drawBitmap(bitmap, 0, 0, &paint);
    }
    ##
 
##
 
#Subtopic Image_Filter_Methods ##
# ------------------------------------------------------------------------------
#Subtopic Draw_Looper_Methods
#Line # get and set Draw_Looper ##
 
Draw_Looper sets a modifier that communicates state from one Draw_Layer
to another to construct the draw.
 
Draw_Looper draws one or more times, modifying the canvas and paint each time.
Draw_Looper may be used to draw multiple colors or create a colored shadow.
Set Draw_Looper to nullptr to prevent Draw_Looper from modifying the draw.
 
#Example
#Height 128
    void draw(SkCanvas* canvas) {
        SkLayerDrawLooper::LayerInfo info;
        info.fPaintBits = (SkLayerDrawLooper::BitFlags) SkLayerDrawLooper::kColorFilter_Bit;
        info.fColorMode = SkBlendMode::kSrc;
        SkLayerDrawLooper::Builder looperBuilder;
        SkPaint* loopPaint = looperBuilder.addLayer(info);
        loopPaint->setColor(SK_ColorRED);
        info.fOffset.set(20, 20);
        loopPaint = looperBuilder.addLayer(info);
        loopPaint->setColor(SK_ColorBLUE);
        SkPaint paint;
        paint.setDrawLooper(looperBuilder.detach());
        canvas->drawCircle(50, 50, 50, paint);
    }
 
##
 
#Method SkDrawLooper* getDrawLooper() const
 
#In Draw_Looper_Methods
#Line # returns Draw_Looper, multiple layers ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
           SkPaint paint;
           SkDebugf("nullptr %c= draw looper\n", paint.getDrawLooper() ? '!' : '=');
           SkLayerDrawLooper::Builder looperBuilder;
           paint.setDrawLooper(looperBuilder.detach());
           SkDebugf("nullptr %c= draw looper\n", paint.getDrawLooper() ? '!' : '=');
        }
 
        #StdOut
            nullptr == draw looper
            nullptr != draw looper
        ##
    ##
 
##
 
#Method sk_sp<SkDrawLooper> refDrawLooper() const
 
#In Draw_Looper_Methods
#Line # references Draw_Looper, multiple layers ##
#Populate
 
#Example
    void draw(SkCanvas* canvas) {
        SkPaint paint1, paint2;
        SkLayerDrawLooper::Builder looperBuilder;
        paint1.setDrawLooper(looperBuilder.detach());
        SkDebugf("draw looper unique: %s\n", paint1.getDrawLooper()->unique() ? "true" : "false");
        paint2.setDrawLooper(paint1.refDrawLooper());
        SkDebugf("draw looper unique: %s\n", paint1.getDrawLooper()->unique() ? "true" : "false");
    }
 
        #StdOut
            draw looper unique: true
            draw looper unique: false
        ##
    ##
 
##
 
#Method void setDrawLooper(sk_sp<SkDrawLooper> drawLooper)
#In Draw_Looper_Methods
#Line # sets Draw_Looper, multiple layers ##
#Populate
 
#Example
    #Height 128
        void draw(SkCanvas* canvas) {
            SkPaint paint;
            paint.setDrawLooper(SkBlurDrawLooper::Make(0x7FFF0000, 4, -5, -10));
            paint.setStyle(SkPaint::kStroke_Style);
            paint.setStrokeWidth(10);
            paint.setAntiAlias(true);
            paint.setColor(0x7f0000ff);
            canvas->drawCircle(70, 70, 50, paint);
        }
    ##
 
##
 
#Subtopic Draw_Looper_Methods ##
 
#Subtopic Text_Size
#Line # overall height in points ##
 
Text_Size adjusts the overall text size in points.
Text_Size can be set to any positive value or zero.
Text_Size defaults to 12.
Set SkPaintDefaults_TextSize at compile time to change the default setting.
 
#Example
#Height 135
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        canvas->drawString("12 point", 10, 20, paint);
        paint.setTextSize(24);
        canvas->drawString("24 point", 10, 60, paint);
        paint.setTextSize(48);
        canvas->drawString("48 point", 10, 120, paint);
    }
##
 
#Subtopic Text_Size ##
# ------------------------------------------------------------------------------
#Subtopic Text_Scale_X
#Line # text horizontal scale ##
 
Text_Scale_X adjusts the text horizontal scale.
Text scaling approximates condensed and expanded type faces when the actual face
is not available.
Text_Scale_X can be set to any value.
Text_Scale_X defaults to 1.
 
#Example
#Height 128
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        paint.setAntiAlias(true);
        paint.setTextSize(24);
        paint.setTextScaleX(.8f);
        canvas->drawString("narrow", 10, 20, paint);
        paint.setTextScaleX(1);
        canvas->drawString("normal", 10, 60, paint);
        paint.setTextScaleX(1.2f);
        canvas->drawString("wide", 10, 100, paint);
    }
##
 
#Subtopic Text_Scale_X ##
 
#Subtopic Text_Skew_X
#Line # text horizontal slant ##
 
 
Text_Skew_X adjusts the text horizontal slant.
Text skewing approximates italic and oblique type faces when the actual face
is not available.
Text_Skew_X can be set to any value.
Text_Skew_X defaults to 0.
 
#Example
#Height 128
    void draw(SkCanvas* canvas) {
        SkPaint paint;
        paint.setAntiAlias(true);
        paint.setTextSize(24);
        paint.setTextSkewX(-.25f);
        canvas->drawString("right-leaning", 10, 100, paint);
        paint.setTextSkewX(0);
        canvas->drawString("normal", 10, 60, paint);
        paint.setTextSkewX(.25f);
        canvas->drawString("left-leaning", 10, 20, paint);
    }
##
 
#Subtopic Text_Skew_X ##
 
# ------------------------------------------------------------------------------
#Subtopic Text_Encoding
#Line # text encoded as characters or Glyphs ##
 
#Example
#Height 128
#Description
First line is encoded in UTF-8.
Second line is encoded in UTF-16.
Third line is encoded in UTF-32.
Fourth line has 16-bit glyph indices.
##
void draw(SkCanvas* canvas) {
    SkPaint paint;
    const char hello8[] = "Hello" "\xE2" "\x98" "\xBA";
    const uint16_t hello16[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };
    const uint32_t hello32[] = { 'H', 'e', 'l', 'l', 'o', 0x263A };
    paint.setTextSize(24);
    canvas->drawText(hello8, sizeof(hello8) - 1, 10, 30, paint);
    paint.setTextEncoding(SkTextEncoding::kUTF16);
    canvas->drawText(hello16, sizeof(hello16), 10, 60, paint);
    paint.setTextEncoding(SkTextEncoding::kUTF32);
    canvas->drawText(hello32, sizeof(hello32), 10, 90, paint);
    uint16_t glyphs[SK_ARRAY_COUNT(hello32)];
    SkFont font;
    font.textToGlyphs(hello32, sizeof(hello32), SkTextEncoding::kUTF32,
            glyphs, SK_ARRAY_COUNT(hello32));
    paint.setTextEncoding(kGlyphID_SkTextEncoding);
    canvas->drawText(glyphs, sizeof(glyphs), 10, 120, paint);
}
##
 
#Subtopic Text_Encoding ##
 
# ------------------------------------------------------------------------------
 
#Method bool nothingToDraw() const
#In Utility
#Line # returns true if Paint prevents all drawing ##
#Populate
 
#Example
        void draw(SkCanvas* canvas) {
            auto debugster = [](const char* prefix, const SkPaint& p) -> void {
                SkDebugf("%s nothing to draw: %s\n", prefix,
                         p.nothingToDraw() ? "true" : "false");
            };
            SkPaint paint;
            debugster("initial", paint);
            paint.setBlendMode(SkBlendMode::kDst);
            debugster("blend dst", paint);
            paint.setBlendMode(SkBlendMode::kSrcOver);
            debugster("blend src over", paint);
            paint.setAlpha(0);
            debugster("alpha 0", paint);
        }
 
        #StdOut
            initial nothing to draw: false
            blend dst nothing to draw: true
            blend src over nothing to draw: false
            alpha 0 nothing to draw: true
        #StdOut  ##
    ##
 
##
 
# ------------------------------------------------------------------------------
#Subtopic Utility
#Line # rarely called management functions ##
##
 
# ------------------------------------------------------------------------------
 
#Class SkPaint ##
 
#Topic Paint ##