aboutsummaryrefslogtreecommitdiffhomepage
path: root/docs/SkMatrix_Reference.bmh
blob: 7a17e42eda71b7f9c41d7ef2dabc724d09b46c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
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
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
#Topic Matrix
#Alias Matrices ##
#Alias Matrix_Reference ##

#Class SkMatrix

Matrix holds a 3x3 matrix for transforming coordinates. This allows mapping
Points and Vectors with translation, scaling, skewing, rotation, and
perspective.

Matrix elements are in row major order. Matrix does not have a constructor,
so it must be explicitly initialized. setIdentity initializes Matrix
so it has no effect. setTranslate, setScale, setSkew, setRotate, set9 and setAll
initializes all Matrix elements with the corresponding mapping.

Matrix includes a hidden variable that classifies the type of matrix to
improve performance. Matrix is not thread safe unless getType is called first.

#Subtopic Overview
#Populate
##

#Subtopic Member_Function
#Populate
##

#Subtopic Related_Function
#Populate
##

# ------------------------------------------------------------------------------
#Subtopic Constructor
#Populate
##

#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar sx, SkScalar sy)
#In Constructor
#Line # constructs from scale in x and y ##
Sets Matrix to scale by (sx, sy). Returned matrix is:

#Code
#Literal
| sx  0  0 |
|  0 sy  0 |
|  0  0  1 |
##

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##

#Return  Matrix with scale ##

#Example
#Image 4
canvas->concat(SkMatrix::MakeScale(4, 3));
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso setScale postScale preScale

##

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

#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar scale)

Sets Matrix to scale by (scale, scale). Returned matrix is:

#Code
#Literal
| scale   0   0 |
|   0   scale 0 |
|   0     0   1 |
##

#Param scale  horizontal and vertical scale factor ##

#Return  Matrix with scale ##

#Example
#Image 4
canvas->concat(SkMatrix::MakeScale(4));
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso setScale postScale preScale

##

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

#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkScalar dx, SkScalar dy)
#In Constructor
#Line # constructs from translate in x and y ##
Sets Matrix to translate by (dx, dy). Returned matrix is:

#Code
#Literal
| 1 0 dx |
| 0 1 dy |
| 0 0  1 |
##

#Param dx  horizontal translation ##
#Param dy  vertical translation ##

#Return  Matrix with translation ##

#Example
#Image 4
SkMatrix matrix = SkMatrix::MakeTrans(64, 48);
for (int i = 0; i < 4; ++i) {
    canvas->drawBitmap(source, 0, 0);
    canvas->concat(matrix);
}
##

#SeeAlso setTranslate postTranslate preTranslate

##

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

#Method static SkMatrix SK_WARN_UNUSED_RESULT MakeAll(SkScalar scaleX, SkScalar skewX,  SkScalar transX,
                                                      SkScalar skewY,  SkScalar scaleY, SkScalar transY,
                                                      SkScalar pers0, SkScalar pers1, SkScalar pers2)
#In Constructor
#Line # constructs all nine values ##


Sets Matrix to:

#Code
#Literal
| scaleX  skewX transX |
|  skewY scaleY transY |
|  pers0  pers1  pers2 |
##

#Param scaleX  horizontal scale factor ##
#Param skewX   horizontal skew factor ##
#Param transX  horizontal translation ##
#Param skewY   vertical skew factor ##
#Param scaleY  vertical scale factor ##
#Param transY  vertical translation ##
#Param pers0   input x-axis perspective factor ##
#Param pers1   input y-axis perspective factor ##
#Param pers2   perspective scale factor ##

#Return  Matrix constructed from parameters ##

#Example
    SkPaint p;
    p.setAntiAlias(true);
    p.setTextSize(64);
    for (SkScalar sx : { -1, 1 } ) {
        for (SkScalar sy : { -1, 1 } ) {
            SkAutoCanvasRestore autoRestore(canvas, true);
            SkMatrix m = SkMatrix::MakeAll(sx, 1, 128,    0, sy, 128,   0, 0, 1);
            canvas->concat(m);
            canvas->drawString("K", 0, 0, p);
        }
    }
##

#SeeAlso setAll set9 postConcat preConcat

##


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

#Enum TypeMask
#Line # bit field for Matrix complexity ##
#Code
    enum TypeMask {
        kIdentity_Mask = 0,
        kTranslate_Mask = 0x01,
        kScale_Mask = 0x02,
        kAffine_Mask = 0x04,
        kPerspective_Mask = 0x08,
    };
##

Enum of bit fields for mask returned by getType.
Used to identify the complexity of Matrix, to optimize performance.

#Const kIdentity_Mask 0
#Line # identity Matrix; all bits clear ##
all bits clear if Matrix is identity
##
#Const kTranslate_Mask 1
#Line # translation Matrix ##
set if Matrix has translation
##
#Const kScale_Mask 2
#Line # scale Matrix ##
set if Matrix has x or y scale
##
#Const kAffine_Mask 4
#Line # skew or rotate Matrix ##
set if Matrix skews or rotates
##
#Const kPerspective_Mask 8
#Line # perspective Matrix ##
set if Matrix has perspective
##

#Example
    auto debugster = [](const char* prefix, const SkMatrix& matrix) -> void {
        SkString typeMask;
        typeMask += SkMatrix::kIdentity_Mask == matrix.getType() ? "kIdentity_Mask " : "";
        typeMask += SkMatrix::kTranslate_Mask & matrix.getType() ? "kTranslate_Mask " : "";
        typeMask += SkMatrix::kScale_Mask & matrix.getType() ? "kScale_Mask " : "";
        typeMask += SkMatrix::kAffine_Mask & matrix.getType() ? "kAffine_Mask " : "";
        typeMask += SkMatrix::kPerspective_Mask & matrix.getType() ? "kPerspective_Mask" : "";
        SkDebugf("after %s: %s\n", prefix, typeMask.c_str());
    };
SkMatrix matrix;
matrix.reset();
debugster("reset", matrix);
matrix.postTranslate(1, 0);
debugster("postTranslate", matrix);
matrix.postScale(2, 1);
debugster("postScale", matrix);
matrix.postRotate(45);
debugster("postScale", matrix);
SkPoint polys[][4] = {{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, {{0, 0}, {0, 1}, {2, 1}, {1, 0}}};
matrix.setPolyToPoly(polys[0], polys[1], 4);
debugster("setPolyToPoly", matrix);
#StdOut
after reset: kIdentity_Mask
after postTranslate: kTranslate_Mask
after postScale: kTranslate_Mask kScale_Mask
after postScale: kTranslate_Mask kScale_Mask kAffine_Mask
after setPolyToPoly: kTranslate_Mask kScale_Mask kAffine_Mask kPerspective_Mask
##
##

#SeeAlso getType

##

# ------------------------------------------------------------------------------
#Subtopic Property
#Populate
#Line # values and attributes ##
##

#Method TypeMask getType() const
#In Property
#Line # returns transform complexity ##
Returns a bit field describing the transformations the matrix may
perform. The bit field is computed conservatively, so it may include
false positives. For example, when kPerspective_Mask is set, all
other bits are set.

#Return  kIdentity_Mask, or combinations of: kTranslate_Mask, kScale_Mask,
         kAffine_Mask, kPerspective_Mask
##

#Example
SkMatrix matrix;
matrix.setAll(1, 0, 0,   0, 1, 0,    0, 0, 1);
SkDebugf("identity flags hex: %0x decimal: %d\n", matrix.getType(), matrix.getType());
matrix.setAll(1, 0, 0,   0, 1, 0,    0, 0, .5f);
SkDebugf("set all  flags hex: %0x decimal: %d\n", matrix.getType(), matrix.getType());
#StdOut
identity flags hex: 0 decimal: 0
set all  flags hex: f decimal: 15
##
##

#SeeAlso TypeMask

##

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

#Method bool isIdentity() const
#In Property
#Line # returns if matrix equals the identity Matrix  ##
Returns true if Matrix is identity.  Identity matrix is:

#Code
#Literal
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
##

#Return  true if Matrix has no effect ##

#Example
SkMatrix matrix;
matrix.setAll(1, 0, 0,   0, 1, 0,    0, 0, 1);
SkDebugf("is identity: %s\n", matrix.isIdentity() ? "true" : "false");
matrix.setAll(1, 0, 0,   0, 1, 0,    0, 0, 2);
SkDebugf("is identity: %s\n", matrix.isIdentity() ? "true" : "false");
#StdOut
is identity: true
is identity: false
##
##

#SeeAlso reset() setIdentity getType

##

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

#Method bool isScaleTranslate() const
#In Property
#Line # returns if transform is limited to scale and translate ##
Returns true if Matrix at most scales and translates. Matrix may be identity,
contain only scale elements, only translate elements, or both. Matrix form is:

#Code
#Literal
| scale-x    0    translate-x |
|    0    scale-y translate-y |
|    0       0         1      |
##

#Return  true if Matrix is identity; or scales, translates, or both ##

#Example
SkMatrix matrix;
for (SkScalar scaleX : { 1, 2 } ) {
    for (SkScalar translateX : { 0, 20 } ) {
        matrix.setAll(scaleX, 0, translateX,   0, 1, 0,    0, 0, 1);
        SkDebugf("is scale-translate: %s\n", matrix.isScaleTranslate() ? "true" : "false");
    }
}
#StdOut
is scale-translate: true
is scale-translate: true
is scale-translate: true
is scale-translate: true
##
##

#SeeAlso setScale isTranslate setTranslate getType

##

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

#Method bool isTranslate() const
#In Property
#Line # returns if transform is limited to translate ##
Returns true if Matrix is identity, or translates. Matrix form is:

#Code
#Literal
| 1 0 translate-x |
| 0 1 translate-y |
| 0 0      1      |
##

#Return  true if Matrix is identity, or translates ##

#Example
SkMatrix matrix;
for (SkScalar scaleX : { 1, 2 } ) {
    for (SkScalar translateX : { 0, 20 } ) {
        matrix.setAll(scaleX, 0, translateX,   0, 1, 0,    0, 0, 1);
        SkDebugf("is translate: %s\n", matrix.isTranslate() ? "true" : "false");
    }
}
#StdOut
is translate: true
is translate: true
is translate: false
is translate: false
##
##

#SeeAlso setTranslate getType

##

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

#Method bool rectStaysRect() const
#In Property
#Line # returns if mapped Rect can be represented by another Rect ##
Returns true Matrix maps Rect to another Rect. If true, Matrix is identity,
or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all
cases, Matrix may also have translation. Matrix form is either:

#Code
#Literal
| scale-x    0    translate-x |
|    0    scale-y translate-y |
|    0       0         1      |
##

or

#Code
#Literal
|    0     rotate-x translate-x |
| rotate-y    0     translate-y |
|    0        0          1      |
##

for non-zero values of scale-x, scale-y, rotate-x, and rotate-y.

Also called preservesAxisAlignment; use the one that provides better inline
documentation.

#Return  true if Matrix maps one Rect into another  ##

#Example
SkMatrix matrix;
for (SkScalar angle: { 0, 90, 180, 270 } ) {
    matrix.setRotate(angle);
    SkDebugf("rectStaysRect: %s\n", matrix.rectStaysRect() ? "true" : "false");
}
#StdOut
rectStaysRect: true
rectStaysRect: true
rectStaysRect: true
rectStaysRect: true
##
##

#SeeAlso preservesAxisAlignment preservesRightAngles

##

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

#Method bool preservesAxisAlignment() const
#In Property
#Line # returns if mapping restricts to 90 degree multiples and mirroring ##

Returns true Matrix maps Rect to another Rect. If true, Matrix is identity,
or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all
cases, Matrix may also have translation. Matrix form is either:

#Code
#Literal
| scale-x    0    translate-x |
|    0    scale-y translate-y |
|    0       0         1      |
##

or

#Code
#Literal
|    0     rotate-x translate-x |
| rotate-y    0     translate-y |
|    0        0          1      |
##

for non-zero values of scale-x, scale-y, rotate-x, and rotate-y.

Also called rectStaysRect; use the one that provides better inline
documentation.

#Return  true if Matrix maps one Rect into another  ##

#Example
SkMatrix matrix;
for (SkScalar angle: { 0, 90, 180, 270 } ) {
    matrix.setRotate(angle);
    SkDebugf("preservesAxisAlignment: %s\n", matrix.preservesAxisAlignment() ? "true" : "false");
}
#StdOut
preservesAxisAlignment: true
preservesAxisAlignment: true
preservesAxisAlignment: true
preservesAxisAlignment: true
##
##

#SeeAlso rectStaysRect preservesRightAngles

##

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

#Method bool hasPerspective() const
#In Property
#Line # returns if transform includes perspective ##
Returns true if the matrix contains perspective elements. Matrix form is:

#Code
#Literal
|       --            --              --          |
|       --            --              --          |
| perspective-x  perspective-y  perspective-scale |
##

where perspective-x or perspective-y is non-zero, or perspective-scale is
not one. All other elements may have any value.

#Return  true if Matrix is in most general form ##

#Example
#Image 4
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
canvas->concat(matrix);
SkString string;
string.printf("hasPerspective %s", matrix.hasPerspective() ? "true" : "false");
canvas->drawBitmap(source, 0, 0);
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(48);
canvas->drawString(string, 0, source.bounds().height() + 48, paint);
##

#SeeAlso setAll set9 MakeAll

##

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

#Method bool isSimilarity(SkScalar tol = SK_ScalarNearlyZero) const
#In Property
#Line # returns if transform is limited to square scale and rotation ##
Returns true if Matrix contains only translation, rotation, reflection, and
uniform scale.
Returns false if Matrix contains different scales, skewing, perspective, or
degenerate forms that collapse to a line or point.

Describes that the Matrix makes rendering with and without the matrix are
visually alike; a transformed circle remains a circle. Mathematically, this is
referred to as similarity of a Euclidean_Space, or a similarity transformation.

Preserves right angles, keeping the arms of the angle equal lengths.

#Param tol  to be deprecated ##

#Return  true if Matrix only rotates, uniformly scales, translates ##

#Example
#Description
String is drawn four times through but only two are visible. Drawing the pair
with isSimilarity false reveals the pair not visible through the matrix.
##
    SkPaint p;
    p.setAntiAlias(true);
    SkMatrix m;
    int below = 175;
    for (SkScalar sx : { -1, 1 } ) {
        for (SkScalar sy : { -1, 1 } ) {
            m.setAll(sx, 1, 128,    1, sy, 32,   0, 0, 1);
            bool isSimilarity = m.isSimilarity();
            SkString str;
            str.printf("sx: %g sy: %g sim: %s", sx, sy, isSimilarity ? "true" : "false");
            {
                SkAutoCanvasRestore autoRestore(canvas, true);
                canvas->concat(m);
                canvas->drawString(str, 0, 0, p);
            }
            if (!isSimilarity) {
                canvas->drawString(str, 40, below, p);
                below += 20;
            }
        }
    }
##

#SeeAlso isScaleTranslate preservesRightAngles rectStaysRect isFixedStepInX

##

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

#Method bool preservesRightAngles(SkScalar tol = SK_ScalarNearlyZero) const
#In Property
#Line # returns if mapped 90 angle remains 90 degrees ##
Returns true if Matrix contains only translation, rotation, reflection, and
scale. Scale may differ along rotated axes.
Returns false if Matrix skewing, perspective, or degenerate forms that collapse
to a line or point.

Preserves right angles, but not requiring that the arms of the angle
retain equal lengths.

#Param tol  to be deprecated ##

#Return  true if Matrix only rotates, scales, translates ##

#Example
#Height 128
#Description
Equal scale is both similar and preserves right angles.
Unequal scale is not similar but preserves right angles.
Skews are not similar and do not preserve right angles.
##
SkPaint p;
p.setAntiAlias(true);
SkMatrix m;
int pos = 0;
for (SkScalar sx : { 1, 2 } ) {
    for (SkScalar kx : { 0, 1 } ) {
        m.setAll(sx, kx, 16,    0, 1, 32,   0, 0, 1);
        bool isSimilarity = m.isSimilarity();
        bool preservesRightAngles = m.preservesRightAngles();
        SkString str;
        str.printf("sx: %g kx: %g %s %s", sx, kx, isSimilarity ? "sim" : "",
                    preservesRightAngles ? "right" : "");
        SkAutoCanvasRestore autoRestore(canvas, true);
        canvas->concat(m);
        canvas->drawString(str, 0, pos, p);
        pos += 20;
    }
}
##

#SeeAlso isScaleTranslate isSimilarity rectStaysRect isFixedStepInX

##

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

#Subtopic MemberIndex
#In Constant
#Line # member indices ##

#Code
    static constexpr int kMScaleX = 0;
    static constexpr int kMSkewX  = 1;
    static constexpr int kMTransX = 2;
    static constexpr int kMSkewY  = 3;
    static constexpr int kMScaleY = 4;
    static constexpr int kMTransY = 5;
    static constexpr int kMPersp0 = 6;
    static constexpr int kMPersp1 = 7;
    static constexpr int kMPersp2 = 8;
##

Matrix organizes its values in row order. These members correspond to
each value in Matrix.

#Const kMScaleX 0
#Line # horizontal scale factor ##
##
#Const kMSkewX 1
#Line # horizontal skew factor ##
##
#Const kMTransX 2
#Line # horizontal translation ##
##
#Const kMSkewY 3
#Line # vertical skew factor ##
##
#Const kMScaleY 4
#Line # vertical scale factor ##
##
#Const kMTransY 5
#Line # vertical translation ##
##
#Const kMPersp0 6
#Line # input x perspective factor ##
##
#Const kMPersp1 7
#Line # input y perspective factor ##
##
#Const kMPersp2 8
#Line # perspective bias ##
##

#Example
SkPaint black;
black.setAntiAlias(true);
black.setTextSize(48);
SkPaint gray = black;
gray.setColor(0xFF9f9f9f);
SkScalar offset[] = { 1.5f, 1.5f, 20,   1.5f, 1.5f, 20,   .03f, .01f, 2 };
for (int i : { SkMatrix::kMScaleX, SkMatrix::kMSkewX,  SkMatrix::kMTransX,
               SkMatrix::kMSkewY,  SkMatrix::kMScaleY, SkMatrix::kMTransY,
               SkMatrix::kMPersp0, SkMatrix::kMPersp1, SkMatrix::kMPersp2 } ) {
    SkMatrix m;
    m.setIdentity();
    m.set(i, offset[i]);
    SkAutoCanvasRestore autoRestore(canvas, true);
    canvas->translate(22 + (i % 3) * 88, 44 + (i / 3) * 88);
    canvas->drawString("&", 0, 0, gray);
    canvas->concat(m);
    canvas->drawString("&", 0, 0, black);
}
##

#SeeAlso get() set()

##

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

#Subtopic AffineIndex
#In Constant
#Line # affine member indices ##

#Code
    static constexpr int kAScaleX = 0;
    static constexpr int kASkewY  = 1;
    static constexpr int kASkewX  = 2;
    static constexpr int kAScaleY = 3;
    static constexpr int kATransX = 4;
    static constexpr int kATransY = 5;
##

Affine arrays are in column major order to match the matrix used by
PDF and XPS.

#Const kAScaleX 0
#Line # horizontal scale factor ##
##
#Const kASkewY 1
#Line # vertical skew factor ##
##
#Const kASkewX 2
#Line # horizontal skew factor ##
##
#Const kAScaleY 3
#Line # vertical scale factor ##
##
#Const kATransX 4
#Line # horizontal translation ##
##
#Const kATransY 5
#Line # vertical translation ##
##

#NoExample
##

#SeeAlso SetAffineIdentity asAffine setAffine

##

# ------------------------------------------------------------------------------
#Subtopic Operator
#Populate
##

#Method SkScalar operator[](int index)_const

#Line # returns Matrix value ##
Returns one matrix value. Asserts if index is out of range and SK_DEBUG is
defined.

#Param index  one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY,
                      kMPersp0, kMPersp1, kMPersp2
##

#Return  value corresponding to index ##

#Example
SkMatrix matrix;
matrix.setScale(42, 24);
SkDebugf("matrix[SkMatrix::kMScaleX] %c= 42\n", matrix[SkMatrix::kMScaleX] == 42 ? '=' : '!');
SkDebugf("matrix[SkMatrix::kMScaleY] %c= 24\n", matrix[SkMatrix::kMScaleY] == 24 ? '=' : '!');
#StdOut
matrix[SkMatrix::kMScaleX] == 42
matrix[SkMatrix::kMScaleY] == 24
##
##

#SeeAlso get set

##

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

#Method SkScalar get(int index) const
#In Property
#Line # returns one of nine Matrix values ##
Returns one matrix value. Asserts if index is out of range and SK_DEBUG is
defined.

#Param index  one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY,
                      kMPersp0, kMPersp1, kMPersp2
##

#Return  value corresponding to index ##

#Example
SkMatrix matrix;
matrix.setSkew(42, 24);
SkDebugf("matrix.get(SkMatrix::kMSkewX) %c= 42\n",
         matrix.get(SkMatrix::kMSkewX) == 42 ? '=' : '!');
SkDebugf("matrix.get(SkMatrix::kMSkewY) %c= 24\n",
         matrix.get(SkMatrix::kMSkewY) == 24 ? '=' : '!');
#StdOut
matrix.get(SkMatrix::kMSkewX) == 42
matrix.get(SkMatrix::kMSkewY) == 24
##
##

#SeeAlso operator[](int index) set

##

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

#Method SkScalar getScaleX() const
#In Property
#Line # returns horizontal scale factor ##
Returns scale factor multiplied by x-axis input, contributing to x-axis output.
With mapPoints, scales Points along the x-axis.

#Return  horizontal scale factor ##

#Example
SkMatrix matrix;
matrix.setScale(42, 24);
SkDebugf("matrix.getScaleX() %c= 42\n", matrix.getScaleX() == 42 ? '=' : '!');
#StdOut
matrix.getScaleX() == 42
##
##

#SeeAlso get getScaleY setScaleX setScale

##

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

#Method SkScalar getScaleY() const
#In Property
#Line # returns vertical scale factor ##
Returns scale factor multiplied by y-axis input, contributing to y-axis output.
With mapPoints, scales Points along the y-axis.

#Return  vertical scale factor ##

#Example
SkMatrix matrix;
matrix.setScale(42, 24);
SkDebugf("matrix.getScaleY() %c= 24\n", matrix.getScaleY() == 24 ? '=' : '!');
#StdOut
matrix.getScaleY() == 24
##
##

#SeeAlso get getScaleX setScaleY setScale

##

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

#Method SkScalar getSkewY() const
#In Property
#Line # returns vertical skew factor ##
Returns scale factor multiplied by x-axis input, contributing to y-axis output.
With mapPoints, skews Points along the y-axis.
Skewing both axes can rotate Points.

#Return  vertical skew factor ##

#Example
SkMatrix matrix;
matrix.setSkew(42, 24);
SkDebugf("matrix.getSkewY() %c= 24\n", matrix.getSkewY() == 24 ? '=' : '!');
#StdOut
matrix.getSkewY() == 24
##
##

#SeeAlso get getSkewX setSkewY setSkew

##

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

#Method SkScalar getSkewX() const
#In Property
#Line # returns horizontal skew factor ##
Returns scale factor multiplied by y-axis input, contributing to x-axis output.
With mapPoints, skews Points along the x-axis.
Skewing both axes can rotate Points.

#Return  horizontal scale factor ##

#Example
SkMatrix matrix;
matrix.setSkew(42, 24);
SkDebugf("matrix.getSkewX() %c= 42\n", matrix.getSkewX() == 42 ? '=' : '!');
#StdOut
matrix.getSkewX() == 42
##
##

#SeeAlso get getSkewY setSkewX setSkew

##

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

#Method SkScalar getTranslateX() const
#In Property
#Line # returns horizontal translation ##
Returns translation contributing to x-axis output.
With mapPoints, moves Points along the x-axis.

#Return  horizontal translation factor ##

#Example
SkMatrix matrix;
matrix.setTranslate(42, 24);
SkDebugf("matrix.getTranslateX() %c= 42\n", matrix.getTranslateX() == 42 ? '=' : '!');
#StdOut
matrix.getTranslateX() == 42
##
##

#SeeAlso get getTranslateY setTranslateX setTranslate

##

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

#Method SkScalar getTranslateY() const
#In Property
#Line # returns vertical translation ##
Returns translation contributing to y-axis output.
With mapPoints, moves Points along the y-axis.

#Return  vertical translation factor ##

#Example
SkMatrix matrix;
matrix.setTranslate(42, 24);
SkDebugf("matrix.getTranslateY() %c= 24\n", matrix.getTranslateY() == 24 ? '=' : '!');
#StdOut
matrix.getTranslateY() == 24
##
##

#SeeAlso get getTranslateX setTranslateY setTranslate

##

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

#Method SkScalar getPerspX() const
#In Property
#Line # returns input x perspective factor ##
Returns factor scaling input x-axis relative to input y-axis.

#Return  input x-axis perspective factor ##

#Example
    SkMatrix m;
    m.setIdentity();
    m.set(SkMatrix::kMPersp0, -0.004f);
    SkAutoCanvasRestore autoRestore(canvas, true);
    canvas->translate(22, 144);
    SkPaint black;
    black.setAntiAlias(true);
    black.setTextSize(24);
    SkPaint gray = black;
    gray.setColor(0xFF9f9f9f);
    SkString string;
    string.appendScalar(m.getPerspX());
    canvas->drawString(string, 0, -72, gray);
    canvas->concat(m);
    canvas->drawString(string, 0, 0, black);
##

#SeeAlso kMPersp0 getPerspY

##

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

#Method SkScalar getPerspY() const
#In Property
#Line # returns input y perspective factor ##

Returns factor scaling input y-axis relative to input x-axis.

#Return  input y-axis perspective factor ##

#Example
    SkMatrix m;
    m.setIdentity();
    m.set(SkMatrix::kMPersp1, -0.004f);
    SkAutoCanvasRestore autoRestore(canvas, true);
    canvas->translate(22, 144);
    SkPaint black;
    black.setAntiAlias(true);
    black.setTextSize(24);
    SkPaint gray = black;
    gray.setColor(0xFF9f9f9f);
    SkString string;
    string.appendScalar(m.getPerspY());
    canvas->drawString(string, 0, -72, gray);
    canvas->concat(m);
    canvas->drawString(string, 0, 0, black);
##

#SeeAlso kMPersp1 getPerspX

##

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

#Method SkScalar& operator[](int index)

#Line # returns writable reference to Matrix value ##
Returns writable Matrix value. Asserts if index is out of range and SK_DEBUG is
defined. Clears internal cache anticipating that caller will change Matrix value.

Next call to read Matrix state may recompute cache; subsequent writes to Matrix
value must be followed by dirtyMatrixTypeCache.

#Param index  one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY,
                      kMPersp0, kMPersp1, kMPersp2
##

#Return  writable value corresponding to index ##

#Example
SkMatrix matrix;
matrix.setIdentity();
SkDebugf("with identity matrix: x = %g\n", matrix.mapXY(24, 42).fX);
SkScalar& skewRef = matrix[SkMatrix::kMSkewX];
skewRef = 0;
SkDebugf("after skew x mod:     x = %g\n", matrix.mapXY(24, 42).fX);
skewRef = 1;
SkDebugf("after 2nd skew x mod: x = %g\n", matrix.mapXY(24, 42).fX);
matrix.dirtyMatrixTypeCache();
SkDebugf("after dirty cache:    x = %g\n", matrix.mapXY(24, 42).fX);
#StdOut
with identity matrix: x = 24
after skew x mod:     x = 24
after 2nd skew x mod: x = 24
after dirty cache:    x = 66
##
##

#SeeAlso get dirtyMatrixTypeCache set

##

# ------------------------------------------------------------------------------
#Subtopic Set
#Populate
#Line # sets one or more matrix values ##
##

#Method void set(int index, SkScalar value)
#In Set
#Line # sets one value ##
Sets Matrix value. Asserts if index is out of range and SK_DEBUG is
defined. Safer than operator[]; internal cache is always maintained.

#Param index  one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY,
                      kMPersp0, kMPersp1, kMPersp2
##
#Param value  Scalar to store in Matrix ##

#Example
SkMatrix matrix;
matrix.setIdentity();
SkDebugf("with identity matrix: x = %g\n", matrix.mapXY(24, 42).fX);
matrix.set(SkMatrix::kMSkewX, 0);
SkDebugf("after skew x mod:     x = %g\n", matrix.mapXY(24, 42).fX);
matrix.set(SkMatrix::kMSkewX, 1);
SkDebugf("after 2nd skew x mod: x = %g\n", matrix.mapXY(24, 42).fX);
#StdOut
with identity matrix: x = 24
after skew x mod:     x = 24
after 2nd skew x mod: x = 66
##
##

#SeeAlso operator[] get

#Method ##

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

#Method void setScaleX(SkScalar v)
#In Set
#Line # sets horizontal scale factor ##
Sets horizontal scale factor.

#Param v  horizontal scale factor to store ##

#Example
#Height 64
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 12, 24, paint);
SkMatrix matrix;
matrix.setIdentity();
matrix.setScaleX(3);
canvas->concat(matrix);
canvas->drawString("x scale", 0, 48, paint);
##

#SeeAlso set setScale setScaleY

#Method ##

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

#Method void setScaleY(SkScalar v)
#In Set
#Line # sets vertical scale factor ##
Sets vertical scale factor.

#Param v  vertical scale factor to store ##

#Example
#Height 192
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 12, 24, paint);
SkMatrix matrix;
matrix.setIdentity();
matrix.setScaleY(3);
canvas->concat(matrix);
canvas->drawString("y scale", 12, 48, paint);
##

#SeeAlso set setScale setScaleX

#Method ##

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

#Method void setSkewY(SkScalar v)
#In Set
#Line # sets vertical skew factor ##
Sets vertical skew factor.

#Param v  vertical skew factor to store ##

#Example
#Height 96
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 12, 24, paint);
SkMatrix matrix;
matrix.setIdentity();
matrix.setSkewY(.3f);
canvas->concat(matrix);
canvas->drawString("y skew", 12, 48, paint);
##

#SeeAlso set setSkew setSkewX

#Method ##

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

#Method void setSkewX(SkScalar v)
#In Set
#Line # sets horizontal skew factor ##
Sets horizontal skew factor.

#Param v  horizontal skew factor to store ##

#Example
#Height 64
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 12, 24, paint);
SkMatrix matrix;
matrix.setIdentity();
matrix.setSkewX(-.7f);
canvas->concat(matrix);
canvas->drawString("x skew", 36, 48, paint);
##

#SeeAlso set setSkew setSkewX

#Method ##

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

#Method void setTranslateX(SkScalar v)
#In Set
#Line # sets horizontal translation ##
Sets horizontal translation.

#Param v  horizontal translation to store ##

#Example
#Height 48
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 8, 24, paint);
SkMatrix matrix;
matrix.setIdentity();
matrix.setTranslateX(96);
canvas->concat(matrix);
canvas->drawString("x translate", 8, 24, paint);
##

#SeeAlso set setTranslate setTranslateY

#Method ##

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

#Method void setTranslateY(SkScalar v)
#In Set
#Line # sets vertical translation ##
Sets vertical translation.

#Param v  vertical translation to store ##

#Example
#Height 64
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 8, 24, paint);
SkMatrix matrix;
matrix.setIdentity();
matrix.setTranslateY(24);
canvas->concat(matrix);
canvas->drawString("y translate", 8, 24, paint);
##

#SeeAlso set setTranslate setTranslateX

#Method ##

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

#Method void setPerspX(SkScalar v)
#In Set
#Line # sets input x perspective factor ##
Sets input x-axis perspective factor, which causes mapXY to vary input x-axis values
inversely proportional to input y-axis values.

#Param v  perspective factor ##

#Example
#Image 4
for (SkScalar perspX : { -.003f, 0.f, .003f, .012f } ) {
    SkMatrix matrix;
    matrix.setIdentity();
    matrix.setPerspX(perspX);
    canvas->save();
    canvas->concat(matrix);
    canvas->drawBitmap(source, 0, 0);
    canvas->restore();
    canvas->translate(64, 64);
}
##

#SeeAlso getPerspX set setAll set9 MakeAll

#Method ##

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

#Method void setPerspY(SkScalar v)
#In Set
#Line # sets input y perspective factor ##
Sets input y-axis perspective factor, which causes mapXY to vary input y-axis values
inversely proportional to input x-axis values.

#Param v  perspective factor ##

#Example
#Image 4
for (SkScalar perspX : { -.003f, 0.f, .003f, .012f } ) {
    SkMatrix matrix;
    matrix.setIdentity();
    matrix.setPerspY(perspX);
    canvas->save();
    canvas->concat(matrix);
    canvas->drawBitmap(source, 0, 0);
    canvas->restore();
    canvas->translate(64, 64);
}
##

#SeeAlso getPerspY set setAll set9 MakeAll

#Method ##

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

#Method void setAll(SkScalar scaleX, SkScalar skewX,  SkScalar transX,
                SkScalar skewY,  SkScalar scaleY, SkScalar transY,
                SkScalar persp0, SkScalar persp1, SkScalar persp2)
#In Set
#Line # sets all values from parameters ##

Sets all values from parameters. Sets matrix to:

#Code
#Literal
| scaleX  skewX transX |
|  skewY scaleY transY |
| persp0 persp1 persp2 |
##

#Param scaleX  horizontal scale factor to store ##
#Param skewX  horizontal skew factor to store ##
#Param transX  horizontal translation to store ##
#Param skewY  vertical skew factor to store ##
#Param scaleY  vertical scale factor to store ##
#Param transY  vertical translation to store ##
#Param persp0  input x-axis values perspective factor to store ##
#Param persp1  input y-axis values perspective factor to store ##
#Param persp2  perspective scale factor to store ##

#Example
#Height 128
    SkPaint p;
    p.setAntiAlias(true);
    p.setTextSize(64);
    SkMatrix m;
    for (SkScalar sx : { -1, 1 } ) {
        for (SkScalar sy : { -1, 1 } ) {
            SkAutoCanvasRestore autoRestore(canvas, true);
            m.setAll(sx, 1, 128,    0, sy, 64,   0, 0, 1);
            canvas->concat(m);
            canvas->drawString("K", 0, 0, p);
        }
    }
##

#SeeAlso set9 MakeAll

#Method ##

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

#Method void get9(SkScalar buffer[9]) const
#In Property
#Line # returns all nine Matrix values ##
Copies nine Scalar values contained by Matrix into buffer, in member value
ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY,
kMPersp0, kMPersp1, kMPersp2.

#Param buffer  storage for nine Scalar values ##

#Example
SkMatrix matrix = SkMatrix::MakeRectToRect({0, 0, 1, 1}, {3, 4, 7, 9},
                                           SkMatrix::kFill_ScaleToFit);
SkScalar b[9];
matrix.get9(b);
SkDebugf("{%g, %g, %g},\n{%g, %g, %g},\n{%g, %g, %g}\n", b[0], b[1], b[2],
         b[3], b[4], b[5], b[6], b[7], b[8]);
#StdOut
{4, 0, 3},
{0, 5, 4},
{0, 0, 1}
##
##

#SeeAlso set9

#Method ##

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

#Method void set9(const SkScalar buffer[9])
#In Set
#In Constructor
#Line # sets all values from Scalar array ##
Sets Matrix to nine Scalar values in buffer, in member value ascending order:
kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1,
kMPersp2.

Sets matrix to:

#Code
#Literal
| buffer[0] buffer[1] buffer[2] |
| buffer[3] buffer[4] buffer[5] |
| buffer[6] buffer[7] buffer[8] |
##

In the future, set9 followed by get9 may not return the same values. Since Matrix
maps non-homogeneous coordinates, scaling all nine values produces an equivalent
transformation, possibly improving precision.

#Param buffer  nine Scalar values ##

#Example
#Image 4
SkMatrix m;
SkScalar buffer[9] = {4, 0, 3,    0, 5, 4,     0, 0, 1};
m.set9(buffer);
canvas->concat(m);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso setAll get9 MakeAll

#Method ##

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

#Method void reset()
#In Constructor
#In Set
#Line # sets Matrix to identity ##
Sets Matrix to identity; which has no effect on mapped Points. Sets Matrix to:

#Code
#Literal
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
##

Also called setIdentity(); use the one that provides better inline
documentation.

#Example
SkMatrix m;
m.reset();
SkDebugf("m.isIdentity(): %s\n", m.isIdentity() ? "true" : "false");
#StdOut
m.isIdentity(): true
##
##

#SeeAlso isIdentity setIdentity

#Method ##

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

#Method void setIdentity()
#In Constructor
#In Set
#Line # sets Matrix to identity ##
Sets Matrix to identity; which has no effect on mapped Points. Sets Matrix to:

#Code
#Literal
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
##

Also called reset(); use the one that provides better inline
documentation.

#Example
SkMatrix m;
m.setIdentity();
SkDebugf("m.isIdentity(): %s\n", m.isIdentity() ? "true" : "false");
#StdOut
m.isIdentity(): true
##
##

#SeeAlso isIdentity reset

#Method ##

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

#Method void setTranslate(SkScalar dx, SkScalar dy)
#In Constructor
#In Set
#Line # sets to translate in x and y ##
Sets Matrix to translate by (dx, dy).

#Param dx  horizontal translation ##
#Param dy  vertical translation ##

#Example
#Height 64
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 8, 24, paint);
SkMatrix matrix;
matrix.setTranslate(96, 24);
canvas->concat(matrix);
canvas->drawString("translate", 8, 24, paint);
##

#SeeAlso setTranslateX setTranslateY

#Method ##

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

#Method void setTranslate(const SkVector& v)

Sets Matrix to translate by (v.fX, v.fY).

#Param v  Vector containing horizontal and vertical translation ##

#Example
#Height 64
SkPaint paint;
paint.setAntiAlias(true);
paint.setTextSize(24);
canvas->drawString("normal", 8, 24, paint);
SkMatrix matrix;
matrix.setTranslate({96, 24});
canvas->concat(matrix);
canvas->drawString("translate", 8, 24, paint);
##

#SeeAlso setTranslateX setTranslateY MakeTrans

#Method ##

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

#Method void setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
#In Constructor
#In Set
#Line # sets to scale about a point ##
Sets Matrix to scale by sx and sy, about a pivot point at (px, py).
The pivot point is unchanged when mapped with Matrix.

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Height 128
    SkPaint p;
    p.setAntiAlias(true);
    p.setTextSize(64);
    SkMatrix m;
    for (SkScalar sx : { -1, 1 } ) {
        for (SkScalar sy : { -1, 1 } ) {
            SkAutoCanvasRestore autoRestore(canvas, true);
            m.setScale(sx, sy, 128, 64);
            canvas->concat(m);
            canvas->drawString("%", 128, 64, p);
        }
    }
##

#SeeAlso setScaleX setScaleY MakeScale preScale postScale

#Method ##

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

#Method void setScale(SkScalar sx, SkScalar sy)

Sets Matrix to scale by sx and sy about at pivot point at (0, 0).

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##

#Example
#Height 128
    SkPaint p;
    p.setAntiAlias(true);
    p.setTextSize(64);
    SkMatrix m;
    for (SkScalar sx : { -1, 1 } ) {
        for (SkScalar sy : { -1, 1 } ) {
            SkAutoCanvasRestore autoRestore(canvas, true);
            m.setScale(sx, sy);
            m.postTranslate(128, 64);
            canvas->concat(m);
            canvas->drawString("@", 0, 0, p);
        }
    }
##

#SeeAlso setScaleX setScaleY MakeScale preScale postScale

#Method ##

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

#Method void setRotate(SkScalar degrees, SkScalar px, SkScalar py)
#In Constructor
#In Set
#Line # sets to rotate about a point ##
Sets Matrix to rotate by degrees about a pivot point at (px, py).
The pivot point is unchanged when mapped with Matrix.

Positive degrees rotates clockwise.

#Param degrees  angle of axes relative to upright axes ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Height 128
    SkPaint paint;
    paint.setColor(SK_ColorGRAY);
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    canvas->drawRect(rect, paint);
    paint.setColor(SK_ColorRED);
    SkMatrix matrix;
    matrix.setRotate(25, rect.centerX(), rect.centerY());
    canvas->concat(matrix);
    canvas->drawRect(rect, paint);
##

#SeeAlso setSinCos preRotate postRotate

#Method ##

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

#Method void setRotate(SkScalar degrees)

Sets Matrix to rotate by degrees about a pivot point at (0, 0).
Positive degrees rotates clockwise.

#Param degrees  angle of axes relative to upright axes ##

#Example
#Height 128
    SkPaint paint;
    paint.setColor(SK_ColorGRAY);
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    canvas->drawRect(rect, paint);
    paint.setColor(SK_ColorRED);
    SkMatrix matrix;
    matrix.setRotate(25);
    canvas->translate(rect.centerX(), rect.centerY());
    canvas->concat(matrix);
    canvas->translate(-rect.centerX(), -rect.centerY());
    canvas->drawRect(rect, paint);
##

#SeeAlso setSinCos preRotate postRotate

#Method ##

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

#Method void setSinCos(SkScalar sinValue, SkScalar cosValue,
                   SkScalar px, SkScalar py)
#In Constructor
#In Set
#Line # sets to rotate and scale about a point ##

Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py).
The pivot point is unchanged when mapped with Matrix.

Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1).
Vector length specifies scale.

#Param sinValue  rotation vector x-axis component ##
#Param cosValue  rotation vector y-axis component ##
#Param px  pivot x-axis ##
#Param py  pivot y-axis ##

#Example
#Height 128
    SkPaint paint;
    paint.setColor(SK_ColorGRAY);
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    canvas->drawRect(rect, paint);
    paint.setColor(SK_ColorRED);
    SkMatrix matrix;
    matrix.setSinCos(.25f, .85f, rect.centerX(), rect.centerY());
    canvas->concat(matrix);
    canvas->drawRect(rect, paint);
##

#SeeAlso setRotate setScale setRSXform

#Method ##

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

#Method void setSinCos(SkScalar sinValue, SkScalar cosValue)

Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (0, 0).

Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1).
Vector length specifies scale.

#Param sinValue  rotation vector x-axis component ##
#Param cosValue  rotation vector y-axis component ##

#Example
#Description
Canvas needs offset after applying Matrix to pivot about Rect center.
##
#Height 128
    SkPaint paint;
    paint.setColor(SK_ColorGRAY);
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    canvas->drawRect(rect, paint);
    paint.setColor(SK_ColorRED);
    SkMatrix matrix;
    matrix.setSinCos(.25f, .85f);
    matrix.postTranslate(rect.centerX(), rect.centerY());
    canvas->concat(matrix);
    canvas->translate(-rect.centerX(), -rect.centerY());
    canvas->drawRect(rect, paint);
##

#SeeAlso setRotate setScale setRSXform

#Method ##

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

#Method SkMatrix& setRSXform(const SkRSXform& rsxForm)
#In Constructor
#In Set
#Line # sets to rotate, scale, and translate ##
Sets Matrix to rotate, scale, and translate using a compressed matrix form.

Vector (rsxForm.fSSin, rsxForm.fSCos) describes the angle of rotation relative
to (0, 1). Vector length specifies scale. Mapped point is rotated and scaled
by Vector, then translated by (rsxForm.fTx, rsxForm.fTy).

#Param rsxForm  compressed RSXform matrix ##

#Return  reference to Matrix ##

#Example
#Description
Canvas needs offset after applying Matrix to pivot about Rect center.
##
#Height 128
    SkPaint paint;
    paint.setColor(SK_ColorGRAY);
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    canvas->drawRect(rect, paint);
    paint.setColor(SK_ColorRED);
    SkMatrix matrix;
    matrix.setRSXform(SkRSXform::Make(.85f, .25f, rect.centerX(), rect.centerY()));
    canvas->concat(matrix);
    canvas->translate(-rect.centerX(), -rect.centerY());
    canvas->drawRect(rect, paint);
##

#SeeAlso setSinCos setScale setTranslate

#Method ##

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

#Method void setSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
#In Constructor
#In Set
#Line # sets to skew about a point ##
Sets Matrix to skew by kx and ky, about a pivot point at (px, py).
The pivot point is unchanged when mapped with Matrix.

#Param kx  horizontal skew factor ##
#Param ky  vertical skew factor ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
    SkPaint p;
    p.setAntiAlias(true);
    p.setTextSize(48);
    SkMatrix m;
    for (SkScalar sx : { -1, 0, 1 } ) {
        for (SkScalar sy : { -1, 0, 1 } ) {
            SkAutoCanvasRestore autoRestore(canvas, true);
            m.setSkew(sx, sy, 96 + 64 * sx, 128 + 48 * sy);
            canvas->concat(m);
            canvas->drawString("K", 96 + 64 * sx, 128 + 48 * sy, p);
        }
    }
##

#SeeAlso setSkewX setSkewY preSkew postSkew

#Method ##

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

#Method void setSkew(SkScalar kx, SkScalar ky)

Sets Matrix to skew by kx and ky, about a pivot point at (0, 0).

#Param kx  horizontal skew factor ##
#Param ky  vertical skew factor ##

#Example
    SkPaint p;
    p.setAntiAlias(true);
    p.setTextSize(48);
    SkMatrix m;
    for (SkScalar sx : { -1, 0, 1 } ) {
        for (SkScalar sy : { -1, 0, 1 } ) {
            SkAutoCanvasRestore autoRestore(canvas, true);
            m.setSkew(sx, sy);
            m.postTranslate(96 + 64 * sx, 128 + 48 * sy);
            canvas->concat(m);
            canvas->drawString("K", 0, 0, p);
        }
    }
##

#SeeAlso setSkewX setSkewY preSkew postSkew

#Method ##

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

#Method void setConcat(const SkMatrix& a, const SkMatrix& b)
#In Constructor
#In Set
#Line # sets to Matrix parameter multiplied by Matrix parameter ##
Sets Matrix to Matrix a multiplied by Matrix b. Either a or b may be this.

Given:

#Code
#Literal
    | A B C |      | J K L |
a = | D E F |, b = | M N O |
    | G H I |      | P Q R |
##

sets Matrix to:

#Code
#Literal
        | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
        | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
##

#Param a  Matrix on left side of multiply expression ##
#Param b  Matrix on right side of multiply expression ##

#Example
#Image 3
#Description
setPolyToPoly creates perspective matrices, one the inverse of the other.
Multiplying the matrix by its inverse turns into an identity matrix.
##
SkMatrix matrix, matrix2;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix2.setPolyToPoly(perspect, bitmapBounds, 4);
matrix.setConcat(matrix, matrix2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso Concat preConcat postConcat SkCanvas::concat

#Method ##

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

#Method void preTranslate(SkScalar dx, SkScalar dy)
#In Set
#In Operator
#Line # pre-multiplies Matrix by translation ##
Sets Matrix to Matrix multiplied by Matrix constructed from translation (dx, dy).
This can be thought of as moving the point to be mapped before applying Matrix.

Given:

#Code
#Literal
         | A B C |               | 1 0 dx |
Matrix = | D E F |,  T(dx, dy) = | 0 1 dy |
         | G H I |               | 0 0  1 |
##

sets Matrix to:

#Code
#Literal
                     | A B C | | 1 0 dx |   | A B A*dx+B*dy+C |
Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F |
                     | G H I | | 0 0  1 |   | G H G*dx+H*dy+I |
##

#Param dx  x-axis translation before applying Matrix ##
#Param dy  y-axis translation before applying Matrix ##

#Example
#Height 160
    SkPaint paint;
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    for (int i = 0; i < 2; ++i ) {
        SkMatrix matrix;
        i == 0 ? matrix.reset(): matrix.setRotate(25, rect.centerX(), 320);
        {
            SkAutoCanvasRestore acr(canvas, true);
            canvas->concat(matrix);
            paint.setColor(SK_ColorGRAY);
            canvas->drawRect(rect, paint);
        }
        paint.setColor(SK_ColorRED);
        for (int j = 0; j < 2; ++j ) {
            SkAutoCanvasRestore acr(canvas, true);
            matrix.preTranslate(40, 40);
            canvas->concat(matrix);
            canvas->drawCircle(0, 0, 3, paint);
        }
    }
##

#SeeAlso postTranslate setTranslate MakeTrans

#Method ##

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

#Method void preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
#In Set
#In Operator
#Line # pre-multiplies Matrix by scale ##
Sets Matrix to Matrix multiplied by Matrix constructed from scaling by (sx, sy)
about pivot point (px, py).
This can be thought of as scaling about a pivot point before applying Matrix.

Given:

#Code
#Literal
         | A B C |                       | sx  0 dx |
Matrix = | D E F |,  S(sx, sy, px, py) = |  0 sy dy |
         | G H I |                       |  0  0  1 |
##

where

#Code
#Literal
dx = px - sx * px
dy = py - sy * py
##

sets Matrix to:

#Code
#Literal
                             | A B C | | sx  0 dx |   | A*sx B*sy A*dx+B*dy+C |
Matrix * S(sx, sy, px, py) = | D E F | |  0 sy dy | = | D*sx E*sy D*dx+E*dy+F |
                             | G H I | |  0  0  1 |   | G*sx H*sy G*dx+H*dy+I |
##

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.preScale(.75f, 1.5f, source.width() / 2, source.height() / 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postScale setScale MakeScale

#Method ##

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

#Method void preScale(SkScalar sx, SkScalar sy)
#In Set
#In Operator
Sets Matrix to Matrix multiplied by Matrix constructed from scaling by (sx, sy)
about pivot point (0, 0).
This can be thought of as scaling about the origin before applying Matrix.

Given:

#Code
#Literal
         | A B C |               | sx  0  0 |
Matrix = | D E F |,  S(sx, sy) = |  0 sy  0 |
         | G H I |               |  0  0  1 |
##

sets Matrix to:

#Code
#Literal
                     | A B C | | sx  0  0 |   | A*sx B*sy C |
Matrix * S(sx, sy) = | D E F | |  0 sy  0 | = | D*sx E*sy F |
                     | G H I | |  0  0  1 |   | G*sx H*sy I |
##

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.preScale(.75f, 1.5f);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postScale setScale MakeScale

#Method ##

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

#Method void preRotate(SkScalar degrees, SkScalar px, SkScalar py)
#In Set
#In Operator
#Line # pre-multiplies Matrix by rotation ##
Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees
about pivot point (px, py).
This can be thought of as rotating about a pivot point before applying Matrix.

Positive degrees rotates clockwise.

Given:

#Code
#Literal
         | A B C |                        | c -s dx |
Matrix = | D E F |,  R(degrees, px, py) = | s  c dy |
         | G H I |                        | 0  0  1 |
##

where

#Code
#Literal
c  = cos(degrees)
s  = sin(degrees)
dx =  s * py + (1 - c) * px
dy = -s * px + (1 - c) * py
##

sets Matrix to:

#Code
#Literal
                              | A B C | | c -s dx |   | Ac+Bs -As+Bc A*dx+B*dy+C |
Matrix * R(degrees, px, py) = | D E F | | s  c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F |
                              | G H I | | 0  0  1 |   | Gc+Hs -Gs+Hc G*dx+H*dy+I |
##

#Param degrees  angle of axes relative to upright axes ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.preRotate(45, source.width() / 2, source.height() / 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postRotate setRotate

#Method ##

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

#Method void preRotate(SkScalar degrees)

Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees
about pivot point (0, 0).
This can be thought of as rotating about the origin before applying Matrix.

Positive degrees rotates clockwise.

Given:

#Code
#Literal
         | A B C |                        | c -s 0 |
Matrix = | D E F |,  R(degrees, px, py) = | s  c 0 |
         | G H I |                        | 0  0 1 |
##

where

#Code
#Literal
c  = cos(degrees)
s  = sin(degrees)
##

sets Matrix to:

#Code
#Literal
                              | A B C | | c -s 0 |   | Ac+Bs -As+Bc C |
Matrix * R(degrees, px, py) = | D E F | | s  c 0 | = | Dc+Es -Ds+Ec F |
                              | G H I | | 0  0 1 |   | Gc+Hs -Gs+Hc I |
##

#Param degrees  angle of axes relative to upright axes ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.preRotate(45);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postRotate setRotate

#Method ##

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

#Method void preSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
#In Set
#In Operator
#Line # pre-multiplies Matrix by skew ##
Sets Matrix to Matrix multiplied by Matrix constructed from skewing by (kx, ky)
about pivot point (px, py).
This can be thought of as skewing about a pivot point before applying Matrix.

Given:

#Code
#Literal
         | A B C |                       |  1 kx dx |
Matrix = | D E F |,  K(kx, ky, px, py) = | ky  1 dy |
         | G H I |                       |  0  0  1 |
##

where

#Code
#Literal
dx = -kx * py
dy = -ky * px
##

sets Matrix to:

#Code
#Literal
                             | A B C | |  1 kx dx |   | A+B*ky A*kx+B A*dx+B*dy+C |
Matrix * K(kx, ky, px, py) = | D E F | | ky  1 dy | = | D+E*ky D*kx+E D*dx+E*dy+F |
                             | G H I | |  0  0  1 |   | G+H*ky G*kx+H G*dx+H*dy+I |
##

#Param kx  horizontal skew factor ##
#Param ky  vertical skew factor ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.preSkew(.5f, 0, source.width() / 2, source.height() / 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postSkew setSkew

#Method ##

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

#Method void preSkew(SkScalar kx, SkScalar ky)

Sets Matrix to Matrix multiplied by Matrix constructed from skewing by (kx, ky)
about pivot point (0, 0).
This can be thought of as skewing about the origin before applying Matrix.

Given:

#Code
#Literal
         | A B C |               |  1 kx 0 |
Matrix = | D E F |,  K(kx, ky) = | ky  1 0 |
         | G H I |               |  0  0 1 |
##

sets Matrix to:

#Code
#Literal
                     | A B C | |  1 kx 0 |   | A+B*ky A*kx+B C |
Matrix * K(kx, ky) = | D E F | | ky  1 0 | = | D+E*ky D*kx+E F |
                     | G H I | |  0  0 1 |   | G+H*ky G*kx+H I |
##

#Param kx  horizontal skew factor ##
#Param ky  vertical skew factor ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.preSkew(.5f, 0);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postSkew setSkew

#Method ##

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

#Method void preConcat(const SkMatrix& other)
#In Set
#In Operator
#Line # pre-multiplies Matrix by Matrix parameter ##
Sets Matrix to Matrix multiplied by Matrix other.
This can be thought of mapping by other before applying Matrix.

Given:

#Code
#Literal
         | A B C |          | J K L |
Matrix = | D E F |, other = | M N O |
         | G H I |          | P Q R |
##

sets Matrix to:

#Code
#Literal
                 | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
Matrix * other = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
                 | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
##

#Param other  Matrix on right side of multiply expression ##

#Example
#Image 3
#Description
setPolyToPoly creates perspective matrices, one the inverse of the other.
Multiplying the matrix by its inverse turns into an identity matrix.
##
SkMatrix matrix, matrix2;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix2.setPolyToPoly(perspect, bitmapBounds, 4);
matrix.preConcat(matrix2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postConcat setConcat Concat

#Method ##

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

#Method void postTranslate(SkScalar dx, SkScalar dy)
#In Set
#In Operator
#Line # post-multiplies Matrix by translation ##
Sets Matrix to Matrix constructed from translation (dx, dy) multiplied by Matrix.
This can be thought of as moving the point to be mapped after applying Matrix.

Given:

#Code
#Literal
         | J K L |               | 1 0 dx |
Matrix = | M N O |,  T(dx, dy) = | 0 1 dy |
         | P Q R |               | 0 0  1 |
##

sets Matrix to:

#Code
#Literal
                     | 1 0 dx | | J K L |   | J+dx*P K+dx*Q L+dx*R |
T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R |
                     | 0 0  1 | | P Q R |   |      P      Q      R |
##

#Param dx  x-axis translation after applying Matrix ##
#Param dy  y-axis translation after applying Matrix ##

#Example
#Height 160
#Description
Compare with preTranslate example.
##
    SkPaint paint;
    paint.setAntiAlias(true);
    SkRect rect = {20, 20, 100, 100};
    for (int i = 0; i < 2; ++i ) {
        SkMatrix matrix;
        i == 0 ? matrix.reset(): matrix.setRotate(25, rect.centerX(), 320);
        {
            SkAutoCanvasRestore acr(canvas, true);
            canvas->concat(matrix);
            paint.setColor(SK_ColorGRAY);
            canvas->drawRect(rect, paint);
        }
        paint.setColor(SK_ColorRED);
        for (int j = 0; j < 2; ++j ) {
            SkAutoCanvasRestore acr(canvas, true);
            matrix.postTranslate(40, 40);
            canvas->concat(matrix);
            canvas->drawCircle(0, 0, 3, paint);
        }
    }
##

#SeeAlso preTranslate setTranslate MakeTrans

#Method ##

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

#Method void postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
#In Set
#In Operator
#Line # post-multiplies Matrix by scale ##
Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point
(px, py), multiplied by Matrix.
This can be thought of as scaling about a pivot point after applying Matrix.

Given:

#Code
#Literal
         | J K L |                       | sx  0 dx |
Matrix = | M N O |,  S(sx, sy, px, py) = |  0 sy dy |
         | P Q R |                       |  0  0  1 |
##

where

#Code
#Literal
dx = px - sx * px
dy = py - sy * py
##

sets Matrix to:

#Code
#Literal
                             | sx  0 dx | | J K L |   | sx*J+dx*P sx*K+dx*Q sx*L+dx+R |
S(sx, sy, px, py) * Matrix = |  0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R |
                             |  0  0  1 | | P Q R |   |         P         Q         R |
##

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postScale(.75f, 1.5f, source.width() / 2, source.height() / 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preScale setScale MakeScale

##

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

#Method void postScale(SkScalar sx, SkScalar sy)

Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point
(0, 0), multiplied by Matrix.
This can be thought of as scaling about the origin after applying Matrix.

Given:

#Code
#Literal
         | J K L |               | sx  0  0 |
Matrix = | M N O |,  S(sx, sy) = |  0 sy  0 |
         | P Q R |               |  0  0  1 |
##

sets Matrix to:

#Code
#Literal
                     | sx  0  0 | | J K L |   | sx*J sx*K sx*L |
S(sx, sy) * Matrix = |  0 sy  0 | | M N O | = | sy*M sy*N sy*O |
                     |  0  0  1 | | P Q R |   |    P    Q    R |
##

#Param sx  horizontal scale factor ##
#Param sy  vertical scale factor ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postScale(.75f, 1.5f);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preScale setScale MakeScale

##

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

#Method bool postIDiv(int divx, int divy)
#In Set
#In Operator
#Line # post-multiplies Matrix by inverse scale ##
Sets Matrix to Matrix constructed from scaling by
#Formula
(1/divx, 1/divy)
##
about pivot point (px, py), multiplied by Matrix.

Returns false if either divx or divy is zero.

Given:

#Code
#Literal
         | J K L |                   | sx  0  0 |
Matrix = | M N O |,  I(divx, divy) = |  0 sy  0 |
         | P Q R |                   |  0  0  1 |
##

where

#Code
#Literal
sx = 1 / divx
sy = 1 / divy
##

sets Matrix to:

#Code
#Literal
                         | sx  0  0 | | J K L |   | sx*J sx*K sx*L |
I(divx, divy) * Matrix = |  0 sy  0 | | M N O | = | sy*M sy*N sy*O |
                         |  0  0  1 | | P Q R |   |    P    Q    R |
##

#Param divx  integer divisor for inverse scale in x ##
#Param divy  integer divisor for inverse scale in y ##

#Return  true on successful scale ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postIDiv(1, 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso postScale MakeScale

##

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

#Method void postRotate(SkScalar degrees, SkScalar px, SkScalar py)
#In Set
#In Operator
#Line # post-multiplies Matrix by rotation ##
Sets Matrix to Matrix constructed from rotating by degrees about pivot point
(px, py), multiplied by Matrix.
This can be thought of as rotating about a pivot point after applying Matrix.

Positive degrees rotates clockwise.

Given:

#Code
#Literal
         | J K L |                        | c -s dx |
Matrix = | M N O |,  R(degrees, px, py) = | s  c dy |
         | P Q R |                        | 0  0  1 |
##

where

#Code
#Literal
c  = cos(degrees)
s  = sin(degrees)
dx =  s * py + (1 - c) * px
dy = -s * px + (1 - c) * py
##

sets Matrix to:

#Code
#Literal
                              |c -s dx| |J K L|   |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R|
R(degrees, px, py) * Matrix = |s  c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R|
                              |0  0  1| |P Q R|   |         P          Q          R|
##

#Param degrees  angle of axes relative to upright axes ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postRotate(45, source.width() / 2, source.height() / 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preRotate setRotate

##

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

#Method void postRotate(SkScalar degrees)

Sets Matrix to Matrix constructed from rotating by degrees about pivot point
(0, 0), multiplied by Matrix.
This can be thought of as rotating about the origin after applying Matrix.

Positive degrees rotates clockwise.

Given:

#Code
#Literal
         | J K L |                        | c -s 0 |
Matrix = | M N O |,  R(degrees, px, py) = | s  c 0 |
         | P Q R |                        | 0  0 1 |
##

where

#Code
#Literal
c  = cos(degrees)
s  = sin(degrees)
##

sets Matrix to:

#Code
#Literal
                              | c -s dx | | J K L |   | cJ-sM cK-sN cL-sO |
R(degrees, px, py) * Matrix = | s  c dy | | M N O | = | sJ+cM sK+cN sL+cO |
                              | 0  0  1 | | P Q R |   |     P     Q     R |
##

#Param degrees  angle of axes relative to upright axes ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postRotate(45);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preRotate setRotate

##

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

#Method void postSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py)
#In Set
#In Operator
#Line # post-multiplies Matrix by skew ##
Sets Matrix to Matrix constructed from skewing by (kx, ky) about pivot point
(px, py), multiplied by Matrix.
This can be thought of as skewing about a pivot point after applying Matrix.

Given:

#Code
#Literal
         | J K L |                       |  1 kx dx |
Matrix = | M N O |,  K(kx, ky, px, py) = | ky  1 dy |
         | P Q R |                       |  0  0  1 |
##

where

#Code
#Literal
dx = -kx * py
dy = -ky * px
##

sets Matrix to:

#Code
#Literal
                             | 1 kx dx| |J K L|   |J+kx*M+dx*P K+kx*N+dx*Q L+kx*O+dx+R|
K(kx, ky, px, py) * Matrix = |ky  1 dy| |M N O| = |ky*J+M+dy*P ky*K+N+dy*Q ky*L+O+dy*R|
                             | 0  0  1| |P Q R|   |          P           Q           R|
##

#Param kx  horizontal skew factor ##
#Param ky  vertical skew factor ##
#Param px  pivot x ##
#Param py  pivot y ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postSkew(.5f, 0, source.width() / 2, source.height() / 2);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preSkew setSkew

##

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

#Method void postSkew(SkScalar kx, SkScalar ky)

Sets Matrix to Matrix constructed from skewing by (kx, ky) about pivot point
(0, 0), multiplied by Matrix.
This can be thought of as skewing about the origin after applying Matrix.

Given:

#Code
#Literal
         | J K L |               |  1 kx 0 |
Matrix = | M N O |,  K(kx, ky) = | ky  1 0 |
         | P Q R |               |  0  0 1 |
##

sets Matrix to:

#Code
#Literal
                     |  1 kx 0 | | J K L |   | J+kx*M K+kx*N L+kx*O |
K(kx, ky) * Matrix = | ky  1 0 | | M N O | = | ky*J+M ky*K+N ky*L+O |
                     |  0  0 1 | | P Q R |   |      P      Q      R |
##

#Param kx  horizontal skew factor ##
#Param ky  vertical skew factor ##

#Example
#Image 3
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postSkew(.5f, 0);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preSkew setSkew

##

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

#Method void postConcat(const SkMatrix& other)
#In Set
#In Operator
#Line # post-multiplies Matrix by Matrix parameter ##
Sets Matrix to Matrix other multiplied by Matrix.
This can be thought of mapping by other after applying Matrix.

Given:

#Code
#Literal
         | J K L |           | A B C |
Matrix = | M N O |,  other = | D E F |
         | P Q R |           | G H I |
##

sets Matrix to:

#Code
#Literal
                 | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
                 | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
##

#Param other  Matrix on left side of multiply expression ##

#Example
#Image 3
#Height 64
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix.postConcat(matrix);
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preConcat setConcat Concat

##

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

#Enum ScaleToFit
#Line # options to map Rects ##
#Code
    enum ScaleToFit {
        kFill_ScaleToFit,
        kStart_ScaleToFit,
        kCenter_ScaleToFit,
        kEnd_ScaleToFit,
    };
##

ScaleToFit describes how Matrix is constructed to map one Rect to another.
ScaleToFit may allow Matrix to have unequal horizontal and vertical scaling,
or may restrict Matrix to square scaling. If restricted, ScaleToFit specifies
how Matrix maps to the side or center of the destination Rect.

#Const kFill_ScaleToFit 0
#Line # scales in x and y to fill destination Rect ##
    Computes Matrix that scales in x and y independently, so that source Rect is
    mapped to completely fill destination Rect. The aspect ratio of source Rect
    may change.
##
#Const kStart_ScaleToFit 1
#Line # scales and aligns to left and top ##
    Computes Matrix that maintains source Rect aspect ratio, mapping source Rect
    width or height to destination Rect. Aligns mapping to left and top edges
    of destination Rect.
##
#Const kCenter_ScaleToFit 2
#Line # scales and aligns to center ##
    Computes Matrix that maintains source Rect aspect ratio, mapping source Rect
    width or height to destination Rect. Aligns mapping to center of destination
    Rect.
##
#Const kEnd_ScaleToFit 3
#Line # scales and aligns to right and bottom ##
    Computes Matrix that maintains source Rect aspect ratio, mapping source Rect
    width or height to destination Rect. Aligns mapping to right and bottom
    edges of destination Rect.
##

#Example
   const char* labels[] = { "Fill", "Start", "Center", "End" };
   SkRect rects[] = {{5, 5, 59, 59}, {5, 74, 59, 108}, {10, 123, 44, 172}, {10, 187, 54, 231}};
   SkRect bounds;
   source.getBounds(&bounds);
   SkPaint paint;
   paint.setAntiAlias(true);
   for (auto fit : { SkMatrix::kFill_ScaleToFit, SkMatrix::kStart_ScaleToFit,
                     SkMatrix::kCenter_ScaleToFit, SkMatrix::kEnd_ScaleToFit } ) {
       for (auto rect : rects ) {
           canvas->drawRect(rect, paint);
           SkMatrix matrix;
           if (!matrix.setRectToRect(bounds, rect, fit)) {
               continue;
           }
           SkAutoCanvasRestore acr(canvas, true);
           canvas->concat(matrix);
           canvas->drawBitmap(source, 0, 0);
       }
       canvas->drawString(labels[fit], 10, 255, paint);
       canvas->translate(64, 0);
   }
##

#SeeAlso setRectToRect MakeRectToRect setPolyToPoly

##

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

#Method bool setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf)
#In Set
#Line # sets to map one Rect to another ##
Sets Matrix to scale and translate src Rect to dst Rect. stf selects whether
mapping completely fills dst or preserves the aspect ratio, and how to align
src within dst. Returns false if src is empty, and sets Matrix to identity.
Returns true if dst is empty, and sets Matrix to:

#Code
#Literal
| 0 0 0 |
| 0 0 0 |
| 0 0 1 |
##

#Param src  Rect to map from ##
#Param dst  Rect to map to ##
#Param stf  one of: kFill_ScaleToFit, kStart_ScaleToFit,
                    kCenter_ScaleToFit, kEnd_ScaleToFit
##

#Return  true if Matrix can represent Rect mapping ##

#Example
    const SkRect srcs[] = { {0, 0, 0, 0}, {1, 2, 3, 4} };
    const SkRect dsts[] = { {0, 0, 0, 0}, {5, 6, 8, 9} };
    for (auto src : srcs) {
        for (auto dst : dsts) {
             SkMatrix matrix;
             matrix.setAll(-1, -1, -1, -1, -1, -1, -1, -1, -1);
             bool success = matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
             SkDebugf("src: %g, %g, %g, %g  dst: %g, %g, %g, %g  success: %s\n",
                      src.fLeft, src.fTop, src.fRight, src.fBottom,
                      dst.fLeft, dst.fTop, dst.fRight, dst.fBottom, success ? "true" : "false");
             matrix.dump();
        }
    }
#StdOut
src: 0, 0, 0, 0  dst: 0, 0, 0, 0  success: false
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.0000   0.0000   1.0000]
src: 0, 0, 0, 0  dst: 5, 6, 8, 9  success: false
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.0000   0.0000   1.0000]
src: 1, 2, 3, 4  dst: 0, 0, 0, 0  success: true
[  0.0000   0.0000   0.0000][  0.0000   0.0000   0.0000][  0.0000   0.0000   1.0000]
src: 1, 2, 3, 4  dst: 5, 6, 8, 9  success: true
[  1.5000   0.0000   3.5000][  0.0000   1.5000   3.0000][  0.0000   0.0000   1.0000]
##
##

#SeeAlso MakeRectToRect ScaleToFit setPolyToPoly SkRect::isEmpty

##

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

#Method static SkMatrix MakeRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf)
#In Constructor
#Line # constructs from source Rect to destination Rect ##
Returns Matrix set to scale and translate src Rect to dst Rect. stf selects
whether mapping completely fills dst or preserves the aspect ratio, and how to
align src within dst. Returns the identity Matrix if src is empty. If dst is
empty, returns Matrix set to:

#Code
#Literal
| 0 0 0 |
| 0 0 0 |
| 0 0 1 |
##

#Param src  Rect to map from ##
#Param dst  Rect to map to ##
#Param stf  one of: kFill_ScaleToFit, kStart_ScaleToFit,
                    kCenter_ScaleToFit, kEnd_ScaleToFit
##

#Return  Matrix mapping src to dst ##

#Example
    const SkRect srcs[] = { {0, 0, 0, 0}, {1, 2, 3, 4} };
    const SkRect dsts[] = { {0, 0, 0, 0}, {5, 6, 8, 9} };
    for (auto src : srcs) {
        for (auto dst : dsts) {
             SkMatrix matrix = SkMatrix::MakeRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
             SkDebugf("src: %g, %g, %g, %g  dst: %g, %g, %g, %g\n",
                      src.fLeft, src.fTop, src.fRight, src.fBottom,
                      dst.fLeft, dst.fTop, dst.fRight, dst.fBottom);
             matrix.dump();
        }
    }
#StdOut
src: 0, 0, 0, 0  dst: 0, 0, 0, 0
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.0000   0.0000   1.0000]
src: 0, 0, 0, 0  dst: 5, 6, 8, 9
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.0000   0.0000   1.0000]
src: 1, 2, 3, 4  dst: 0, 0, 0, 0
[  0.0000   0.0000   0.0000][  0.0000   0.0000   0.0000][  0.0000   0.0000   1.0000]
src: 1, 2, 3, 4  dst: 5, 6, 8, 9
[  1.5000   0.0000   3.5000][  0.0000   1.5000   3.0000][  0.0000   0.0000   1.0000]
##
##

#SeeAlso setRectToRect ScaleToFit setPolyToPoly SkRect::isEmpty

##

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

#Method bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count)
#In Set
#Line # sets to map one to four points to an equal array of points ##
Sets Matrix to map src to dst. count must be zero or greater, and four or less.

If count is zero, sets Matrix to identity and returns true.
If count is one, sets Matrix to translate and returns true.
If count is two or more, sets Matrix to map Points if possible; returns false
if Matrix cannot be constructed. If count is four, Matrix may include
perspective.

#Param src  Points to map from ##
#Param dst  Points to map to ##
#Param count  number of Points in src and dst ##

#Return  true if Matrix was constructed successfully
##

#Example
    const SkPoint src[] = { { 0, 0}, {30,   0}, {30, -30}, { 0, -30} };
    const SkPoint dst[] = { {50, 0}, {80, -10}, {90, -30}, {60, -40} };
    SkPaint blackPaint;
    blackPaint.setAntiAlias(true);
    blackPaint.setTextSize(42);
    SkPaint redPaint = blackPaint;
    redPaint.setColor(SK_ColorRED);
    for (int count : { 1, 2, 3, 4 } ) {
        canvas->translate(35, 55);
        for (int index = 0; index < count; ++index) {
            canvas->drawCircle(src[index], 3, blackPaint);
            canvas->drawCircle(dst[index], 3, blackPaint);
            if (index > 0) {
                canvas->drawLine(src[index], src[index - 1], blackPaint);
                canvas->drawLine(dst[index], dst[index - 1], blackPaint);
            }
        }
        SkMatrix matrix;
        matrix.setPolyToPoly(src, dst, count);
        canvas->drawString("A", src[0].fX, src[0].fY, redPaint);
        SkAutoCanvasRestore acr(canvas, true);
        canvas->concat(matrix);
        canvas->drawString("A", src[0].fX, src[0].fY, redPaint);
    }
##

#SeeAlso setRectToRect MakeRectToRect

##

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

#Method bool SK_WARN_UNUSED_RESULT invert(SkMatrix* inverse) const
#In Operator
#Line # returns inverse, if possible ##
Sets inverse to reciprocal matrix, returning true if Matrix can be inverted.
Geometrically, if Matrix maps from source to destination, inverse Matrix
maps from destination to source. If Matrix can not be inverted, inverse is
unchanged.

#Param inverse  storage for inverted Matrix; may be nullptr ##

#Return  true if Matrix can be inverted ##

#Example
#Height 128
    const SkPoint src[] = { { 10, 120}, {120, 120}, {120, 10}, {  10, 10} };
    const SkPoint dst[] = { {150, 120}, {200, 100}, {240, 30}, { 130, 40} };
    SkPaint paint;
    paint.setAntiAlias(true);
    SkMatrix matrix;
    matrix.setPolyToPoly(src, dst, 4);
    canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, src, paint);
    canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, dst, paint);
    paint.setColor(SK_ColorBLUE);
    paint.setStrokeWidth(3);
    paint.setStrokeCap(SkPaint::kRound_Cap);
    canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);
    if (matrix.invert(&matrix)) {
        canvas->concat(matrix);
        canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, dst, paint);
    }
##

#SeeAlso Concat

##

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

#Method static void SetAffineIdentity(SkScalar affine[6])
#In Constructor
#Line # sets 3x2 array to identity ##
Fills affine with identity values in column major order.
Sets affine to:

#Code
#Literal
| 1 0 0 |
| 0 1 0 |
##

Affine 3x2 matrices in column major order are used by OpenGL and XPS.

#Param affine  storage for 3x2 affine matrix ##

#Example
    SkScalar affine[6];
    SkMatrix::SetAffineIdentity(affine);
    const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
    for (int i = 0; i < 6; ++i) {
        SkDebugf("%s: %g ", names[i], affine[i]);
    }
    SkDebugf("\n");
#StdOut
ScaleX: 1 SkewY: 0 SkewX: 0 ScaleY: 1 TransX: 0 TransY: 0
##
##

#SeeAlso setAffine asAffine

##

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

#Method bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const
#In Constructor
#Line # copies to 3x2 array ##
Fills affine in column major order. Sets affine to:

#Code
#Literal
| scale-x  skew-x translate-x |
| skew-y  scale-y translate-y |
##

If Matrix contains perspective, returns false and leaves affine unchanged.

#Param affine  storage for 3x2 affine matrix; may be nullptr ##

#Return  true if Matrix does not contain perspective ##

#Example
SkMatrix matrix;
matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);
SkScalar affine[6];
if (matrix.asAffine(affine)) {
    const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
    for (int i = 0; i < 6; ++i) {
        SkDebugf("%s: %g ", names[i], affine[i]);
    }
    SkDebugf("\n");
}
#StdOut
ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7
##
##

#SeeAlso setAffine SetAffineIdentity

##

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

#Method void setAffine(const SkScalar affine[6])
#In Constructor
#In Set
#Line # sets left two columns ##
Sets Matrix to affine values, passed in column major order. Given affine,
column, then row, as:

#Code
#Literal
| scale-x  skew-x translate-x |
|  skew-y scale-y translate-y |
##

Matrix is set, row, then column, to:

#Code
#Literal
| scale-x  skew-x translate-x |
|  skew-y scale-y translate-y |
|       0       0           1 |
##

#Param affine  3x2 affine matrix ##

#Example
SkMatrix matrix;
matrix.setAll(2, 3, 4, 5, 6, 7, 0, 0, 1);
SkScalar affine[6];
if (matrix.asAffine(affine)) {
    const char* names[] = { "ScaleX", "SkewY", "SkewX", "ScaleY", "TransX", "TransY" };
    for (int i = 0; i < 6; ++i) {
        SkDebugf("%s: %g ", names[i], affine[i]);
    }
    SkDebugf("\n");
    matrix.reset();
    matrix.setAffine(affine);
    matrix.dump();
}
#StdOut
ScaleX: 2 SkewY: 5 SkewX: 3 ScaleY: 6 TransX: 4 TransY: 7
[  2.0000   3.0000   4.0000][  5.0000   6.0000   7.0000][  0.0000   0.0000   1.0000]
##
##

#SeeAlso asAffine SetAffineIdentity

##

# ------------------------------------------------------------------------------
#Subtopic Transform
#Populate
#Line # map points with Matrix ##
##

#Method void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
#In Transform
#Line # maps Point array ##
Maps src Point array of length count to dst Point array of equal or greater
length. Points are mapped by multiplying each Point by Matrix. Given:

#Code
#Literal
         | A B C |        | x |
Matrix = | D E F |,  pt = | y |
         | G H I |        | 1 |
##

where

#Code
#Literal
for (i = 0; i < count; ++i) {
    x = src[i].fX
    y = src[i].fY
}
##

each dst Point is computed as:

#Code
#Literal
              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
##

src and dst may point to the same storage.

#Param dst  storage for mapped Points ##
#Param src  Points to transform ##
#Param count  number of Points to transform ##

#Example
    SkMatrix matrix;
    matrix.reset();
    const int count = 4;
    SkPoint src[count];
    matrix.mapRectToQuad(src, {40, 70, 180, 220} );
    SkPaint paint;
    paint.setARGB(77, 23, 99, 154);
    for (int i = 0; i < 5; ++i) {
        SkPoint dst[count];
        matrix.mapPoints(dst, src, count);
        canvas->drawPoints(SkCanvas::kPolygon_PointMode, count, dst, paint);
        matrix.preRotate(35, 128, 128);
    }
##

#SeeAlso mapXY mapHomogeneousPoints mapVectors

##

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

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

Maps pts Point array of length count in place. Points are mapped by multiplying
each Point by Matrix. Given:

#Code
#Literal
         | A B C |        | x |
Matrix = | D E F |,  pt = | y |
         | G H I |        | 1 |
##

where

#Code
#Literal
for (i = 0; i < count; ++i) {
    x = pts[i].fX
    y = pts[i].fY
}
##

each resulting pts Point is computed as:

#Code
#Literal
              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
##

#Param pts  storage for mapped Points ##
#Param count  number of Points to transform ##

#Example
    SkMatrix matrix;
    matrix.setRotate(35, 128, 128);
    const int count = 4;
    SkPoint pts[count];
    matrix.mapRectToQuad(pts, {40, 70, 180, 220} );
    SkPaint paint;
    paint.setARGB(77, 23, 99, 154);
    for (int i = 0; i < 5; ++i) {
        canvas->drawPoints(SkCanvas::kPolygon_PointMode, count, pts, paint);
        matrix.mapPoints(pts, count);
    }
##

#SeeAlso mapXY mapHomogeneousPoints mapVectors

##

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

#Method void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const
#In Transform
#Line # maps Point3 array ##
Maps src Point3 array of length count to dst Point3 array, which must of length count or
greater. Point3 array is mapped by multiplying each Point3 by Matrix. Given:

#Code
#Literal
         | A B C |         | x |
Matrix = | D E F |,  src = | y |
         | G H I |         | z |
##

each resulting dst Point is computed as:

#Code
#Literal
               |A B C| |x|
Matrix * src = |D E F| |y| = |Ax+By+Cz Dx+Ey+Fz Gx+Hy+Iz|
               |G H I| |z|
##

#Param dst  storage for mapped Point3 array ##
#Param src  Point3 array to transform ##
#Param count  items in Point3 array to transform ##

#Example
    SkPoint3 src[] = {{3, 3, 1}, {8, 2, 2}, {5, 0, 4}, {0, 1, 3},
                      {3, 7, 1}, {8, 6, 2}, {5, 4, 4}, {0, 5, 3}};
    int lines[] = { 0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7 };
    constexpr int count = SK_ARRAY_COUNT(src);
    auto debugster = [=](SkPoint3 src[]) -> void {
    for (size_t i = 0; i < SK_ARRAY_COUNT(lines); i += 2) {
        const SkPoint3& s = src[lines[i]];
        const SkPoint3& e = src[lines[i + 1]];
        SkPaint paint;
        paint.setARGB(77, 23, 99, 154);
        canvas->drawLine(s.fX / s.fZ, s.fY / s.fZ, e.fX / e.fZ, e.fY / e.fZ, paint);
    }
    };
    canvas->save();
    canvas->translate(5, 5);
    canvas->scale(15, 15);
    debugster(src);
    canvas->restore();
    canvas->translate(128, 128);
    SkMatrix matrix;
    matrix.setAll(15, 0, 0, 0, 15, 0, -0.08, 0.04, 1);
    matrix.mapHomogeneousPoints(src, src, count);
    debugster(src);
##

#SeeAlso mapPoints mapXY mapVectors

##

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

#Method void mapXY(SkScalar x, SkScalar y, SkPoint* result) const
#In Transform
#Line # maps Point ##
Maps Point (x, y) to result. Point is mapped by multiplying by Matrix. Given:

#Code
#Literal
         | A B C |        | x |
Matrix = | D E F |,  pt = | y |
         | G H I |        | 1 |
##

result is computed as:

#Code
#Literal
              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
##

#Param x  x-axis value of Point to map ##
#Param y  y-axis value of Point to map ##
#Param result  storage for mapped Point ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    SkMatrix matrix;
    matrix.setRotate(60, 128, 128);
    SkPoint lines[] = {{50, 50}, {150, 50}, {150, 150}};
    for (size_t i = 0; i < SK_ARRAY_COUNT(lines); ++i) {
        SkPoint pt;
        matrix.mapXY(lines[i].fX, lines[i].fY, &pt);
        canvas->drawCircle(pt.fX, pt.fY, 3, paint);
    }
    canvas->concat(matrix);
    canvas->drawPoints(SkCanvas::kPolygon_PointMode, SK_ARRAY_COUNT(lines), lines, paint);
##

#SeeAlso mapPoints mapVectors

##

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

#Method SkPoint mapXY(SkScalar x, SkScalar y) const

Returns Point (x, y) multiplied by Matrix. Given:

#Code
#Literal
         | A B C |        | x |
Matrix = | D E F |,  pt = | y |
         | G H I |        | 1 |
##

result is computed as:

#Code
#Literal
              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
##

#Param x  x-axis value of Point to map ##
#Param y  y-axis value of Point to map ##

#Return  mapped Point ##

#Example
#Image 4
SkMatrix matrix;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {30, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
SkPaint paint;
paint.setAntiAlias(true);
paint.setStrokeWidth(3);
for (int x : { 0, source.width() } ) {
    for (int y : { 0, source.height() } ) {
        canvas->drawPoint(matrix.mapXY(x, y), paint);
    }
}
canvas->concat(matrix);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso mapPoints mapVectors

##

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

#Method void mapVectors(SkVector dst[], const SkVector src[], int count) const
#In Transform
#Line # maps Vector array ##
Maps src Vector array of length count to Vector Point array of equal or greater
length. Vectors are mapped by multiplying each Vector by Matrix, treating
Matrix translation as zero. Given:

#Code
#Literal
         | A B 0 |         | x |
Matrix = | D E 0 |,  src = | y |
         | G H I |         | 1 |
##

where

#Code
#Literal
for (i = 0; i < count; ++i) {
    x = src[i].fX
    y = src[i].fY
}
##

each dst Vector is computed as:

#Code
#Literal
               |A B 0| |x|                            Ax+By     Dx+Ey
Matrix * src = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , -------
               |G H I| |1|                           Gx+Hy+I   Gx+Hy+I
##

src and dst may point to the same storage.

#Param dst  storage for mapped Vectors ##
#Param src  Vectors to transform ##
#Param count  number of Vectors to transform ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkMatrix matrix;
    matrix.reset();
    const SkVector radii[] = {{8, 4}, {9, 1}, {6, 2}, {7, 3}};
    for (int i = 0; i < 4; ++i) {
        SkVector rScaled[4];
        matrix.preScale(1.5f, 2.f);
        matrix.mapVectors(rScaled, radii, SK_ARRAY_COUNT(radii));
        SkRRect rrect;
        rrect.setRectRadii({20, 20, 180, 70}, rScaled);
        canvas->drawRRect(rrect, paint);
        canvas->translate(0, 60);
    }
##

#SeeAlso mapVector mapPoints mapXY

##

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

#Method void mapVectors(SkVector vecs[], int count) const

Maps vecs Vector array of length count in place, multiplying each Vector by
Matrix, treating Matrix translation as zero. Given:

#Code
#Literal
         | A B 0 |         | x |
Matrix = | D E 0 |,  vec = | y |
         | G H I |         | 1 |
##

where

#Code
#Literal
for (i = 0; i < count; ++i) {
    x = vecs[i].fX
    y = vecs[i].fY
}
##

each result Vector is computed as:

#Code
#Literal
               |A B 0| |x|                            Ax+By     Dx+Ey
Matrix * vec = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , -------
               |G H I| |1|                           Gx+Hy+I   Gx+Hy+I
##

#Param vecs  Vectors to transform, and storage for mapped Vectors ##
#Param count  number of Vectors to transform ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setStyle(SkPaint::kStroke_Style);
    SkMatrix matrix;
    matrix.setScale(2, 3);
    SkVector radii[] = {{7, 7}, {3, 3}, {2, 2}, {4, 0}};
    for (int i = 0; i < 4; ++i) {
        SkRRect rrect;
        rrect.setRectRadii({20, 20, 180, 70}, radii);
        canvas->drawRRect(rrect, paint);
        canvas->translate(0, 60);
        matrix.mapVectors(radii, SK_ARRAY_COUNT(radii));
    }
##

#SeeAlso mapVector mapPoints mapXY

##

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

#Method void mapVector(SkScalar dx, SkScalar dy, SkVector* result) const
#In Transform
#Line # maps Vector ##
Maps Vector (x, y) to result. Vector is mapped by multiplying by Matrix,
treating Matrix translation as zero. Given:

#Code
#Literal
         | A B 0 |         | dx |
Matrix = | D E 0 |,  vec = | dy |
         | G H I |         |  1 |
##

each result Vector is computed as:

#Code
#Literal
#Outdent
               |A B 0| |dx|                                        A*dx+B*dy     D*dx+E*dy
Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- , -----------
               |G H I| | 1|                                       G*dx+H*dy+I   G*dx+*dHy+I
##

#Param dx  x-axis value of Vector to map ##
#Param dy  y-axis value of Vector to map ##
#Param result  storage for mapped Vector ##

#Example
    SkPaint paint;
    paint.setColor(SK_ColorGREEN);
    paint.setAntiAlias(true);
    paint.setTextSize(48);
    SkMatrix matrix;
    matrix.setRotate(90);
    SkVector offset = { 7, 7 };
    for (int i = 0; i < 4; ++i) {
        paint.setImageFilter(SkDropShadowImageFilter::Make(offset.fX, offset.fY, 3, 3,
              SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr));
        matrix.mapVector(offset.fX, offset.fY, &offset);
        canvas->translate(0, 60);
        canvas->drawString("Text", 50, 0, paint);
    }
##

#SeeAlso mapVectors mapPoints mapXY

##

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

#Method SkVector mapVector(SkScalar dx, SkScalar dy) const

Returns Vector (x, y) multiplied by Matrix, treating Matrix translation as zero.
Given:

#Code
#Literal
         | A B 0 |         | dx |
Matrix = | D E 0 |,  vec = | dy |
         | G H I |         |  1 |
##

each result Vector is computed as:

#Code
#Literal
#Outdent
               |A B 0| |dx|                                        A*dx+B*dy     D*dx+E*dy
Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- , -----------
               |G H I| | 1|                                       G*dx+H*dy+I   G*dx+*dHy+I
##

#Param dx  x-axis value of Vector to map ##
#Param dy  y-axis value of Vector to map ##

#Return  mapped Vector ##

#Example
    SkPaint paint;
    paint.setColor(SK_ColorGREEN);
    paint.setAntiAlias(true);
    paint.setTextSize(48);
    SkMatrix matrix;
    matrix.setRotate(90);
    SkVector offset = { 7, 7 };
    for (int i = 0; i < 4; ++i) {
        paint.setImageFilter(SkDropShadowImageFilter::Make(offset.fX, offset.fY, 3, 3,
              SK_ColorBLUE, SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, nullptr));
        offset = matrix.mapVector(offset.fX, offset.fY);
        canvas->translate(0, 60);
        canvas->drawString("Text", 50, 0, paint);
    }
##

#SeeAlso mapVectors mapPoints mapXY

##

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

#Method bool mapRect(SkRect* dst, const SkRect& src) const
#In Transform
#Line # returns bounds of mapped Rect ##
Sets dst to bounds of src corners mapped by Matrix.
Returns true if mapped corners are dst corners.

Returned value is the same as calling rectStaysRect.

#Param dst  storage for bounds of mapped Points ##
#Param src  Rect to map ##

#Return  true if dst is equivalent to mapped src ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    SkMatrix matrix;
    matrix.setRotate(45, 128, 128);
    SkRect rotatedBounds, bounds = {40, 50, 190, 200};
    matrix.mapRect(&rotatedBounds, bounds );
    paint.setColor(SK_ColorGRAY);
    canvas->drawRect(rotatedBounds, paint);
    canvas->concat(matrix);
    paint.setColor(SK_ColorRED);
    canvas->drawRect(bounds, paint);
##

#SeeAlso mapPoints rectStaysRect

##

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

#Method bool mapRect(SkRect* rect) const

Sets rect to bounds of rect corners mapped by Matrix.
Returns true if mapped corners are computed rect corners.

Returned value is the same as calling rectStaysRect.

#Param rect  rectangle to map, and storage for bounds of mapped corners ##

#Return  true if result is equivalent to mapped src ##

#Example
    SkPaint paint;
    paint.setAntiAlias(true);
    SkMatrix matrix;
    matrix.setRotate(45, 128, 128);
    SkRect bounds = {40, 50, 190, 200};
    matrix.mapRect(&bounds);
    paint.setColor(SK_ColorGRAY);
    canvas->drawRect(bounds, paint);
    canvas->concat(matrix);
    paint.setColor(SK_ColorRED);
    canvas->drawRect({40, 50, 190, 200}, paint);
##

#SeeAlso mapRectScaleTranslate mapPoints rectStaysRect

##

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

#Method SkRect mapRect(const SkRect& src) const

Returns bounds of src corners mapped by Matrix.

#Param src  rectangle to map ##
#Return mapped bounds ##

#Example
  SkRect rect{110, 50, 180, 100};
  SkMatrix matrix;
  matrix.setRotate(50, 28, 28);
  SkRect mapped = matrix.mapRect(rect);
  SkPaint paint;
  paint.setAntiAlias(true);
  paint.setStyle(SkPaint::kStroke_Style);
  canvas->drawRect(rect, paint);
  canvas->drawRect(mapped, paint);
  canvas->concat(matrix);
  canvas->drawRect(rect, paint);
##

#SeeAlso mapRectToQuad mapRectScaleTranslate
#Method ##

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

#Method void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const
#In Transform
#Line # maps Rect to Point array ##
Maps four corners of rect to dst. Points are mapped by multiplying each
rect corner by Matrix. rect corner is processed in this order:
(rect.fLeft, rect.fTop), (rect.fRight, rect.fTop), (rect.fRight, rect.fBottom),
(rect.fLeft, rect.fBottom).

rect may be empty: rect.fLeft may be greater than or equal to rect.fRight;
rect.fTop may be greater than or equal to rect.fBottom.

Given:

#Code
#Literal
         | A B C |        | x |
Matrix = | D E F |,  pt = | y |
         | G H I |        | 1 |
##

where pt is initialized from each of (rect.fLeft, rect.fTop),
(rect.fRight, rect.fTop), (rect.fRight, rect.fBottom), (rect.fLeft, rect.fBottom),
each dst Point is computed as:

#Code
#Literal
              |A B C| |x|                               Ax+By+C   Dx+Ey+F
Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
              |G H I| |1|                               Gx+Hy+I   Gx+Hy+I
##

#Param dst  storage for mapped corner Points ##
#Param rect  Rect to map ##

#Example
#Height 192
    SkPaint paint;
    paint.setAntiAlias(true);
    SkMatrix matrix;
    matrix.setRotate(60, 128, 128);
    SkRect rect = {50, 50, 150, 150};
    SkPoint pts[4];
    matrix.mapRectToQuad(pts, rect);
    for (int i = 0; i < 4; ++i) {
        canvas->drawCircle(pts[i].fX, pts[i].fY, 3, paint);
    }
    canvas->concat(matrix);
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRect(rect, paint);
##

#SeeAlso mapRect mapRectScaleTranslate

##

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

#Method void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const
#In Transform
#Line # returns bounds of mapped Rect ##
Sets dst to bounds of src corners mapped by Matrix. If matrix contains
elements other than scale or translate: asserts if SK_DEBUG is defined;
otherwise, results are undefined.

#Param dst  storage for bounds of mapped Points ##
#Param src  Rect to map ##

#Example
    SkPaint paint;
    SkMatrix matrix;
    SkRect rect = {100, 50, 150, 180};
    matrix.setScale(2, .5f, rect.centerX(), rect.centerY());
    SkRect rotated;
    matrix.mapRectScaleTranslate(&rotated, rect);
    paint.setStyle(SkPaint::kStroke_Style);
    canvas->drawRect(rect, paint);
    paint.setColor(SK_ColorRED);
    canvas->drawRect(rotated, paint);
##

#SeeAlso mapRect mapRectToQuad isScaleTranslate rectStaysRect

##

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

#Method SkScalar mapRadius(SkScalar radius) const
#In Transform
#Line # returns mean radius of mapped Circle ##
Returns geometric mean radius of ellipse formed by constructing Circle of
size radius, and mapping constructed Circle with Matrix. The result squared is
equal to the major axis length times the minor axis length.
Result is not meaningful if Matrix contains perspective elements.

#Param radius  Circle size to map ##

#Return  average mapped radius ##

#Example
#Description
The area enclosed by a square with sides equal to mappedRadius is the same as
the area enclosed by the ellipse major and minor axes.
##
  SkPaint paint;
  paint.setAntiAlias(true);
  SkMatrix matrix;
  const SkPoint center = {108, 93};
  matrix.setScale(2, .5f, center.fX, center.fY);
  matrix.postRotate(45, center.fX, center.fY);
  const SkScalar circleRadius = 50;
  SkScalar mappedRadius = matrix.mapRadius(circleRadius);
  SkVector minorAxis, majorAxis;
  matrix.mapVector(0, circleRadius, &minorAxis);
  matrix.mapVector(circleRadius, 0, &majorAxis);
  SkString mappedArea;
  mappedArea.printf("area = %g", mappedRadius * mappedRadius);
  canvas->drawString(mappedArea, 145, 250, paint);
  canvas->drawString("mappedRadius", center.fX + mappedRadius + 3, center.fY, paint);
  paint.setColor(SK_ColorRED);
  SkString axArea;
  axArea.printf("area = %g", majorAxis.length() * minorAxis.length());
  paint.setStyle(SkPaint::kFill_Style);
  canvas->drawString(axArea, 15, 250, paint);
  paint.setStyle(SkPaint::kStroke_Style);
  canvas->drawRect({10, 200, 10 + majorAxis.length(), 200 + minorAxis.length()}, paint);
  paint.setColor(SK_ColorBLACK);
  canvas->drawLine(center.fX, center.fY, center.fX + mappedRadius, center.fY, paint);
  canvas->drawLine(center.fX, center.fY, center.fX, center.fY + mappedRadius, paint);
  canvas->drawRect({140, 180, 140 + mappedRadius, 180 + mappedRadius}, paint);
  canvas->concat(matrix);
  canvas->drawCircle(center.fX, center.fY, circleRadius, paint);
  paint.setColor(SK_ColorRED);
  canvas->drawLine(center.fX, center.fY, center.fX + circleRadius, center.fY, paint);
  canvas->drawLine(center.fX, center.fY, center.fX, center.fY + circleRadius, paint);
##

#SeeAlso mapVector

##

# ------------------------------------------------------------------------------
#Method bool isFixedStepInX() const
#In Property
#Line # returns if transformation supports fixed step in x ##
Returns true if a unit step on x-axis at some y-axis value mapped through Matrix
can be represented by a constant Vector. Returns true if getType returns
kIdentity_Mask, or combinations of: kTranslate_Mask, kScale_Mask, and kAffine_Mask.

May return true if getType returns kPerspective_Mask, but only when Matrix
does not include rotation or skewing along the y-axis.

#Return  true if Matrix does not have complex perspective ##

#Example
    SkMatrix matrix;
    for (SkScalar px : { 0.0f, 0.1f } ) {
        for (SkScalar py : { 0.0f, 0.1f } ) {
            for (SkScalar sy : { 1, 2 } ) {
                matrix.setAll(1, 0, 0,   0, sy, 0,   px, py, 1);
                matrix.dump();
                SkDebugf("isFixedStepInX: %s\n", matrix.isFixedStepInX() ? "true" : "false");
            }
        }
    }
#StdOut
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.0000   0.0000   1.0000]
isFixedStepInX: true
[  1.0000   0.0000   0.0000][  0.0000   2.0000   0.0000][  0.0000   0.0000   1.0000]
isFixedStepInX: true
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.0000   0.1000   1.0000]
isFixedStepInX: true
[  1.0000   0.0000   0.0000][  0.0000   2.0000   0.0000][  0.0000   0.1000   1.0000]
isFixedStepInX: true
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.1000   0.0000   1.0000]
isFixedStepInX: false
[  1.0000   0.0000   0.0000][  0.0000   2.0000   0.0000][  0.1000   0.0000   1.0000]
isFixedStepInX: false
[  1.0000   0.0000   0.0000][  0.0000   1.0000   0.0000][  0.1000   0.1000   1.0000]
isFixedStepInX: false
[  1.0000   0.0000   0.0000][  0.0000   2.0000   0.0000][  0.1000   0.1000   1.0000]
isFixedStepInX: false
##
##

#SeeAlso fixedStepInX getType

##

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

#Method SkVector fixedStepInX(SkScalar y) const
#In Property
#Line # returns step in x for a position in y ##
Returns Vector representing a unit step on x-axis at y mapped through Matrix.
If isFixedStepInX is false, returned value is undefined.

#Param y  position of line parallel to x-axis ##

#Return  Vector advance of mapped unit step on x-axis ##

#Example
#Image 3
    SkMatrix matrix;
    const SkPoint center = { 128, 128 };
    matrix.setScale(20, 25, center.fX, center.fY);
    matrix.postRotate(75, center.fX, center.fY);
    {
       SkAutoCanvasRestore acr(canvas, true);
       canvas->concat(matrix);
       canvas->drawBitmap(source, 0, 0);
    }
    if (matrix.isFixedStepInX()) {
       SkPaint paint;
       paint.setAntiAlias(true);
       SkVector step = matrix.fixedStepInX(128);
       SkVector end = center + step;
       canvas->drawLine(center, end, paint);
       SkVector arrow = { step.fX + step.fY, step.fY - step.fX};
       arrow = arrow * .25f;
       canvas->drawLine(end, end - arrow, paint);
       canvas->drawLine(end, {end.fX + arrow.fY, end.fY - arrow.fX}, paint);
    }
##

#SeeAlso isFixedStepInX getType

##

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

#Method bool cheapEqualTo(const SkMatrix& m) const
#In Operator
#Line # compares Matrix pair using memcmp() ##
Returns true if Matrix equals m, using an efficient comparison.

Returns false when the sign of zero values is the different; when one
matrix has positive zero value and the other has negative zero value.

Returns true even when both Matrices contain NaN.

NaN never equals any value, including itself. To improve performance, NaN values
are treated as bit patterns that are equal if their bit patterns are equal.

#Param m  Matrix to compare ##

#Return  true if m and Matrix are represented by identical bit patterns ##

#Example
    auto debugster = [](const char* prefix, const SkMatrix& a, const SkMatrix& b) -> void {
        SkDebugf("%s: a %c= b a.cheapEqualTo(b): %s\n", prefix,
                 a == b ? '=' : '!', a.cheapEqualTo(b) ? "true" : "false");
    };
    SkMatrix a, b;
    a.setAll(1, 0, 0,   0, 1, 0,  0, 0, 1);
    b.setIdentity();
    debugster("identity", a, b);
    a.setAll(1, -0.0f, 0,   0, 1, 0,  0, 0, 1);
    debugster("neg zero", a, b);
    a.setAll(1, SK_ScalarNaN, 0,   0, 1, 0,  0, 0, 1);
    debugster(" one NaN", a, b);
    b.setAll(1, SK_ScalarNaN, 0,   0, 1, 0,  0, 0, 1);
    debugster("both NaN", a, b);
#StdOut
identity: a == b a.cheapEqualTo(b): true
neg zero: a == b a.cheapEqualTo(b): false
 one NaN: a != b a.cheapEqualTo(b): false
both NaN: a != b a.cheapEqualTo(b): true
##
##

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

##

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

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

#Line # returns true if members are equal ##
Compares a and b; returns true if a and b are numerically equal. Returns true
even if sign of zero values are different. Returns false if either Matrix
contains NaN, even if the other Matrix also contains NaN.

#Param a  Matrix to compare ##
#Param b  Matrix to compare ##

#Return  true if Matrix a and Matrix b are numerically equal ##

#Example
    auto debugster = [](const char* prefix, const SkMatrix& a, const SkMatrix& b) -> void {
        SkDebugf("%s: a %c= b a.cheapEqualTo(b): %s\n", prefix,
                 a == b ? '=' : '!', a.cheapEqualTo(b) ? "true" : "false");
    };
    SkMatrix a, b;
    a.setAll(1, 0, 0,   0, 1, 0,  0, 0, 1);
    b.setScale(2, 4);
    b.postScale(0.5f, 0.25f);
    debugster("identity", a, b);
#StdOut
identity: a == b a.cheapEqualTo(b): true
##
##

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

##

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

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

#Line # returns true if members are unequal ##
Compares a and b; returns true if a and b are not numerically equal. Returns false
even if sign of zero values are different. Returns true if either Matrix
contains NaN, even if the other Matrix also contains NaN.

#Param a  Matrix to compare ##
#Param b  Matrix to compare ##

#Return  true if Matrix a and Matrix b are numerically not equal ##

#Example
    auto debugster = [](const char* prefix, const SkMatrix& a, const SkMatrix& b) -> void {
        SkDebugf("%s: a %c= b a.cheapEqualTo(b): %s\n", prefix,
                 a != b ? '!' : '=', a.cheapEqualTo(b) ? "true" : "false");
    };
    SkMatrix a, b;
    a.setAll(1, 0, 0,   0, 1, 0,  1, 0, 1);
    if (a.invert(&b)) {
        debugster("identity", a, b);
    }
##

#SeeAlso cheapEqualTo operator==(const SkMatrix& a, const SkMatrix& b)

##

# ------------------------------------------------------------------------------
#Subtopic Utility
#Populate
#Line # rarely called management functions ##
##

#Method void dump() const
#In Utility
#Line # sends text representation using floats to standard output ##
Writes text representation of Matrix to standard output. Floating point values
are written with limited precision; it may not be possible to reconstruct
original Matrix from output.

#Example
    SkMatrix matrix;
    matrix.setRotate(45);
    matrix.dump();
    SkMatrix nearlyEqual;
    nearlyEqual.setAll(0.7071f, -0.7071f, 0,   0.7071f, 0.7071f, 0,   0, 0, 1);
    nearlyEqual.dump();
    SkDebugf("matrix %c= nearlyEqual\n", matrix == nearlyEqual ? '=' : '!');
#StdOut
[  0.7071  -0.7071   0.0000][  0.7071   0.7071   0.0000][  0.0000   0.0000   1.0000]
[  0.7071  -0.7071   0.0000][  0.7071   0.7071   0.0000][  0.0000   0.0000   1.0000]
matrix != nearlyEqual
##
##

#SeeAlso SkPath::dump

##

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

#Method SkScalar getMinScale() const
#In Property
#Line # returns minimum scaling, if possible ##
Returns the minimum scaling factor of Matrix by decomposing the scaling and
skewing elements.
Returns -1 if scale factor overflows or Matrix contains perspective.

#Return  minimum scale factor
##

#Example
    SkMatrix matrix;
    matrix.setScale(42, 24);
    SkDebugf("matrix.getMinScale() %g\n", matrix.getMinScale());
#StdOut
matrix.getMinScale() 24
##
##

#SeeAlso getMaxScale getMinMaxScales

##

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

#Method SkScalar getMaxScale() const
#In Property
#Line # returns maximum scaling, if possible ##
Returns the maximum scaling factor of Matrix by decomposing the scaling and
skewing elements.
Returns -1 if scale factor overflows or Matrix contains perspective.

#Return  maximum scale factor
##

#Example
    SkMatrix matrix;
    matrix.setScale(42, 24);
    SkDebugf("matrix.getMaxScale() %g\n", matrix.getMaxScale());
#StdOut
matrix.getMaxScale() 42
##
##

#SeeAlso getMinScale getMinMaxScales

##

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

#Method bool SK_WARN_UNUSED_RESULT getMinMaxScales(SkScalar scaleFactors[2]) const
#In Property
#Line # returns minimum and maximum scaling, if possible ##
Sets scaleFactors[0] to the minimum scaling factor, and scaleFactors[1] to the
maximum scaling factor. Scaling factors are computed by decomposing
the Matrix scaling and skewing elements.

Returns true if scaleFactors are found; otherwise, returns false and sets
scaleFactors to undefined values.

#Param scaleFactors  storage for minimum and maximum scale factors ##

#Return  true if scale factors were computed correctly ##

#Example
    SkMatrix matrix;
    matrix.setAll(1, 0, 0,  0, 1, 0,   0, 0, 0);
    if (matrix.invert(&matrix)) {
        SkScalar factor[2] = {2, 2};
        bool result = matrix.getMinMaxScales(factor);
        SkDebugf("matrix.getMinMaxScales() %s %g %g\n",
                result ? "true" : "false", factor[0], factor[1]);
    }
#StdOut
matrix.getMinMaxScales() false 2 2
##
##

#SeeAlso getMinScale getMaxScale

##

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

#Method bool decomposeScale(SkSize* scale, SkMatrix* remaining = nullptr) const
#In Property
#Line # separates scale if possible ##
Decomposes Matrix into scale components and whatever remains. Returns false if
Matrix could not be decomposed.

Sets scale to portion of Matrix that scale axes. Sets remaining to Matrix
with scaling factored out. remaining may be passed as nullptr
to determine if Matrix can be decomposed without computing remainder.

Returns true if scale components are found. scale and remaining are
unchanged if Matrix contains perspective; scale factors are not finite, or
are nearly zero.

On success

#Formula
Matrix = scale * Remaining
##
.

#Param scale  axes scaling factors; may be nullptr  ##
#Param remaining  Matrix without scaling; may be nullptr ##

#Return  true if scale can be computed ##

#Example
    SkMatrix matrix;
    matrix.setRotate(90 * SK_Scalar1);
    matrix.postScale(1.f / 4, 1.f / 2);
    matrix.dump();
    SkSize scale = {SK_ScalarNaN, SK_ScalarNaN};
    SkMatrix remaining;
    remaining.reset();
    bool success = matrix.decomposeScale(&scale, &remaining);
    SkDebugf("success: %s  ", success ? "true" : "false");
    SkDebugf("scale: %g, %g\n", scale.width(), scale.height());
    remaining.dump();
    SkMatrix scaleMatrix = SkMatrix::MakeScale(scale.width(), scale.height());
    SkMatrix combined = SkMatrix::Concat(scaleMatrix, remaining);
    combined.dump();
#StdOut
[  0.0000  -0.2500   0.0000][  0.5000   0.0000   0.0000][  0.0000   0.0000   1.0000]
success: true  scale: 0.5, 0.25
[  0.0000  -0.5000   0.0000][  2.0000   0.0000   0.0000][  0.0000   0.0000   1.0000]
[  0.0000  -0.2500   0.0000][  0.5000   0.0000   0.0000][  0.0000   0.0000   1.0000]
##
##

#SeeAlso setScale MakeScale

##

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

#Method static const SkMatrix& I()
#In Constructor
#Line # returns a reference to a const identity Matrix ##
Returns reference to const identity Matrix. Returned Matrix is set to:

#Code
#Literal
| 1 0 0 |
| 0 1 0 |
| 0 0 1 |
##

#Return  const identity Matrix ##

#Example
    SkMatrix m1, m2, m3;
    m1.reset();
    m2.setIdentity();
    m3 = SkMatrix::I();
    SkDebugf("m1 %c= m2\n", m1 == m2 ? '=' : '!');
    SkDebugf("m2 %c= m3\n", m1 == m2 ? '=' : '!');
#StdOut
m1 == m2
m2 == m3
##
##

#SeeAlso reset() setIdentity

##

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

#Method static const SkMatrix& InvalidMatrix()
#In Constructor
#Line # returns a reference to a const invalid Matrix ##
Returns reference to a const Matrix with invalid values. Returned Matrix is set
to:

#Code
#Literal
| SK_ScalarMax SK_ScalarMax SK_ScalarMax |
| SK_ScalarMax SK_ScalarMax SK_ScalarMax |
| SK_ScalarMax SK_ScalarMax SK_ScalarMax |
##

#Return  const invalid Matrix ##

#Example
    SkDebugf("scaleX %g\n", SkMatrix::InvalidMatrix().getScaleX());
#StdOut
scaleX 3.40282e+38
##
##

#SeeAlso SeeAlso getType

##

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

#Method static SkMatrix Concat(const SkMatrix& a, const SkMatrix& b)
#In Operator
#Line # returns the concatenation of Matrix pair ##
Returns Matrix a multiplied by Matrix b.

Given:

#Code
#Literal
    | A B C |      | J K L |
a = | D E F |, b = | M N O |
    | G H I |      | P Q R |
##

sets Matrix to:

#Code
#Literal
        | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
        | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |
##

#Param a  Matrix on left side of multiply expression ##
#Param b  Matrix on right side of multiply expression ##

#Return  Matrix computed from a times b ##

#Example
#Height 64
#Image 4
#Description
setPolyToPoly creates perspective matrices, one the inverse of the other.
Multiplying the matrix by its inverse turns into an identity matrix.
##
SkMatrix matrix, matrix2;
SkPoint bitmapBounds[4], perspect[4] = {{50, 10}, {180, 40}, {236, 176}, {10, 206}};
SkRect::Make(source.bounds()).toQuad(bitmapBounds);
matrix.setPolyToPoly(bitmapBounds, perspect, 4);
matrix2.setPolyToPoly(perspect, bitmapBounds, 4);
SkMatrix concat = SkMatrix::Concat(matrix, matrix2);
canvas->concat(concat);
canvas->drawBitmap(source, 0, 0);
##

#SeeAlso preConcat postConcat

##

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

#Method void dirtyMatrixTypeCache()
#In Utility
#Line # sets internal cache to unknown state ##
Sets internal cache to unknown state. Use to force update after repeated
modifications to Matrix element reference returned by operator[](int index).

#Example
SkMatrix matrix;
matrix.setIdentity();
SkDebugf("with identity matrix: x = %g\n", matrix.mapXY(24, 42).fX);
SkScalar& skewRef = matrix[SkMatrix::kMSkewX];
skewRef = 0;
SkDebugf("after skew x mod:     x = %g\n", matrix.mapXY(24, 42).fX);
skewRef = 1;
SkDebugf("after 2nd skew x mod: x = %g\n", matrix.mapXY(24, 42).fX);
matrix.dirtyMatrixTypeCache();
SkDebugf("after dirty cache:    x = %g\n", matrix.mapXY(24, 42).fX);
#StdOut
with identity matrix: x = 24
after skew x mod:     x = 24
after 2nd skew x mod: x = 24
after dirty cache:    x = 66
##
##

#SeeAlso operator[](int index) getType

##

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

#Method void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty)
#In Constructor
#In Set
#Line # sets to scale and translate ##
Initializes Matrix with scale and translate elements.

#Code
#Literal
| sx  0 tx |
|  0 sy ty |
|  0  0  1 |
##

#Param sx  horizontal scale factor to store ##
#Param sy  vertical scale factor to store ##
#Param tx  horizontal translation to store ##
#Param ty  vertical translation to store ##

#Example
SkMatrix matrix;
matrix.setScaleTranslate(1, 2, 3, 4);
matrix.dump();
#StdOut
[  1.0000   0.0000   3.0000][  0.0000   2.0000   4.0000][  0.0000   0.0000   1.0000]
##
##

#SeeAlso setScale preTranslate postTranslate

##

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

#Method bool isFinite() const
#In Property
#Line # returns if all Matrix values are not infinity, NaN ##
Returns true if all elements of the matrix are finite. Returns false if any
element is infinity, or NaN.

#Return  true if matrix has only finite elements ##

#Example
SkMatrix matrix = SkMatrix::MakeTrans(SK_ScalarNaN, 0);
matrix.dump();
SkDebugf("matrix is finite: %s\n", matrix.isFinite() ? "true" : "false");
SkDebugf("matrix %c= matrix\n", matrix == matrix ? '=' : '!');
#StdOut
[  1.0000   0.0000      nan][  0.0000   1.0000   0.0000][  0.0000   0.0000   1.0000]
matrix is finite: false
matrix != matrix
##
##

#SeeAlso operator==

##

#Class SkMatrix ##

#Topic Matrix ##