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
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// NOLINTBEGIN(google-objc-function-naming)
///-----------------------------------------------------------------------------
///-----------------------------------------------------------------------------
/// ------- ___ _ _ _ ____ ___ --------
/// ------- |_ _|_ __ ___ _ __ ___| | | ___ _ __ / \ | _ \_ _| --------
/// ------- | || '_ ` _ \| '_ \ / _ \ | |/ _ \ '__| / _ \ | |_) | | --------
/// ------- | || | | | | | |_) | __/ | | __/ | / ___ \| __/| | --------
/// ------- |___|_| |_| |_| .__/ \___|_|_|\___|_| /_/ \_\_| |___| --------
/// ------- |_| --------
///-----------------------------------------------------------------------------
///-----------------------------------------------------------------------------
///
/// This file describes a high-level, single-header, dependency-free, 2D
/// graphics API.
///
/// The API fundamentals that include details about the object model, reference
/// counting, and null-safety are described in the README.
///
// defined(__cplusplus)
// IMPELLER_NO_EXPORT
// __clang__
// defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
//------------------------------------------------------------------------------
/// @brief Pack a version in a uint32_t.
///
/// @param[in] variant The version variant.
/// @param[in] major The major version.
/// @param[in] minor The minor version.
/// @param[in] patch The patch version.
///
/// @return The packed version number.
///
//------------------------------------------------------------------------------
/// The current Impeller API version.
///
/// This version must be passed to APIs that create top-level objects like
/// graphics contexts. Construction of the context may fail if the API version
/// expected by the caller is not supported by the library.
///
/// The version currently supported by the library is returned by a call to
/// `ImpellerGetVersion`
///
/// Since there are no API stability guarantees today, passing a version that is
/// different to the one returned by `ImpellerGetVersion` will always fail.
///
/// @see `ImpellerGetVersion`
///
//------------------------------------------------------------------------------
/// @param[in] version The packed version.
///
/// @return The version variant.
///
//------------------------------------------------------------------------------
/// @param[in] version The packed version.
///
/// @return The major version.
///
//------------------------------------------------------------------------------
/// @param[in] version The packed version.
///
/// @return The minor version.
///
//------------------------------------------------------------------------------
/// @param[in] version The packed version.
///
/// @return The patch version.
///
//------------------------------------------------------------------------------
// Handles
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// An Impeller graphics context. Contexts are platform and client-rendering-API
/// specific.
///
/// Contexts are thread-safe objects that are expensive to create. Most
/// applications will only ever create a single context during their lifetimes.
/// Once setup, Impeller is ready to render frames as performantly as possible.
///
/// During setup, context create the underlying graphics pipelines, allocators,
/// worker threads, etc...
///
/// The general guidance is to create as few contexts as possible (typically
/// just one) and share them as much as possible.
///
;
//------------------------------------------------------------------------------
/// Display lists represent encoded rendering intent. These objects are
/// immutable, reusable, thread-safe, and context-agnostic.
///
/// While it is perfectly fine to create new display lists per frame, there may
/// be opportunities for optimization when display lists are reused multiple
/// times.
///
;
//------------------------------------------------------------------------------
/// Display list builders allow for the incremental creation of display lists.
///
/// Display list builders are context-agnostic.
///
;
//------------------------------------------------------------------------------
/// Paints control the behavior of draw calls encoded in a display list.
///
/// Like display lists, paints are context-agnostic.
///
;
//------------------------------------------------------------------------------
/// Color filters are functions that take two colors and mix them to produce a
/// single color. This color is then merged with the destination during
/// blending.
///
;
//------------------------------------------------------------------------------
/// Color sources are functions that generate colors for each texture element
/// covered by a draw call. The colors for each element can be generated using a
/// mathematical function (to produce gradients for example) or sampled from a
/// texture.
///
;
//------------------------------------------------------------------------------
/// Image filters are functions that are applied regions of a texture to produce
/// a single color. Contrast this with color filters that operate independently
/// on a per-pixel basis. The generated color is then merged with the
/// destination during blending.
///
;
//------------------------------------------------------------------------------
/// Mask filters are functions that are applied over a shape after it has been
/// drawn but before it has been blended into the final image.
///
;
//------------------------------------------------------------------------------
/// Typography contexts allow for the layout and rendering of text.
///
/// These are typically expensive to create and applications will only ever need
/// to create a single one of these during their lifetimes.
///
/// Unlike graphics context, typograhy contexts are not thread-safe. These must
/// be created, used, and collected on a single thread.
///
;
//------------------------------------------------------------------------------
/// An immutable, fully laid out paragraph.
///
;
//------------------------------------------------------------------------------
/// Paragraph builders allow for the creation of fully laid out paragraphs
/// (which themselves are immutable).
///
/// To build a paragraph, users push/pop paragraph styles onto a stack then add
/// UTF-8 encoded text. The properties on the top of paragraph style stack when
/// the text is added are used to layout and shape that subset of the paragraph.
///
/// @see `ImpellerParagraphStyle`
///
;
//------------------------------------------------------------------------------
/// Specified when building a paragraph, paragraph styles are managed in a stack
/// with specify text properties to apply to text that is added to the paragraph
/// builder.
///
;
//------------------------------------------------------------------------------
/// Describes the metrics of lines in a fully laid out paragraph.
///
/// Regardless of how the string of text is specified to the paragraph builder,
/// offsets into buffers that are returned by line metrics are always assumed to
/// be into buffers of UTF-16 code units.
///
;
//------------------------------------------------------------------------------
/// Describes the metrics of glyphs in a paragraph line.
///
;
//------------------------------------------------------------------------------
/// Represents a two-dimensional path that is immutable and graphics context
/// agnostic.
///
/// Paths in Impeller consist of linear, cubic Bézier curve, and quadratic
/// Bézier curve segments. All other shapes are approximations using these
/// building blocks.
///
/// Paths are created using path builder that allow for the configuration of the
/// path segments, how they are filled, and/or stroked.
///
;
//------------------------------------------------------------------------------
/// Path builders allow for the incremental building up of paths.
///
;
//------------------------------------------------------------------------------
/// A surface represents a render target for Impeller to direct the rendering
/// intent specified the form of display lists to.
///
/// Render targets are how Impeller API users perform Window System Integration
/// (WSI). Users wrap swapchain images as surfaces and draw display lists onto
/// these surfaces to present content.
///
/// Creating surfaces is typically platform and client-rendering-API specific.
///
;
//------------------------------------------------------------------------------
/// A reference to a texture whose data is resident on the GPU. These can be
/// referenced in draw calls and paints.
///
/// Creating textures is extremely expensive. Creating a single one can
/// typically comfortably blow the frame budget of an application. Textures
/// should be created on background threads.
///
/// @warning While textures themselves are thread safe, some context types
/// (like OpenGL) may need extra configuration to be able to operate
/// from multiple threads.
///
;
//------------------------------------------------------------------------------
/// The primary form of WSI when using a Vulkan context, these swapchains use
/// the `VK_KHR_surface` Vulkan extension.
///
/// Creating a swapchain is extremely expensive. One must be created at
/// application startup and re-used throughout the application lifecycle.
///
/// Swapchains are resilient to the underlying surfaces being resized. The
/// swapchain images will be re-created as necessary on-demand.
///
;
//------------------------------------------------------------------------------
// Signatures
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// A callback invoked by Impeller that passes a user supplied baton back to the
/// user. Impeller does not interpret the baton in any way. The way the baton is
/// specified and the thread on which the callback is invoked depends on how the
/// user supplies the callback to Impeller.
///
typedef void ;
//------------------------------------------------------------------------------
/// A callback used by Impeller to allow the user to resolve function pointers.
/// A user supplied baton that is uninterpreted by Impeller is passed back to
/// the user in the callback. How the baton is specified to Impeller and the
/// thread on which the callback is invoked depends on how the callback is
/// specified to Impeller.
///
typedef void* ;
//------------------------------------------------------------------------------
/// A callback used by Impeller to allow the user to resolve Vulkan function
/// pointers. A user supplied baton that is uninterpreted by Impeller is passed
/// back to the user in the callback.
///
typedef void* ;
//------------------------------------------------------------------------------
// Enumerations
// -----------------------------------------------------------------------------
typedef enum ImpellerFillType ImpellerFillType;
typedef enum ImpellerClipOperation ImpellerClipOperation;
typedef enum ImpellerBlendMode ImpellerBlendMode;
typedef enum ImpellerDrawStyle ImpellerDrawStyle;
typedef enum ImpellerStrokeCap ImpellerStrokeCap;
typedef enum ImpellerStrokeJoin ImpellerStrokeJoin;
typedef enum ImpellerPixelFormat ImpellerPixelFormat;
typedef enum ImpellerTextureSampling ImpellerTextureSampling;
typedef enum ImpellerTileMode ImpellerTileMode;
typedef enum ImpellerBlurStyle ImpellerBlurStyle;
typedef enum ImpellerColorSpace ImpellerColorSpace;
typedef enum ImpellerFontWeight ImpellerFontWeight;
typedef enum ImpellerFontStyle ImpellerFontStyle;
typedef enum ImpellerTextAlignment ImpellerTextAlignment;
typedef enum ImpellerTextDirection ImpellerTextDirection;
//------------------------------------------------------------------------------
// Non-opaque structs
// -----------------------------------------------------------------------------
typedef struct ImpellerRect ImpellerRect;
typedef struct ImpellerPoint ImpellerPoint;
typedef struct ImpellerSize ImpellerSize;
typedef struct ImpellerISize ImpellerISize;
typedef struct ImpellerRange ImpellerRange;
//------------------------------------------------------------------------------
/// A 4x4 transformation matrix using column-major storage.
///
/// ```
/// | m[0] m[4] m[8] m[12] |
/// | m[1] m[5] m[9] m[13] |
/// | m[2] m[6] m[10] m[14] |
/// | m[3] m[7] m[11] m[15] |
/// ```
///
typedef struct ImpellerMatrix ImpellerMatrix;
//------------------------------------------------------------------------------
/// A 4x5 matrix using row-major storage used for transforming color values.
///
/// To transform color values, a 5x5 matrix is constructed with the 5th row
/// being identity. Then the following transformation is performed:
///
/// ```
/// | R' | | m[0] m[1] m[2] m[3] m[4] | | R |
/// | G' | | m[5] m[6] m[7] m[8] m[9] | | G |
/// | B' | = | m[10] m[11] m[12] m[13] m[14] | * | B |
/// | A' | | m[15] m[16] m[17] m[18] m[19] | | A |
/// | 1 | | 0 0 0 0 1 | | 1 |
/// ```
///
/// The translation column (m[4], m[9], m[14], m[19]) must be specified in
/// non-normalized 8-bit unsigned integer space (0 to 255). Values outside this
/// range will produce undefined results.
///
/// The identity transformation is thus:
///
/// ```
/// 1, 0, 0, 0, 0,
/// 0, 1, 0, 0, 0,
/// 0, 0, 1, 0, 0,
/// 0, 0, 0, 1, 0,
/// ```
///
/// Some examples:
///
/// To invert all colors:
///
/// ```
/// -1, 0, 0, 0, 255,
/// 0, -1, 0, 0, 255,
/// 0, 0, -1, 0, 255,
/// 0, 0, 0, 1, 0,
/// ```
///
/// To apply a sepia filter:
///
/// ```
/// 0.393, 0.769, 0.189, 0, 0,
/// 0.349, 0.686, 0.168, 0, 0,
/// 0.272, 0.534, 0.131, 0, 0,
/// 0, 0, 0, 1, 0,
/// ```
///
/// To apply a grayscale conversion filter:
///
/// ```
/// 0.2126, 0.7152, 0.0722, 0, 0,
/// 0.2126, 0.7152, 0.0722, 0, 0,
/// 0.2126, 0.7152, 0.0722, 0, 0,
/// 0, 0, 0, 1, 0,
/// ```
///
/// @see ImpellerColorFilter
///
typedef struct ImpellerColorMatrix ImpellerColorMatrix;
typedef struct ImpellerRoundingRadii ImpellerRoundingRadii;
typedef struct ImpellerColor ImpellerColor;
typedef struct ImpellerTextureDescriptor ImpellerTextureDescriptor;
typedef struct ImpellerMapping ImpellerMapping;
typedef struct ImpellerContextVulkanSettings ImpellerContextVulkanSettings;
typedef struct ImpellerContextVulkanInfo ImpellerContextVulkanInfo;
//------------------------------------------------------------------------------
// Version
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Get the version of Impeller standalone API. This is the API that
/// will be accepted for validity checks when provided to the
/// context creation methods.
///
/// The current version of the API is denoted by the
/// `IMPELLER_VERSION` macro. This version must be passed to APIs
/// that create top-level objects like graphics contexts.
/// Construction of the context may fail if the API version expected
/// by the caller is not supported by the library.
///
/// Since there are no API stability guarantees today, passing a
/// version that is different to the one returned by
/// `ImpellerGetVersion` will always fail.
///
/// @see `ImpellerContextCreateOpenGLESNew`
///
/// @return The version of the standalone API.
///
uint32_t ;
//------------------------------------------------------------------------------
// Context
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create an OpenGL(ES) Impeller context.
///
/// @warning Unlike other context types, the OpenGL ES context can only be
/// created, used, and collected on the calling thread. This
/// restriction may be lifted in the future once reactor workers are
/// exposed in the API. No other context types have threading
/// restrictions. Till reactor workers can be used, using the
/// context on a background thread will cause a stall of OpenGL
/// operations.
///
/// @param[in] version The version of the Impeller
/// standalone API. See `ImpellerGetVersion`. If the
/// specified here is not compatible with the version
/// of the library, context creation will fail and NULL
/// context returned from this call.
/// @param[in] gl_proc_address_callback
/// The gl proc address callback. For instance,
/// `eglGetProcAddress`.
/// @param[in] gl_proc_address_callback_user_data
/// The gl proc address callback user data baton. This
/// pointer is not interpreted by Impeller and will be
/// returned as user data in the proc address callback.
/// user data.
///
/// @return The context or NULL if one cannot be created.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a Metal context using the system default Metal device.
///
/// @param[in] version The version specified in the IMPELLER_VERSION macro.
///
/// @return The Metal context or NULL if one cannot be created.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a Vulkan context using the provided Vulkan Settings.
///
/// @param[in] version The version specified in the IMPELLER_VERSION macro.
/// @param[in] settings The Vulkan settings.
///
/// @return The Vulkan context or NULL if one cannot be created.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerContext IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] context The context.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] context The context.
///
void ;
//------------------------------------------------------------------------------
/// @brief Get internal Vulkan handles managed by the given Vulkan context.
/// Ownership of the handles is still maintained by Impeller. This
/// accessor is just available so embedders can create resources
/// using the same device and instance as Impeller for interop.
///
/// @warning If the context is not a Vulkan context, False is returned with
/// the [out] argument unaffected.
///
/// @param[in] context The context
/// @param[out] out_vulkan_info The out vulkan information
///
/// @return If the Vulkan info could be fetched from the context.
///
bool ;
//------------------------------------------------------------------------------
// Vulkan Swapchain
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new Vulkan swapchain using a VkSurfaceKHR instance.
/// Ownership of the surface is transferred over to Impeller. The
/// Vulkan instance the surface is created from must the same as the
/// context provided.
///
/// @param[in] context The context. Must be a Vulkan context whose
/// instance is the same used to create the
/// surface passed into the next argument.
/// @param vulkan_surface_khr The vulkan surface.
///
/// @return The vulkan swapchain.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerVulkanSwapchain IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] swapchain The swapchain.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] swapchain The swapchain.
///
void ;
//------------------------------------------------------------------------------
/// @brief A potentially blocking operation, acquires the next surface to
/// render to. Since this may block, surface acquisition must be
/// delayed for as long as possible to avoid an idle wait on the
/// CPU.
///
/// @param[in] swapchain The swapchain.
///
/// @return The surface if one could be obtained, NULL otherwise.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Surface
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new surface by wrapping an existing framebuffer object.
/// The framebuffer must be complete as determined by
/// `glCheckFramebufferStatus`. The framebuffer is still owned by
/// the caller and it must be collected once the surface is
/// collected.
///
/// @param[in] context The context.
/// @param[in] fbo The framebuffer object handle.
/// @param[in] format The format of the framebuffer.
/// @param[in] size The size of the framebuffer is texels.
///
/// @return The surface if once can be created, NULL otherwise.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a surface by wrapping a Metal drawable. This is useful
/// during WSI when the drawable is the backing store of the Metal
/// layer being drawn to.
///
/// The Metal layer must be using the same device managed by the
/// underlying context.
///
/// @param[in] context The context. The Metal device managed by this
/// context must be the same used to create the
/// drawable that is being wrapped.
/// @param metal_drawable The drawable to wrap as a surface.
///
/// @return The surface if one could be wrapped, NULL otherwise.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerSurface IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] surface The surface.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] surface The surface.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draw a display list onto the surface. The same display list can
/// be drawn multiple times to different surfaces.
///
/// @warning In the OpenGL backend, Impeller will not make an effort to
/// preserve the OpenGL state that is current in the context.
/// Embedders that perform additional OpenGL operations in the
/// context should expect the reset state after control transitions
/// back to them. Key state to watch out for would be the viewports,
/// stencil rects, test toggles, resource (texture, framebuffer,
/// buffer) bindings, etc...
///
/// @param[in] surface The surface to draw the display list to.
/// @param[in] display_list The display list to draw onto the surface.
///
/// @return If the display list could be drawn onto the surface.
///
bool ;
//------------------------------------------------------------------------------
/// @brief Present the surface to the underlying window system.
///
/// @param[in] surface The surface to present.
///
/// @return True if the surface could be presented.
///
bool ;
//------------------------------------------------------------------------------
// Path
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] path The path.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] path The path.
///
void ;
//------------------------------------------------------------------------------
// Path Builder
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new path builder. Paths themselves are immutable.
/// A builder builds these immutable paths.
///
/// @return The path builder.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPathBuilder IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] builder The builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] builder The builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Move the cursor to the specified location.
///
/// @param[in] builder The builder.
/// @param[in] location The location.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add a line segment from the current cursor location to the given
/// location. The cursor location is updated to be at the endpoint.
///
/// @param[in] builder The builder.
/// @param[in] location The location.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add a quadratic curve from whose start point is the cursor to
/// the specified end point using the a single control point.
///
/// The new location of the cursor after this call is the end point.
///
/// @param[in] builder The builder.
/// @param[in] control_point The control point.
/// @param[in] end_point The end point.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add a cubic curve whose start point is current cursor location
/// to the specified end point using the two specified control
/// points.
///
/// The new location of the cursor after this call is the end point
/// supplied.
///
/// @param[in] builder The builder
/// @param[in] control_point_1 The control point 1
/// @param[in] control_point_2 The control point 2
/// @param[in] end_point The end point
///
void ;
//------------------------------------------------------------------------------
/// @brief Adds a rectangle to the path.
///
/// @param[in] builder The builder.
/// @param[in] rect The rectangle.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add an arc to the path.
///
/// @param[in] builder The builder.
/// @param[in] oval_bounds The oval bounds.
/// @param[in] start_angle_degrees The start angle in degrees.
/// @param[in] end_angle_degrees The end angle in degrees.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add an oval to the path.
///
/// @param[in] builder The builder.
/// @param[in] oval_bounds The oval bounds.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add a rounded rect with potentially non-uniform radii to the
/// path.
///
/// @param[in] builder The builder.
/// @param[in] rect The rectangle.
/// @param[in] rounding_radii The rounding radii.
///
void ;
//------------------------------------------------------------------------------
/// @brief Close the path.
///
/// @param[in] builder The builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Create a new path by copying the existing built-up path. The
/// existing path can continue being added to.
///
/// @param[in] builder The builder.
/// @param[in] fill The fill.
///
/// @return The impeller path.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPath IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a new path using the existing built-up path. The existing
/// path builder now contains an empty path.
///
/// @param[in] builder The builder.
/// @param[in] fill The fill.
///
/// @return The impeller path.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPath IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Paint
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new paint with default values.
///
/// @return The impeller paint.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerPaint IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the paint color.
///
/// @param[in] paint The paint.
/// @param[in] color The color.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the paint blend mode. The blend mode controls how the new
/// paints contents are mixed with the values already drawn using
/// previous draw calls.
///
/// @param[in] paint The paint.
/// @param[in] mode The mode.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the paint draw style. The style controls if the closed
/// shapes are filled and/or stroked.
///
/// @param[in] paint The paint.
/// @param[in] style The style.
///
void ;
//------------------------------------------------------------------------------
/// @brief Sets how strokes rendered using this paint are capped.
///
/// @param[in] paint The paint.
/// @param[in] cap The stroke cap style.
///
void ;
//------------------------------------------------------------------------------
/// @brief Sets how strokes rendered using this paint are joined.
///
/// @param[in] paint The paint.
/// @param[in] join The join.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the width of the strokes rendered using this paint.
///
/// @param[in] paint The paint.
/// @param[in] width The width.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the miter limit of the strokes rendered using this paint.
///
/// @param[in] paint The paint.
/// @param[in] miter The miter limit.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the color filter of the paint.
///
/// Color filters are functions that take two colors and mix them to
/// produce a single color. This color is then usually merged with
/// the destination during blending.
///
/// @param[in] paint The paint.
/// @param[in] color_filter The color filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the color source of the paint.
///
/// Color sources are functions that generate colors for each
/// texture element covered by a draw call.
///
/// @param[in] paint The paint.
/// @param[in] color_source The color source.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the image filter of a paint.
///
/// Image filters are functions that are applied to regions of a
/// texture to produce a single color.
///
/// @param[in] paint The paint.
/// @param[in] image_filter The image filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the mask filter of a paint.
///
/// @param[in] paint The paint.
/// @param[in] mask_filter The mask filter.
///
void ;
//------------------------------------------------------------------------------
// Texture
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a texture with decompressed bytes.
///
/// Impeller will do its best to perform the transfer of this data
/// to GPU memory with a minimal number of copies. Towards this
/// end, it may need to send this data to a different thread for
/// preparation and transfer. To facilitate this transfer, it is
/// recommended that the content mapping have a release callback
/// attach to it. When there is a release callback, Impeller assumes
/// that collection of the data can be deferred till texture upload
/// is done and can happen on a background thread. When there is no
/// release callback, Impeller may try to perform an eager copy of
/// the data if it needs to perform data preparation and transfer on
/// a background thread.
///
/// Whether an extra data copy actually occurs will always depend on
/// the rendering backend in use. But it is best practice to provide
/// a release callback and be resilient to the data being released
/// in a deferred manner on a background thread.
///
/// @warning Do **not** supply compressed image data directly (PNG, JPEG,
/// etc...). This function only works with tightly packed
/// decompressed data.
///
/// @param[in] context The context.
/// @param[in] descriptor The texture descriptor.
/// @param[in] contents The contents.
/// @param[in] contents_on_release_user_data The baton passes to the contents
/// release callback if one exists.
///
/// @return The texture if one can be created using the provided data, NULL
/// otherwise.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTexture IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a texture with an externally created OpenGL texture
/// handle.
///
/// Ownership of the handle is transferred over to Impeller after a
/// successful call to this method. Impeller is responsible for
/// calling glDeleteTextures on this handle. Do **not** collect this
/// handle yourself as this will lead to a double-free.
///
/// The handle must be created in the same context as the one used
/// by Impeller. If a different context is used, that context must
/// be in the same sharegroup as Impellers OpenGL context and all
/// synchronization of texture contents must already be complete.
///
/// If the context is not an OpenGL context, this call will always
/// fail.
///
/// @param[in] context The context
/// @param[in] descriptor The descriptor
/// @param[in] handle The handle
///
/// @return The texture if one could be created by adopting the supplied
/// texture handle, NULL otherwise.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTexture IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] texture The texture.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] texture The texture.
///
void ;
//------------------------------------------------------------------------------
/// @brief Get the OpenGL handle associated with this texture. If this is
/// not an OpenGL texture, this method will always return 0.
///
/// OpenGL handles are lazily created, this method will return
/// GL_NONE is no OpenGL handle is available. To ensure that this
/// call eagerly creates an OpenGL texture, call this on a thread
/// where Impeller knows there is an OpenGL context available.
///
/// @param[in] texture The texture.
///
/// @return The OpenGL handle if one is available, GL_NONE otherwise.
///
uint64_t ;
//------------------------------------------------------------------------------
// Color Sources
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] color_source The color source.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] color_source The color source.
///
void ;
//------------------------------------------------------------------------------
/// @brief Create a color source that forms a linear gradient.
///
/// @param[in] start_point The start point.
/// @param[in] end_point The end point.
/// @param[in] stop_count The stop count.
/// @param[in] colors The colors.
/// @param[in] stops The stops.
/// @param[in] tile_mode The tile mode.
/// @param[in] transformation The transformation.
///
/// @return The color source.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a color source that forms a radial gradient.
///
/// @param[in] center The center.
/// @param[in] radius The radius.
/// @param[in] stop_count The stop count.
/// @param[in] colors The colors.
/// @param[in] stops The stops.
/// @param[in] tile_mode The tile mode.
/// @param[in] transformation The transformation.
///
/// @return The color source.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a color source that forms a conical gradient.
///
/// @param[in] start_center The start center.
/// @param[in] start_radius The start radius.
/// @param[in] end_center The end center.
/// @param[in] end_radius The end radius.
/// @param[in] stop_count The stop count.
/// @param[in] colors The colors.
/// @param[in] stops The stops.
/// @param[in] tile_mode The tile mode.
/// @param[in] transformation The transformation.
///
/// @return The color source.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a color source that forms a sweep gradient.
///
/// @param[in] center The center.
/// @param[in] start The start.
/// @param[in] end The end.
/// @param[in] stop_count The stop count.
/// @param[in] colors The colors.
/// @param[in] stops The stops.
/// @param[in] tile_mode The tile mode.
/// @param[in] transformation The transformation.
///
/// @return The color source.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a color source that samples from an image.
///
/// @param[in] image The image.
/// @param[in] horizontal_tile_mode The horizontal tile mode.
/// @param[in] vertical_tile_mode The vertical tile mode.
/// @param[in] sampling The sampling.
/// @param[in] transformation The transformation.
///
/// @return The color source.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorSource IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Color Filters
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] color_filter The color filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] color_filter The color filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Create a color filter that performs blending of pixel values
/// independently.
///
/// @param[in] color The color.
/// @param[in] blend_mode The blend mode.
///
/// @return The color filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a color filter that transforms pixel color values
/// independently.
///
/// @param[in] color_matrix The color matrix.
///
/// @return The color filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerColorFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Mask Filters
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] mask_filter The mask filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] mask_filter The mask filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Create a mask filter that blurs contents in the masked shape.
///
/// @param[in] style The style.
/// @param[in] sigma The sigma.
///
/// @return The mask filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerMaskFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Image Filters
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] image_filter The image filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] image_filter The image filter.
///
void ;
//------------------------------------------------------------------------------
/// @brief Creates an image filter that applies a Gaussian blur.
///
/// The Gaussian blur applied may be an approximation for
/// performance.
///
///
/// @param[in] x_sigma The x sigma.
/// @param[in] y_sigma The y sigma.
/// @param[in] tile_mode The tile mode.
///
/// @return The image filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Creates an image filter that enhances the per-channel pixel
/// values to the maximum value in a circle around the pixel.
///
/// @param[in] x_radius The x radius.
/// @param[in] y_radius The y radius.
///
/// @return The image filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Creates an image filter that dampens the per-channel pixel
/// values to the minimum value in a circle around the pixel.
///
/// @param[in] x_radius The x radius.
/// @param[in] y_radius The y radius.
///
/// @return The image filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Creates an image filter that applies a transformation matrix to
/// the underlying image.
///
/// @param[in] matrix The transformation matrix.
/// @param[in] sampling The image sampling mode.
///
/// @return The image filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Creates a composed filter that when applied is identical to
/// subsequently applying the inner and then the outer filters.
///
/// ```
/// destination = outer_filter(inner_filter(source))
/// ```
///
/// @param[in] outer The outer image filter.
/// @param[in] inner The inner image filter.
///
/// @return The combined image filter.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerImageFilter IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Display List
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] display_list The display list.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] display_list The display list.
///
void ;
//------------------------------------------------------------------------------
// Display List Builder
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new display list builder.
///
/// An optional cull rectangle may be specified. Impeller is allowed
/// to treat the contents outside this rectangle as being undefined.
/// This may aid performance optimizations.
///
/// @param[in] cull_rect The cull rectangle or NULL.
///
/// @return The display list builder.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayListBuilder IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] builder The display list builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] builder The display list builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Create a new display list using the rendering intent already
/// encoded in the builder. The builder is reset after this call.
///
/// @param[in] builder The builder.
///
/// @return The display list.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerDisplayList IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Display List Builder: Managing the transformation stack.
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Stashes the current transformation and clip state onto a save
/// stack.
///
/// @param[in] builder The builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Stashes the current transformation and clip state onto a save
/// stack and creates and creates an offscreen layer onto which
/// subsequent rendering intent will be directed to.
///
/// On the balancing call to restore, the supplied paints filters
/// and blend modes will be used to composite the offscreen contents
/// back onto the display display list.
///
/// @param[in] builder The builder.
/// @param[in] bounds The bounds.
/// @param[in] paint The paint.
/// @param[in] backdrop The backdrop.
///
void ;
//------------------------------------------------------------------------------
/// @brief Pops the last entry pushed onto the save stack using a call to
/// `ImpellerDisplayListBuilderSave` or
/// `ImpellerDisplayListBuilderSaveLayer`.
///
/// @param[in] builder The builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Apply a scale to the transformation matrix currently on top of
/// the save stack.
///
/// @param[in] builder The builder.
/// @param[in] x_scale The x scale.
/// @param[in] y_scale The y scale.
///
void ;
//------------------------------------------------------------------------------
/// @brief Apply a clockwise rotation to the transformation matrix
/// currently on top of the save stack.
///
/// @param[in] builder The builder.
/// @param[in] angle_degrees The angle in degrees.
///
void ;
//------------------------------------------------------------------------------
/// @brief Apply a translation to the transformation matrix currently on
/// top of the save stack.
///
/// @param[in] builder The builder.
/// @param[in] x_translation The x translation.
/// @param[in] y_translation The y translation.
///
void ;
//------------------------------------------------------------------------------
/// @brief Appends the the provided transformation to the transformation
/// already on the save stack.
///
/// @param[in] builder The builder.
/// @param[in] transform The transform to append.
///
void ;
//------------------------------------------------------------------------------
/// @brief Clear the transformation on top of the save stack and replace it
/// with a new value.
///
/// @param[in] builder The builder.
/// @param[in] transform The new transform.
///
void ;
//------------------------------------------------------------------------------
/// @brief Get the transformation currently built up on the top of the
/// transformation stack.
///
/// @param[in] builder The builder.
/// @param[out] out_transform The transform.
///
void ;
//------------------------------------------------------------------------------
/// @brief Reset the transformation on top of the transformation stack to
/// identity.
///
/// @param[in] builder The builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Get the current size of the save stack.
///
/// @param[in] builder The builder.
///
/// @return The save stack size.
///
uint32_t ;
//------------------------------------------------------------------------------
/// @brief Effectively calls ImpellerDisplayListBuilderRestore till the
/// size of the save stack becomes a specified count.
///
/// @param[in] builder The builder.
/// @param[in] count The count.
///
void ;
//------------------------------------------------------------------------------
// Display List Builder: Clipping
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Reduces the clip region to the intersection of the current clip
/// and the given rectangle taking into account the clip operation.
///
/// @param[in] builder The builder.
/// @param[in] rect The rectangle.
/// @param[in] op The operation.
///
void ;
//------------------------------------------------------------------------------
/// @brief Reduces the clip region to the intersection of the current clip
/// and the given oval taking into account the clip operation.
///
/// @param[in] builder The builder.
/// @param[in] oval_bounds The oval bounds.
/// @param[in] op The operation.
///
void ;
//------------------------------------------------------------------------------
/// @brief Reduces the clip region to the intersection of the current clip
/// and the given rounded rectangle taking into account the clip
/// operation.
///
/// @param[in] builder The builder.
/// @param[in] rect The rectangle.
/// @param[in] radii The radii.
/// @param[in] op The operation.
///
void ;
//------------------------------------------------------------------------------
/// @brief Reduces the clip region to the intersection of the current clip
/// and the given path taking into account the clip operation.
///
/// @param[in] builder The builder.
/// @param[in] path The path.
/// @param[in] op The operation.
///
void ;
//------------------------------------------------------------------------------
// Display List Builder: Drawing Shapes
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Fills the current clip with the specified paint.
///
/// @param[in] builder The builder.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws a line segment.
///
/// @param[in] builder The builder.
/// @param[in] from The starting point of the line.
/// @param[in] to The end point of the line.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws a dash line segment.
///
/// @param[in] builder The builder.
/// @param[in] from The starting point of the line.
/// @param[in] to The end point of the line.
/// @param[in] on_length On length.
/// @param[in] off_length Off length.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws a rectangle.
///
/// @param[in] builder The builder.
/// @param[in] rect The rectangle.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws an oval.
///
/// @param[in] builder The builder.
/// @param[in] oval_bounds The oval bounds.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws a rounded rect.
///
/// @param[in] builder The builder.
/// @param[in] rect The rectangle.
/// @param[in] radii The radii.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws a shape that is the different between the specified
/// rectangles (each with configurable corner radii).
///
/// @param[in] builder The builder.
/// @param[in] outer_rect The outer rectangle.
/// @param[in] outer_radii The outer radii.
/// @param[in] inner_rect The inner rectangle.
/// @param[in] inner_radii The inner radii.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draws the specified shape.
///
/// @param[in] builder The builder.
/// @param[in] path The path.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Flattens the contents of another display list into the one
/// currently being built.
///
/// @param[in] builder The builder.
/// @param[in] display_list The display list.
/// @param[in] opacity The opacity.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draw a paragraph at the specified point.
///
/// @param[in] builder The builder.
/// @param[in] paragraph The paragraph.
/// @param[in] point The point.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draw a shadow for a Path given a material elevation. If the
/// occluding object is not opaque, additional hints (via the
/// `occluder_is_transparent` argument) must be provided to render
/// the shadow correctly.
///
/// @param[in] builder The builder.
/// @param[in] path The shadow path.
/// @param[in] color The shadow color.
/// @param[in] elevation The material elevation.
/// @param[in] occluder_is_transparent
/// If the object casting the shadow is transparent.
/// @param[in] device_pixel_ratio
/// The device pixel ratio.
///
void ;
//------------------------------------------------------------------------------
// Display List Builder: Drawing Textures
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Draw a texture at the specified point.
///
/// @param[in] builder The builder.
/// @param[in] texture The texture.
/// @param[in] point The point.
/// @param[in] sampling The sampling.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Draw a portion of texture at the specified location.
///
/// @param[in] builder The builder.
/// @param[in] texture The texture.
/// @param[in] src_rect The source rectangle.
/// @param[in] dst_rect The destination rectangle.
/// @param[in] sampling The sampling.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
// Typography Context
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new typography contents.
///
/// @return The typography context.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerTypographyContext IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] context The typography context.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] context The typography context.
///
void ;
//------------------------------------------------------------------------------
/// @brief Register a custom font.
///
/// The following font formats are supported:
/// * OpenType font collections (.ttc extension)
/// * TrueType fonts: (.ttf extension)
/// * OpenType fonts: (.otf extension)
///
/// @warning Web Open Font Formats (.woff and .woff2 extensions) are **not**
/// supported.
///
/// The font data is specified as a mapping. It is possible for the
/// release callback of the mapping to not be called even past the
/// destruction of the typography context. Care must be taken to not
/// collect the mapping till the release callback is invoked by
/// Impeller.
///
/// The family alias name can be NULL. In such cases, the font
/// family specified in paragraph styles must match the family that
/// is specified in the font data.
///
/// If the family name alias is not NULL, that family name must be
/// used in the paragraph style to reference glyphs from this font
/// instead of the one encoded in the font itself.
///
/// Multiple fonts (with glyphs for different styles) can be
/// specified with the same family.
///
/// @see `ImpellerParagraphStyleSetFontFamily`
///
/// @param[in] context The context.
/// @param[in] contents The contents.
/// @param[in] contents_on_release_user_data The user data baton to be passed
/// to the contents release callback.
/// @param[in] family_name_alias The family name alias or NULL if
/// the one specified in the font
/// data is to be used.
///
/// @return If the font could be successfully registered.
///
bool ;
//------------------------------------------------------------------------------
// Paragraph Style
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new paragraph style.
///
/// @return The paragraph style.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphStyle IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] paragraph_style The paragraph style.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] paragraph_style The paragraph style.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the paint used to render the text glyph contents.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the paint used to render the background of the text glyphs.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] paint The paint.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the weight of the font to select when rendering glyphs.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] weight The weight.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set whether the glyphs should be bolded or italicized.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] style The style.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the font family.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] family_name The family name.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the font size.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] size The size.
///
void ;
//------------------------------------------------------------------------------
/// @brief The height of the text as a multiple of text size.
///
/// When height is 0.0, the line height will be determined by the
/// font's metrics directly, which may differ from the font size.
/// Otherwise the line height of the text will be a multiple of font
/// size, and be exactly fontSize * height logical pixels tall.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] height The height.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the alignment of text within the paragraph.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] align The align.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the directionality of the text within the paragraph.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] direction The direction.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the maximum line count within the paragraph.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] max_lines The maximum lines.
///
void ;
//------------------------------------------------------------------------------
/// @brief Set the paragraph locale.
///
/// @param[in] paragraph_style The paragraph style.
/// @param[in] locale The locale.
///
void ;
//------------------------------------------------------------------------------
// Paragraph Builder
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Create a new paragraph builder.
///
/// @param[in] context The context.
///
/// @return The paragraph builder.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraphBuilder IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] paragraph_builder The paragraph builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] paragraph_builder The paragraph_builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Push a new paragraph style onto the paragraph style stack
/// managed by the paragraph builder.
///
/// Not all paragraph styles can be combined. For instance, it does
/// not make sense to mix text alignment for different text runs
/// within a paragraph. In such cases, the preference of the the
/// first paragraph style on the style stack will take hold.
///
/// If text is pushed onto the paragraph builder without a style
/// previously pushed onto the stack, a default paragraph text style
/// will be used. This may not always be desirable because some
/// style element cannot be overridden. It is recommended that a
/// default paragraph style always be pushed onto the stack before
/// the addition of any text.
///
/// @param[in] paragraph_builder The paragraph builder.
/// @param[in] style The style.
///
void ;
//------------------------------------------------------------------------------
/// @brief Pop a previously pushed paragraph style from the paragraph style
/// stack.
///
/// @param[in] paragraph_builder The paragraph builder.
///
void ;
//------------------------------------------------------------------------------
/// @brief Add UTF-8 encoded text to the paragraph. The text will be styled
/// according to the paragraph style already on top of the paragraph
/// style stack.
///
/// @param[in] paragraph_builder The paragraph builder.
/// @param[in] data The data.
/// @param[in] length The length.
///
void ;
//------------------------------------------------------------------------------
/// @brief Layout and build a new paragraph using the specified width. The
/// resulting paragraph is immutable. The paragraph builder must be
/// discarded and a new one created to build more paragraphs.
///
/// @param[in] paragraph_builder The paragraph builder.
/// @param[in] width The paragraph width.
///
/// @return The paragraph if one can be created, NULL otherwise.
///
IMPELLER_EXPORT IMPELLER_NODISCARD ImpellerParagraph IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Paragraph
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] paragraph The paragraph.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] paragraph The paragraph.
///
void ;
//------------------------------------------------------------------------------
/// @see `ImpellerParagraphGetMinIntrinsicWidth`
///
/// @param[in] paragraph The paragraph.
///
///
/// @return The width provided to the paragraph builder during the call to
/// layout. This is the maximum width any line in the laid out
/// paragraph can occupy. But, it is not necessarily the actual
/// width of the paragraph after layout.
///
float ;
//------------------------------------------------------------------------------
/// @param[in] paragraph The paragraph.
///
/// @return The height of the laid out paragraph. This is **not** a tight
/// bounding box and some glyphs may not reach the minimum location
/// they are allowed to reach.
///
float ;
//------------------------------------------------------------------------------
/// @param[in] paragraph The paragraph.
///
/// @return The length of the longest line in the paragraph. This is the
/// horizontal distance between the left edge of the leftmost glyph
/// and the right edge of the rightmost glyph, in the longest line
/// in the paragraph.
///
float ;
//------------------------------------------------------------------------------
/// @see `ImpellerParagraphGetMaxWidth`
///
/// @param[in] paragraph The paragraph.
///
/// @return The actual width of the longest line in the paragraph after
/// layout. This is expected to be less than or equal to
/// `ImpellerParagraphGetMaxWidth`.
///
float ;
//------------------------------------------------------------------------------
/// @param[in] paragraph The paragraph.
///
/// @return The width of the paragraph without line breaking.
///
float ;
//------------------------------------------------------------------------------
/// @param[in] paragraph The paragraph.
///
/// @return The distance from the top of the paragraph to the ideographic
/// baseline of the first line when using ideographic fonts
/// (Japanese, Korean, etc...).
///
float ;
//------------------------------------------------------------------------------
/// @param[in] paragraph The paragraph.
///
/// @return The distance from the top of the paragraph to the alphabetic
/// baseline of the first line when using alphabetic fonts (A-Z,
/// a-z, Greek, etc...).
///
float ;
//------------------------------------------------------------------------------
/// @param[in] paragraph The paragraph.
///
/// @return The number of lines visible in the paragraph after line
/// breaking.
///
uint32_t ;
//------------------------------------------------------------------------------
/// @brief Get the range into the UTF-16 code unit buffer that represents
/// the word at the specified caret location in the same buffer.
///
/// Word boundaries are defined more precisely in [Unicode Standard
/// Annex #29](http://www.unicode.org/reports/tr29/#Word_Boundaries)
///
/// @param[in] paragraph The paragraph
/// @param[in] code_unit_index The code unit index
///
/// @return The impeller range.
///
ImpellerRange ;
//------------------------------------------------------------------------------
/// @brief Get the line metrics of this laid out paragraph. Calculating the
/// line metrics is expensive. The first time line metrics are
/// requested, they will be cached along with the paragraph (which
/// is immutable).
///
/// @param[in] paragraph The paragraph.
///
/// @return The line metrics.
///
ImpellerLineMetrics IMPELLER_NULLABLE ;
//------------------------------------------------------------------------------
/// @brief Create a new instance of glyph info that can be queried for
/// information about the glyph at the given UTF-16 code unit index.
/// The instance must be freed using `ImpellerGlyphInfoRelease`.
///
/// @param[in] paragraph The paragraph.
/// @param[in] code_unit_index The UTF-16 code unit index.
///
/// @return The glyph information.
///
IMPELLER_NODISCARD ImpellerGlyphInfo IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
/// @brief Create a new instance of glyph info that can be queried for
/// information about the glyph closest to the specified coordinates
/// relative to the origin of the paragraph. The instance must be
/// freed using `ImpellerGlyphInfoRelease`.
///
/// @param[in] paragraph The paragraph.
/// @param[in] x The x coordinate relative to paragraph origin.
/// @param[in] y The x coordinate relative to paragraph origin.
///
/// @return The glyph information.
///
IMPELLER_NODISCARD ImpellerGlyphInfo IMPELLER_NULLABLE
;
//------------------------------------------------------------------------------
// Line Metrics
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] line_metrics The line metrics.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] line_metrics The line metrics.
///
void ;
//------------------------------------------------------------------------------
/// @brief The rise from the baseline as calculated from the font and style
/// for this line ignoring the height from the text style.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The unscaled ascent.
///
double ;
//------------------------------------------------------------------------------
/// @brief The rise from the baseline as calculated from the font and style
/// for this line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The ascent.
///
double ;
//------------------------------------------------------------------------------
/// @brief The drop from the baseline as calculated from the font and style
/// for this line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The descent.
///
double ;
//------------------------------------------------------------------------------
/// @brief The y coordinate of the baseline for this line from the top of
/// the paragraph.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The baseline.
///
double ;
//------------------------------------------------------------------------------
/// @brief Used to determine if this line ends with an explicit line break
/// (e.g. '\n') or is the end of the paragraph.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return True if the line is a hard break.
///
bool ;
//------------------------------------------------------------------------------
/// @brief Width of the line from the left edge of the leftmost glyph to
/// the right edge of the rightmost glyph.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The width.
///
double ;
//------------------------------------------------------------------------------
/// @brief Total height of the line from the top edge to the bottom edge.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The height.
///
double ;
//------------------------------------------------------------------------------
/// @brief The x coordinate of left edge of the line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The left edge coordinate.
///
double ;
//------------------------------------------------------------------------------
/// @brief Fetch the start index in the buffer of UTF-16 code units used to
/// represent the paragraph line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The UTF-16 code units start index.
///
size_t ;
//------------------------------------------------------------------------------
/// @brief Fetch the end index in the buffer of UTF-16 code units used to
/// represent the paragraph line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The UTF-16 code units end index.
///
size_t ;
//------------------------------------------------------------------------------
/// @brief Fetch the end index (excluding whitespace) in the buffer of
/// UTF-16 code units used to represent the paragraph line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The UTF-16 code units end index excluding whitespace.
///
size_t ;
//------------------------------------------------------------------------------
/// @brief Fetch the end index (including newlines) in the buffer of UTF-16
/// code units used to represent the paragraph line.
///
/// @param[in] metrics The metrics.
/// @param[in] line The line index (zero based).
///
/// @return The UTF-16 code units end index including newlines.
///
size_t ;
//------------------------------------------------------------------------------
// Glyph Info
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
/// @brief Retain a strong reference to the object. The object can be NULL
/// in which case this method is a no-op.
///
/// @param[in] glyph_info The glyph information.
///
void ;
//------------------------------------------------------------------------------
/// @brief Release a previously retained reference to the object. The
/// object can be NULL in which case this method is a no-op.
///
/// @param[in] glyph_info The glyph information.
///
void ;
//------------------------------------------------------------------------------
/// @brief Fetch the start index in the buffer of UTF-16 code units used to
/// represent the grapheme cluster for a glyph.
///
/// @param[in] glyph_info The glyph information.
///
/// @return The UTF-16 code units start index.
///
size_t ;
//------------------------------------------------------------------------------
/// @brief Fetch the end index in the buffer of UTF-16 code units used to
/// represent the grapheme cluster for a glyph.
///
/// @param[in] glyph_info The glyph information.
///
/// @return The UTF-16 code units end index.
///
size_t ;
//------------------------------------------------------------------------------
/// @brief Fetch the bounds of the grapheme cluster for the glyph in the
/// coordinate space of the paragraph.
///
/// @param[in] glyph_info The glyph information.
///
/// @return The grapheme cluster bounds.
///
ImpellerRect ;
//------------------------------------------------------------------------------
/// @param[in] glyph_info The glyph information.
///
/// @return True if the glyph represents an ellipsis. False otherwise.
///
bool ;
//------------------------------------------------------------------------------
/// @param[in] glyph_info The glyph information.
///
/// @return The direction of the run that contains the glyph.
///
ImpellerTextDirection ;
// NOLINTEND(google-objc-function-naming)
// FLUTTER_IMPELLER_TOOLKIT_INTEROP_IMPELLER_H_