1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864
|
// Package render is the X client API for the RENDER extension.
package render
// This file is automatically generated from render.xml. Edit at your peril!
import (
"github.com/BurntSushi/xgb"
"github.com/BurntSushi/xgb/xproto"
)
// Init must be called before using the RENDER extension.
func Init(c *xgb.Conn) error {
reply, err := xproto.QueryExtension(c, 6, "RENDER").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return xgb.Errorf("No extension named RENDER could be found on on the server.")
}
xgb.ExtLock.Lock()
c.Extensions["RENDER"] = reply.MajorOpcode
for evNum, fun := range xgb.NewExtEventFuncs["RENDER"] {
xgb.NewEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
for errNum, fun := range xgb.NewExtErrorFuncs["RENDER"] {
xgb.NewErrorFuncs[int(reply.FirstError)+errNum] = fun
}
xgb.ExtLock.Unlock()
return nil
}
func init() {
xgb.NewExtEventFuncs["RENDER"] = make(map[int]xgb.NewEventFun)
xgb.NewExtErrorFuncs["RENDER"] = make(map[int]xgb.NewErrorFun)
}
type Animcursorelt struct {
Cursor xproto.Cursor
Delay uint32
}
// AnimcursoreltRead reads a byte slice into a Animcursorelt value.
func AnimcursoreltRead(buf []byte, v *Animcursorelt) int {
b := 0
v.Cursor = xproto.Cursor(xgb.Get32(buf[b:]))
b += 4
v.Delay = xgb.Get32(buf[b:])
b += 4
return b
}
// AnimcursoreltReadList reads a byte slice into a list of Animcursorelt values.
func AnimcursoreltReadList(buf []byte, dest []Animcursorelt) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Animcursorelt{}
b += AnimcursoreltRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Animcursorelt value to a byte slice.
func (v Animcursorelt) Bytes() []byte {
buf := make([]byte, 8)
b := 0
xgb.Put32(buf[b:], uint32(v.Cursor))
b += 4
xgb.Put32(buf[b:], v.Delay)
b += 4
return buf[:b]
}
// AnimcursoreltListBytes writes a list of Animcursorelt values to a byte slice.
func AnimcursoreltListBytes(buf []byte, list []Animcursorelt) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Color struct {
Red uint16
Green uint16
Blue uint16
Alpha uint16
}
// ColorRead reads a byte slice into a Color value.
func ColorRead(buf []byte, v *Color) int {
b := 0
v.Red = xgb.Get16(buf[b:])
b += 2
v.Green = xgb.Get16(buf[b:])
b += 2
v.Blue = xgb.Get16(buf[b:])
b += 2
v.Alpha = xgb.Get16(buf[b:])
b += 2
return b
}
// ColorReadList reads a byte slice into a list of Color values.
func ColorReadList(buf []byte, dest []Color) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Color{}
b += ColorRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Color value to a byte slice.
func (v Color) Bytes() []byte {
buf := make([]byte, 8)
b := 0
xgb.Put16(buf[b:], v.Red)
b += 2
xgb.Put16(buf[b:], v.Green)
b += 2
xgb.Put16(buf[b:], v.Blue)
b += 2
xgb.Put16(buf[b:], v.Alpha)
b += 2
return buf[:b]
}
// ColorListBytes writes a list of Color values to a byte slice.
func ColorListBytes(buf []byte, list []Color) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
const (
CpRepeat = 1
CpAlphaMap = 2
CpAlphaXOrigin = 4
CpAlphaYOrigin = 8
CpClipXOrigin = 16
CpClipYOrigin = 32
CpClipMask = 64
CpGraphicsExposure = 128
CpSubwindowMode = 256
CpPolyEdge = 512
CpPolyMode = 1024
CpDither = 2048
CpComponentAlpha = 4096
)
type Directformat struct {
RedShift uint16
RedMask uint16
GreenShift uint16
GreenMask uint16
BlueShift uint16
BlueMask uint16
AlphaShift uint16
AlphaMask uint16
}
// DirectformatRead reads a byte slice into a Directformat value.
func DirectformatRead(buf []byte, v *Directformat) int {
b := 0
v.RedShift = xgb.Get16(buf[b:])
b += 2
v.RedMask = xgb.Get16(buf[b:])
b += 2
v.GreenShift = xgb.Get16(buf[b:])
b += 2
v.GreenMask = xgb.Get16(buf[b:])
b += 2
v.BlueShift = xgb.Get16(buf[b:])
b += 2
v.BlueMask = xgb.Get16(buf[b:])
b += 2
v.AlphaShift = xgb.Get16(buf[b:])
b += 2
v.AlphaMask = xgb.Get16(buf[b:])
b += 2
return b
}
// DirectformatReadList reads a byte slice into a list of Directformat values.
func DirectformatReadList(buf []byte, dest []Directformat) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Directformat{}
b += DirectformatRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Directformat value to a byte slice.
func (v Directformat) Bytes() []byte {
buf := make([]byte, 16)
b := 0
xgb.Put16(buf[b:], v.RedShift)
b += 2
xgb.Put16(buf[b:], v.RedMask)
b += 2
xgb.Put16(buf[b:], v.GreenShift)
b += 2
xgb.Put16(buf[b:], v.GreenMask)
b += 2
xgb.Put16(buf[b:], v.BlueShift)
b += 2
xgb.Put16(buf[b:], v.BlueMask)
b += 2
xgb.Put16(buf[b:], v.AlphaShift)
b += 2
xgb.Put16(buf[b:], v.AlphaMask)
b += 2
return buf[:b]
}
// DirectformatListBytes writes a list of Directformat values to a byte slice.
func DirectformatListBytes(buf []byte, list []Directformat) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Fixed int32
type Glyph uint32
// BadGlyph is the error number for a BadGlyph.
const BadGlyph = 4
type GlyphError struct {
Sequence uint16
NiceName string
}
// GlyphErrorNew constructs a GlyphError value that implements xgb.Error from a byte slice.
func GlyphErrorNew(buf []byte) xgb.Error {
v := GlyphError{}
v.NiceName = "Glyph"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
return v
}
// SequenceId returns the sequence id attached to the BadGlyph error.
// This is mostly used internally.
func (err GlyphError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadGlyph error. If no bad value exists, 0 is returned.
func (err GlyphError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadGlyph error.
func (err GlyphError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
return "BadGlyph {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["RENDER"][4] = GlyphErrorNew
}
// BadGlyphSet is the error number for a BadGlyphSet.
const BadGlyphSet = 3
type GlyphSetError struct {
Sequence uint16
NiceName string
}
// GlyphSetErrorNew constructs a GlyphSetError value that implements xgb.Error from a byte slice.
func GlyphSetErrorNew(buf []byte) xgb.Error {
v := GlyphSetError{}
v.NiceName = "GlyphSet"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
return v
}
// SequenceId returns the sequence id attached to the BadGlyphSet error.
// This is mostly used internally.
func (err GlyphSetError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadGlyphSet error. If no bad value exists, 0 is returned.
func (err GlyphSetError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadGlyphSet error.
func (err GlyphSetError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
return "BadGlyphSet {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["RENDER"][3] = GlyphSetErrorNew
}
type Glyphinfo struct {
Width uint16
Height uint16
X int16
Y int16
XOff int16
YOff int16
}
// GlyphinfoRead reads a byte slice into a Glyphinfo value.
func GlyphinfoRead(buf []byte, v *Glyphinfo) int {
b := 0
v.Width = xgb.Get16(buf[b:])
b += 2
v.Height = xgb.Get16(buf[b:])
b += 2
v.X = int16(xgb.Get16(buf[b:]))
b += 2
v.Y = int16(xgb.Get16(buf[b:]))
b += 2
v.XOff = int16(xgb.Get16(buf[b:]))
b += 2
v.YOff = int16(xgb.Get16(buf[b:]))
b += 2
return b
}
// GlyphinfoReadList reads a byte slice into a list of Glyphinfo values.
func GlyphinfoReadList(buf []byte, dest []Glyphinfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Glyphinfo{}
b += GlyphinfoRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Glyphinfo value to a byte slice.
func (v Glyphinfo) Bytes() []byte {
buf := make([]byte, 12)
b := 0
xgb.Put16(buf[b:], v.Width)
b += 2
xgb.Put16(buf[b:], v.Height)
b += 2
xgb.Put16(buf[b:], uint16(v.X))
b += 2
xgb.Put16(buf[b:], uint16(v.Y))
b += 2
xgb.Put16(buf[b:], uint16(v.XOff))
b += 2
xgb.Put16(buf[b:], uint16(v.YOff))
b += 2
return buf[:b]
}
// GlyphinfoListBytes writes a list of Glyphinfo values to a byte slice.
func GlyphinfoListBytes(buf []byte, list []Glyphinfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Glyphset uint32
func NewGlyphsetId(c *xgb.Conn) (Glyphset, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Glyphset(id), nil
}
type Indexvalue struct {
Pixel uint32
Red uint16
Green uint16
Blue uint16
Alpha uint16
}
// IndexvalueRead reads a byte slice into a Indexvalue value.
func IndexvalueRead(buf []byte, v *Indexvalue) int {
b := 0
v.Pixel = xgb.Get32(buf[b:])
b += 4
v.Red = xgb.Get16(buf[b:])
b += 2
v.Green = xgb.Get16(buf[b:])
b += 2
v.Blue = xgb.Get16(buf[b:])
b += 2
v.Alpha = xgb.Get16(buf[b:])
b += 2
return b
}
// IndexvalueReadList reads a byte slice into a list of Indexvalue values.
func IndexvalueReadList(buf []byte, dest []Indexvalue) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Indexvalue{}
b += IndexvalueRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Indexvalue value to a byte slice.
func (v Indexvalue) Bytes() []byte {
buf := make([]byte, 12)
b := 0
xgb.Put32(buf[b:], v.Pixel)
b += 4
xgb.Put16(buf[b:], v.Red)
b += 2
xgb.Put16(buf[b:], v.Green)
b += 2
xgb.Put16(buf[b:], v.Blue)
b += 2
xgb.Put16(buf[b:], v.Alpha)
b += 2
return buf[:b]
}
// IndexvalueListBytes writes a list of Indexvalue values to a byte slice.
func IndexvalueListBytes(buf []byte, list []Indexvalue) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Linefix struct {
P1 Pointfix
P2 Pointfix
}
// LinefixRead reads a byte slice into a Linefix value.
func LinefixRead(buf []byte, v *Linefix) int {
b := 0
v.P1 = Pointfix{}
b += PointfixRead(buf[b:], &v.P1)
v.P2 = Pointfix{}
b += PointfixRead(buf[b:], &v.P2)
return b
}
// LinefixReadList reads a byte slice into a list of Linefix values.
func LinefixReadList(buf []byte, dest []Linefix) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Linefix{}
b += LinefixRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Linefix value to a byte slice.
func (v Linefix) Bytes() []byte {
buf := make([]byte, 16)
b := 0
{
structBytes := v.P1.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := v.P2.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return buf[:b]
}
// LinefixListBytes writes a list of Linefix values to a byte slice.
func LinefixListBytes(buf []byte, list []Linefix) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// BadPictFormat is the error number for a BadPictFormat.
const BadPictFormat = 0
type PictFormatError struct {
Sequence uint16
NiceName string
}
// PictFormatErrorNew constructs a PictFormatError value that implements xgb.Error from a byte slice.
func PictFormatErrorNew(buf []byte) xgb.Error {
v := PictFormatError{}
v.NiceName = "PictFormat"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
return v
}
// SequenceId returns the sequence id attached to the BadPictFormat error.
// This is mostly used internally.
func (err PictFormatError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadPictFormat error. If no bad value exists, 0 is returned.
func (err PictFormatError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadPictFormat error.
func (err PictFormatError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
return "BadPictFormat {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["RENDER"][0] = PictFormatErrorNew
}
// BadPictOp is the error number for a BadPictOp.
const BadPictOp = 2
type PictOpError struct {
Sequence uint16
NiceName string
}
// PictOpErrorNew constructs a PictOpError value that implements xgb.Error from a byte slice.
func PictOpErrorNew(buf []byte) xgb.Error {
v := PictOpError{}
v.NiceName = "PictOp"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
return v
}
// SequenceId returns the sequence id attached to the BadPictOp error.
// This is mostly used internally.
func (err PictOpError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadPictOp error. If no bad value exists, 0 is returned.
func (err PictOpError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadPictOp error.
func (err PictOpError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
return "BadPictOp {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["RENDER"][2] = PictOpErrorNew
}
const (
PictOpClear = 0
PictOpSrc = 1
PictOpDst = 2
PictOpOver = 3
PictOpOverReverse = 4
PictOpIn = 5
PictOpInReverse = 6
PictOpOut = 7
PictOpOutReverse = 8
PictOpAtop = 9
PictOpAtopReverse = 10
PictOpXor = 11
PictOpAdd = 12
PictOpSaturate = 13
PictOpDisjointClear = 16
PictOpDisjointSrc = 17
PictOpDisjointDst = 18
PictOpDisjointOver = 19
PictOpDisjointOverReverse = 20
PictOpDisjointIn = 21
PictOpDisjointInReverse = 22
PictOpDisjointOut = 23
PictOpDisjointOutReverse = 24
PictOpDisjointAtop = 25
PictOpDisjointAtopReverse = 26
PictOpDisjointXor = 27
PictOpConjointClear = 32
PictOpConjointSrc = 33
PictOpConjointDst = 34
PictOpConjointOver = 35
PictOpConjointOverReverse = 36
PictOpConjointIn = 37
PictOpConjointInReverse = 38
PictOpConjointOut = 39
PictOpConjointOutReverse = 40
PictOpConjointAtop = 41
PictOpConjointAtopReverse = 42
PictOpConjointXor = 43
PictOpMultiply = 48
PictOpScreen = 49
PictOpOverlay = 50
PictOpDarken = 51
PictOpLighten = 52
PictOpColorDodge = 53
PictOpColorBurn = 54
PictOpHardLight = 55
PictOpSoftLight = 56
PictOpDifference = 57
PictOpExclusion = 58
PictOpHSLHue = 59
PictOpHSLSaturation = 60
PictOpHSLColor = 61
PictOpHSLLuminosity = 62
)
const (
PictTypeIndexed = 0
PictTypeDirect = 1
)
type Pictdepth struct {
Depth byte
// padding: 1 bytes
NumVisuals uint16
// padding: 4 bytes
Visuals []Pictvisual // size: xgb.Pad((int(NumVisuals) * 8))
}
// PictdepthRead reads a byte slice into a Pictdepth value.
func PictdepthRead(buf []byte, v *Pictdepth) int {
b := 0
v.Depth = buf[b]
b += 1
b += 1 // padding
v.NumVisuals = xgb.Get16(buf[b:])
b += 2
b += 4 // padding
v.Visuals = make([]Pictvisual, v.NumVisuals)
b += PictvisualReadList(buf[b:], v.Visuals)
return b
}
// PictdepthReadList reads a byte slice into a list of Pictdepth values.
func PictdepthReadList(buf []byte, dest []Pictdepth) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Pictdepth{}
b += PictdepthRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Pictdepth value to a byte slice.
func (v Pictdepth) Bytes() []byte {
buf := make([]byte, (8 + xgb.Pad((int(v.NumVisuals) * 8))))
b := 0
buf[b] = v.Depth
b += 1
b += 1 // padding
xgb.Put16(buf[b:], v.NumVisuals)
b += 2
b += 4 // padding
b += PictvisualListBytes(buf[b:], v.Visuals)
return buf[:b]
}
// PictdepthListBytes writes a list of Pictdepth values to a byte slice.
func PictdepthListBytes(buf []byte, list []Pictdepth) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// PictdepthListSize computes the size (bytes) of a list of Pictdepth values.
func PictdepthListSize(list []Pictdepth) int {
size := 0
for _, item := range list {
size += (8 + xgb.Pad((int(item.NumVisuals) * 8)))
}
return size
}
type Pictformat uint32
func NewPictformatId(c *xgb.Conn) (Pictformat, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Pictformat(id), nil
}
type Pictforminfo struct {
Id Pictformat
Type byte
Depth byte
// padding: 2 bytes
Direct Directformat
Colormap xproto.Colormap
}
// PictforminfoRead reads a byte slice into a Pictforminfo value.
func PictforminfoRead(buf []byte, v *Pictforminfo) int {
b := 0
v.Id = Pictformat(xgb.Get32(buf[b:]))
b += 4
v.Type = buf[b]
b += 1
v.Depth = buf[b]
b += 1
b += 2 // padding
v.Direct = Directformat{}
b += DirectformatRead(buf[b:], &v.Direct)
v.Colormap = xproto.Colormap(xgb.Get32(buf[b:]))
b += 4
return b
}
// PictforminfoReadList reads a byte slice into a list of Pictforminfo values.
func PictforminfoReadList(buf []byte, dest []Pictforminfo) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Pictforminfo{}
b += PictforminfoRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Pictforminfo value to a byte slice.
func (v Pictforminfo) Bytes() []byte {
buf := make([]byte, 28)
b := 0
xgb.Put32(buf[b:], uint32(v.Id))
b += 4
buf[b] = v.Type
b += 1
buf[b] = v.Depth
b += 1
b += 2 // padding
{
structBytes := v.Direct.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
xgb.Put32(buf[b:], uint32(v.Colormap))
b += 4
return buf[:b]
}
// PictforminfoListBytes writes a list of Pictforminfo values to a byte slice.
func PictforminfoListBytes(buf []byte, list []Pictforminfo) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Pictscreen struct {
NumDepths uint32
Fallback Pictformat
Depths []Pictdepth // size: PictdepthListSize(Depths)
}
// PictscreenRead reads a byte slice into a Pictscreen value.
func PictscreenRead(buf []byte, v *Pictscreen) int {
b := 0
v.NumDepths = xgb.Get32(buf[b:])
b += 4
v.Fallback = Pictformat(xgb.Get32(buf[b:]))
b += 4
v.Depths = make([]Pictdepth, v.NumDepths)
b += PictdepthReadList(buf[b:], v.Depths)
return b
}
// PictscreenReadList reads a byte slice into a list of Pictscreen values.
func PictscreenReadList(buf []byte, dest []Pictscreen) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Pictscreen{}
b += PictscreenRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Pictscreen value to a byte slice.
func (v Pictscreen) Bytes() []byte {
buf := make([]byte, (8 + PictdepthListSize(v.Depths)))
b := 0
xgb.Put32(buf[b:], v.NumDepths)
b += 4
xgb.Put32(buf[b:], uint32(v.Fallback))
b += 4
b += PictdepthListBytes(buf[b:], v.Depths)
return buf[:b]
}
// PictscreenListBytes writes a list of Pictscreen values to a byte slice.
func PictscreenListBytes(buf []byte, list []Pictscreen) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// PictscreenListSize computes the size (bytes) of a list of Pictscreen values.
func PictscreenListSize(list []Pictscreen) int {
size := 0
for _, item := range list {
size += (8 + PictdepthListSize(item.Depths))
}
return size
}
type Picture uint32
func NewPictureId(c *xgb.Conn) (Picture, error) {
id, err := c.NewId()
if err != nil {
return 0, err
}
return Picture(id), nil
}
// BadPicture is the error number for a BadPicture.
const BadPicture = 1
type PictureError struct {
Sequence uint16
NiceName string
}
// PictureErrorNew constructs a PictureError value that implements xgb.Error from a byte slice.
func PictureErrorNew(buf []byte) xgb.Error {
v := PictureError{}
v.NiceName = "Picture"
b := 1 // skip error determinant
b += 1 // don't read error number
v.Sequence = xgb.Get16(buf[b:])
b += 2
return v
}
// SequenceId returns the sequence id attached to the BadPicture error.
// This is mostly used internally.
func (err PictureError) SequenceId() uint16 {
return err.Sequence
}
// BadId returns the 'BadValue' number if one exists for the BadPicture error. If no bad value exists, 0 is returned.
func (err PictureError) BadId() uint32 {
return 0
}
// Error returns a rudimentary string representation of the BadPicture error.
func (err PictureError) Error() string {
fieldVals := make([]string, 0, 0)
fieldVals = append(fieldVals, "NiceName: "+err.NiceName)
fieldVals = append(fieldVals, xgb.Sprintf("Sequence: %d", err.Sequence))
return "BadPicture {" + xgb.StringsJoin(fieldVals, ", ") + "}"
}
func init() {
xgb.NewExtErrorFuncs["RENDER"][1] = PictureErrorNew
}
const (
PictureNone = 0
)
type Pictvisual struct {
Visual xproto.Visualid
Format Pictformat
}
// PictvisualRead reads a byte slice into a Pictvisual value.
func PictvisualRead(buf []byte, v *Pictvisual) int {
b := 0
v.Visual = xproto.Visualid(xgb.Get32(buf[b:]))
b += 4
v.Format = Pictformat(xgb.Get32(buf[b:]))
b += 4
return b
}
// PictvisualReadList reads a byte slice into a list of Pictvisual values.
func PictvisualReadList(buf []byte, dest []Pictvisual) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Pictvisual{}
b += PictvisualRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Pictvisual value to a byte slice.
func (v Pictvisual) Bytes() []byte {
buf := make([]byte, 8)
b := 0
xgb.Put32(buf[b:], uint32(v.Visual))
b += 4
xgb.Put32(buf[b:], uint32(v.Format))
b += 4
return buf[:b]
}
// PictvisualListBytes writes a list of Pictvisual values to a byte slice.
func PictvisualListBytes(buf []byte, list []Pictvisual) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Pointfix struct {
X Fixed
Y Fixed
}
// PointfixRead reads a byte slice into a Pointfix value.
func PointfixRead(buf []byte, v *Pointfix) int {
b := 0
v.X = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Y = Fixed(xgb.Get32(buf[b:]))
b += 4
return b
}
// PointfixReadList reads a byte slice into a list of Pointfix values.
func PointfixReadList(buf []byte, dest []Pointfix) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Pointfix{}
b += PointfixRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Pointfix value to a byte slice.
func (v Pointfix) Bytes() []byte {
buf := make([]byte, 8)
b := 0
xgb.Put32(buf[b:], uint32(v.X))
b += 4
xgb.Put32(buf[b:], uint32(v.Y))
b += 4
return buf[:b]
}
// PointfixListBytes writes a list of Pointfix values to a byte slice.
func PointfixListBytes(buf []byte, list []Pointfix) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
const (
PolyEdgeSharp = 0
PolyEdgeSmooth = 1
)
const (
PolyModePrecise = 0
PolyModeImprecise = 1
)
const (
RepeatNone = 0
RepeatNormal = 1
RepeatPad = 2
RepeatReflect = 3
)
type Spanfix struct {
L Fixed
R Fixed
Y Fixed
}
// SpanfixRead reads a byte slice into a Spanfix value.
func SpanfixRead(buf []byte, v *Spanfix) int {
b := 0
v.L = Fixed(xgb.Get32(buf[b:]))
b += 4
v.R = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Y = Fixed(xgb.Get32(buf[b:]))
b += 4
return b
}
// SpanfixReadList reads a byte slice into a list of Spanfix values.
func SpanfixReadList(buf []byte, dest []Spanfix) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Spanfix{}
b += SpanfixRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Spanfix value to a byte slice.
func (v Spanfix) Bytes() []byte {
buf := make([]byte, 12)
b := 0
xgb.Put32(buf[b:], uint32(v.L))
b += 4
xgb.Put32(buf[b:], uint32(v.R))
b += 4
xgb.Put32(buf[b:], uint32(v.Y))
b += 4
return buf[:b]
}
// SpanfixListBytes writes a list of Spanfix values to a byte slice.
func SpanfixListBytes(buf []byte, list []Spanfix) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
const (
SubPixelUnknown = 0
SubPixelHorizontalRGB = 1
SubPixelHorizontalBGR = 2
SubPixelVerticalRGB = 3
SubPixelVerticalBGR = 4
SubPixelNone = 5
)
type Transform struct {
Matrix11 Fixed
Matrix12 Fixed
Matrix13 Fixed
Matrix21 Fixed
Matrix22 Fixed
Matrix23 Fixed
Matrix31 Fixed
Matrix32 Fixed
Matrix33 Fixed
}
// TransformRead reads a byte slice into a Transform value.
func TransformRead(buf []byte, v *Transform) int {
b := 0
v.Matrix11 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix12 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix13 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix21 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix22 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix23 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix31 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix32 = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Matrix33 = Fixed(xgb.Get32(buf[b:]))
b += 4
return b
}
// TransformReadList reads a byte slice into a list of Transform values.
func TransformReadList(buf []byte, dest []Transform) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Transform{}
b += TransformRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Transform value to a byte slice.
func (v Transform) Bytes() []byte {
buf := make([]byte, 36)
b := 0
xgb.Put32(buf[b:], uint32(v.Matrix11))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix12))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix13))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix21))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix22))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix23))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix31))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix32))
b += 4
xgb.Put32(buf[b:], uint32(v.Matrix33))
b += 4
return buf[:b]
}
// TransformListBytes writes a list of Transform values to a byte slice.
func TransformListBytes(buf []byte, list []Transform) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Trap struct {
Top Spanfix
Bot Spanfix
}
// TrapRead reads a byte slice into a Trap value.
func TrapRead(buf []byte, v *Trap) int {
b := 0
v.Top = Spanfix{}
b += SpanfixRead(buf[b:], &v.Top)
v.Bot = Spanfix{}
b += SpanfixRead(buf[b:], &v.Bot)
return b
}
// TrapReadList reads a byte slice into a list of Trap values.
func TrapReadList(buf []byte, dest []Trap) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Trap{}
b += TrapRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Trap value to a byte slice.
func (v Trap) Bytes() []byte {
buf := make([]byte, 24)
b := 0
{
structBytes := v.Top.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := v.Bot.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return buf[:b]
}
// TrapListBytes writes a list of Trap values to a byte slice.
func TrapListBytes(buf []byte, list []Trap) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Trapezoid struct {
Top Fixed
Bottom Fixed
Left Linefix
Right Linefix
}
// TrapezoidRead reads a byte slice into a Trapezoid value.
func TrapezoidRead(buf []byte, v *Trapezoid) int {
b := 0
v.Top = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Bottom = Fixed(xgb.Get32(buf[b:]))
b += 4
v.Left = Linefix{}
b += LinefixRead(buf[b:], &v.Left)
v.Right = Linefix{}
b += LinefixRead(buf[b:], &v.Right)
return b
}
// TrapezoidReadList reads a byte slice into a list of Trapezoid values.
func TrapezoidReadList(buf []byte, dest []Trapezoid) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Trapezoid{}
b += TrapezoidRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Trapezoid value to a byte slice.
func (v Trapezoid) Bytes() []byte {
buf := make([]byte, 40)
b := 0
xgb.Put32(buf[b:], uint32(v.Top))
b += 4
xgb.Put32(buf[b:], uint32(v.Bottom))
b += 4
{
structBytes := v.Left.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := v.Right.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return buf[:b]
}
// TrapezoidListBytes writes a list of Trapezoid values to a byte slice.
func TrapezoidListBytes(buf []byte, list []Trapezoid) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
type Triangle struct {
P1 Pointfix
P2 Pointfix
P3 Pointfix
}
// TriangleRead reads a byte slice into a Triangle value.
func TriangleRead(buf []byte, v *Triangle) int {
b := 0
v.P1 = Pointfix{}
b += PointfixRead(buf[b:], &v.P1)
v.P2 = Pointfix{}
b += PointfixRead(buf[b:], &v.P2)
v.P3 = Pointfix{}
b += PointfixRead(buf[b:], &v.P3)
return b
}
// TriangleReadList reads a byte slice into a list of Triangle values.
func TriangleReadList(buf []byte, dest []Triangle) int {
b := 0
for i := 0; i < len(dest); i++ {
dest[i] = Triangle{}
b += TriangleRead(buf[b:], &dest[i])
}
return xgb.Pad(b)
}
// Bytes writes a Triangle value to a byte slice.
func (v Triangle) Bytes() []byte {
buf := make([]byte, 24)
b := 0
{
structBytes := v.P1.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := v.P2.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := v.P3.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return buf[:b]
}
// TriangleListBytes writes a list of Triangle values to a byte slice.
func TriangleListBytes(buf []byte, list []Triangle) int {
b := 0
var structBytes []byte
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return xgb.Pad(b)
}
// Skipping definition for base type 'Bool'
// Skipping definition for base type 'Byte'
// Skipping definition for base type 'Card8'
// Skipping definition for base type 'Char'
// Skipping definition for base type 'Void'
// Skipping definition for base type 'Double'
// Skipping definition for base type 'Float'
// Skipping definition for base type 'Int16'
// Skipping definition for base type 'Int32'
// Skipping definition for base type 'Int8'
// Skipping definition for base type 'Card16'
// Skipping definition for base type 'Card32'
// AddGlyphsCookie is a cookie used only for AddGlyphs requests.
type AddGlyphsCookie struct {
*xgb.Cookie
}
// AddGlyphs sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func AddGlyphs(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie)
return AddGlyphsCookie{cookie}
}
// AddGlyphsChecked sends a checked request.
// If an error occurs, it can be retrieved using AddGlyphsCookie.Check()
func AddGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) AddGlyphsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'AddGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(addGlyphsRequest(c, Glyphset, GlyphsLen, Glyphids, Glyphs, Data), cookie)
return AddGlyphsCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook AddGlyphsCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for AddGlyphs
// addGlyphsRequest writes a AddGlyphs request to a byte slice.
func addGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, GlyphsLen uint32, Glyphids []uint32, Glyphs []Glyphinfo, Data []byte) []byte {
size := xgb.Pad(((((12 + xgb.Pad((int(GlyphsLen) * 4))) + 4) + xgb.Pad((int(GlyphsLen) * 12))) + xgb.Pad((len(Data) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 20 // request opcode
b += 1
blen := b
b += 2
xgb.Put32(buf[b:], uint32(Glyphset))
b += 4
xgb.Put32(buf[b:], GlyphsLen)
b += 4
for i := 0; i < int(GlyphsLen); i++ {
xgb.Put32(buf[b:], Glyphids[i])
b += 4
}
b = (b + 3) & ^3 // alignment gap
b += GlyphinfoListBytes(buf[b:], Glyphs)
copy(buf[b:], Data[:len(Data)])
b += int(len(Data))
b = xgb.Pad(b)
xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
return buf[:b]
}
// AddTrapsCookie is a cookie used only for AddTraps requests.
type AddTrapsCookie struct {
*xgb.Cookie
}
// AddTraps sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func AddTraps(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie)
return AddTrapsCookie{cookie}
}
// AddTrapsChecked sends a checked request.
// If an error occurs, it can be retrieved using AddTrapsCookie.Check()
func AddTrapsChecked(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) AddTrapsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'AddTraps' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(addTrapsRequest(c, Picture, XOff, YOff, Traps), cookie)
return AddTrapsCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook AddTrapsCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for AddTraps
// addTrapsRequest writes a AddTraps request to a byte slice.
func addTrapsRequest(c *xgb.Conn, Picture Picture, XOff int16, YOff int16, Traps []Trap) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Traps) * 24))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 32 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
xgb.Put16(buf[b:], uint16(XOff))
b += 2
xgb.Put16(buf[b:], uint16(YOff))
b += 2
b += TrapListBytes(buf[b:], Traps)
return buf
}
// ChangePictureCookie is a cookie used only for ChangePicture requests.
type ChangePictureCookie struct {
*xgb.Cookie
}
// ChangePicture sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ChangePicture(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie)
return ChangePictureCookie{cookie}
}
// ChangePictureChecked sends a checked request.
// If an error occurs, it can be retrieved using ChangePictureCookie.Check()
func ChangePictureChecked(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) ChangePictureCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'ChangePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(changePictureRequest(c, Picture, ValueMask, ValueList), cookie)
return ChangePictureCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook ChangePictureCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for ChangePicture
// changePictureRequest writes a ChangePicture request to a byte slice.
func changePictureRequest(c *xgb.Conn, Picture Picture, ValueMask uint32, ValueList []uint32) []byte {
size := xgb.Pad((8 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 5 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
xgb.Put32(buf[b:], ValueMask)
b += 4
for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
xgb.Put32(buf[b:], ValueList[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
// CompositeCookie is a cookie used only for Composite requests.
type CompositeCookie struct {
*xgb.Cookie
}
// Composite sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func Composite(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie)
return CompositeCookie{cookie}
}
// CompositeChecked sends a checked request.
// If an error occurs, it can be retrieved using CompositeCookie.Check()
func CompositeChecked(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) CompositeCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'Composite' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(compositeRequest(c, Op, Src, Mask, Dst, SrcX, SrcY, MaskX, MaskY, DstX, DstY, Width, Height), cookie)
return CompositeCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CompositeCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for Composite
// compositeRequest writes a Composite request to a byte slice.
func compositeRequest(c *xgb.Conn, Op byte, Src Picture, Mask Picture, Dst Picture, SrcX int16, SrcY int16, MaskX int16, MaskY int16, DstX int16, DstY int16, Width uint16, Height uint16) []byte {
size := 36
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 8 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Mask))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
xgb.Put16(buf[b:], uint16(MaskX))
b += 2
xgb.Put16(buf[b:], uint16(MaskY))
b += 2
xgb.Put16(buf[b:], uint16(DstX))
b += 2
xgb.Put16(buf[b:], uint16(DstY))
b += 2
xgb.Put16(buf[b:], Width)
b += 2
xgb.Put16(buf[b:], Height)
b += 2
return buf
}
// CompositeGlyphs16Cookie is a cookie used only for CompositeGlyphs16 requests.
type CompositeGlyphs16Cookie struct {
*xgb.Cookie
}
// CompositeGlyphs16 sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CompositeGlyphs16(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie)
return CompositeGlyphs16Cookie{cookie}
}
// CompositeGlyphs16Checked sends a checked request.
// If an error occurs, it can be retrieved using CompositeGlyphs16Cookie.Check()
func CompositeGlyphs16Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs16Cookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CompositeGlyphs16' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(compositeGlyphs16Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie)
return CompositeGlyphs16Cookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CompositeGlyphs16Cookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CompositeGlyphs16
// compositeGlyphs16Request writes a CompositeGlyphs16 request to a byte slice.
func compositeGlyphs16Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte {
size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 24 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put32(buf[b:], uint32(Glyphset))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
copy(buf[b:], Glyphcmds[:len(Glyphcmds)])
b += int(len(Glyphcmds))
return buf
}
// CompositeGlyphs32Cookie is a cookie used only for CompositeGlyphs32 requests.
type CompositeGlyphs32Cookie struct {
*xgb.Cookie
}
// CompositeGlyphs32 sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CompositeGlyphs32(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie)
return CompositeGlyphs32Cookie{cookie}
}
// CompositeGlyphs32Checked sends a checked request.
// If an error occurs, it can be retrieved using CompositeGlyphs32Cookie.Check()
func CompositeGlyphs32Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs32Cookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CompositeGlyphs32' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(compositeGlyphs32Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie)
return CompositeGlyphs32Cookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CompositeGlyphs32Cookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CompositeGlyphs32
// compositeGlyphs32Request writes a CompositeGlyphs32 request to a byte slice.
func compositeGlyphs32Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte {
size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 25 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put32(buf[b:], uint32(Glyphset))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
copy(buf[b:], Glyphcmds[:len(Glyphcmds)])
b += int(len(Glyphcmds))
return buf
}
// CompositeGlyphs8Cookie is a cookie used only for CompositeGlyphs8 requests.
type CompositeGlyphs8Cookie struct {
*xgb.Cookie
}
// CompositeGlyphs8 sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CompositeGlyphs8(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie)
return CompositeGlyphs8Cookie{cookie}
}
// CompositeGlyphs8Checked sends a checked request.
// If an error occurs, it can be retrieved using CompositeGlyphs8Cookie.Check()
func CompositeGlyphs8Checked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) CompositeGlyphs8Cookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CompositeGlyphs8' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(compositeGlyphs8Request(c, Op, Src, Dst, MaskFormat, Glyphset, SrcX, SrcY, Glyphcmds), cookie)
return CompositeGlyphs8Cookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CompositeGlyphs8Cookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CompositeGlyphs8
// compositeGlyphs8Request writes a CompositeGlyphs8 request to a byte slice.
func compositeGlyphs8Request(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, Glyphset Glyphset, SrcX int16, SrcY int16, Glyphcmds []byte) []byte {
size := xgb.Pad((28 + xgb.Pad((len(Glyphcmds) * 1))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 23 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put32(buf[b:], uint32(Glyphset))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
copy(buf[b:], Glyphcmds[:len(Glyphcmds)])
b += int(len(Glyphcmds))
return buf
}
// CreateAnimCursorCookie is a cookie used only for CreateAnimCursor requests.
type CreateAnimCursorCookie struct {
*xgb.Cookie
}
// CreateAnimCursor sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateAnimCursor(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie)
return CreateAnimCursorCookie{cookie}
}
// CreateAnimCursorChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateAnimCursorCookie.Check()
func CreateAnimCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) CreateAnimCursorCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateAnimCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createAnimCursorRequest(c, Cid, Cursors), cookie)
return CreateAnimCursorCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateAnimCursorCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateAnimCursor
// createAnimCursorRequest writes a CreateAnimCursor request to a byte slice.
func createAnimCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Cursors []Animcursorelt) []byte {
size := xgb.Pad((8 + xgb.Pad((len(Cursors) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 31 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Cid))
b += 4
b += AnimcursoreltListBytes(buf[b:], Cursors)
return buf
}
// CreateConicalGradientCookie is a cookie used only for CreateConicalGradient requests.
type CreateConicalGradientCookie struct {
*xgb.Cookie
}
// CreateConicalGradient sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateConicalGradient(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie)
return CreateConicalGradientCookie{cookie}
}
// CreateConicalGradientChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateConicalGradientCookie.Check()
func CreateConicalGradientChecked(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateConicalGradientCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateConicalGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createConicalGradientRequest(c, Picture, Center, Angle, NumStops, Stops, Colors), cookie)
return CreateConicalGradientCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateConicalGradientCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateConicalGradient
// createConicalGradientRequest writes a CreateConicalGradient request to a byte slice.
func createConicalGradientRequest(c *xgb.Conn, Picture Picture, Center Pointfix, Angle Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte {
size := xgb.Pad((((24 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 36 // request opcode
b += 1
blen := b
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
{
structBytes := Center.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
xgb.Put32(buf[b:], uint32(Angle))
b += 4
xgb.Put32(buf[b:], NumStops)
b += 4
for i := 0; i < int(NumStops); i++ {
xgb.Put32(buf[b:], uint32(Stops[i]))
b += 4
}
b = (b + 3) & ^3 // alignment gap
b += ColorListBytes(buf[b:], Colors)
b = xgb.Pad(b)
xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
return buf[:b]
}
// CreateCursorCookie is a cookie used only for CreateCursor requests.
type CreateCursorCookie struct {
*xgb.Cookie
}
// CreateCursor sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateCursor(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie)
return CreateCursorCookie{cookie}
}
// CreateCursorChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateCursorCookie.Check()
func CreateCursorChecked(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) CreateCursorCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateCursor' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createCursorRequest(c, Cid, Source, X, Y), cookie)
return CreateCursorCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateCursorCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateCursor
// createCursorRequest writes a CreateCursor request to a byte slice.
func createCursorRequest(c *xgb.Conn, Cid xproto.Cursor, Source Picture, X uint16, Y uint16) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 27 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Cid))
b += 4
xgb.Put32(buf[b:], uint32(Source))
b += 4
xgb.Put16(buf[b:], X)
b += 2
xgb.Put16(buf[b:], Y)
b += 2
return buf
}
// CreateGlyphSetCookie is a cookie used only for CreateGlyphSet requests.
type CreateGlyphSetCookie struct {
*xgb.Cookie
}
// CreateGlyphSet sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateGlyphSet(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie)
return CreateGlyphSetCookie{cookie}
}
// CreateGlyphSetChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateGlyphSetCookie.Check()
func CreateGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Format Pictformat) CreateGlyphSetCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createGlyphSetRequest(c, Gsid, Format), cookie)
return CreateGlyphSetCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateGlyphSetCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateGlyphSet
// createGlyphSetRequest writes a CreateGlyphSet request to a byte slice.
func createGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Format Pictformat) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 17 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Gsid))
b += 4
xgb.Put32(buf[b:], uint32(Format))
b += 4
return buf
}
// CreateLinearGradientCookie is a cookie used only for CreateLinearGradient requests.
type CreateLinearGradientCookie struct {
*xgb.Cookie
}
// CreateLinearGradient sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateLinearGradient(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie)
return CreateLinearGradientCookie{cookie}
}
// CreateLinearGradientChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateLinearGradientCookie.Check()
func CreateLinearGradientChecked(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) CreateLinearGradientCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateLinearGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createLinearGradientRequest(c, Picture, P1, P2, NumStops, Stops, Colors), cookie)
return CreateLinearGradientCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateLinearGradientCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateLinearGradient
// createLinearGradientRequest writes a CreateLinearGradient request to a byte slice.
func createLinearGradientRequest(c *xgb.Conn, Picture Picture, P1 Pointfix, P2 Pointfix, NumStops uint32, Stops []Fixed, Colors []Color) []byte {
size := xgb.Pad((((28 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 34 // request opcode
b += 1
blen := b
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
{
structBytes := P1.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := P2.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
xgb.Put32(buf[b:], NumStops)
b += 4
for i := 0; i < int(NumStops); i++ {
xgb.Put32(buf[b:], uint32(Stops[i]))
b += 4
}
b = (b + 3) & ^3 // alignment gap
b += ColorListBytes(buf[b:], Colors)
b = xgb.Pad(b)
xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
return buf[:b]
}
// CreatePictureCookie is a cookie used only for CreatePicture requests.
type CreatePictureCookie struct {
*xgb.Cookie
}
// CreatePicture sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreatePicture(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie)
return CreatePictureCookie{cookie}
}
// CreatePictureChecked sends a checked request.
// If an error occurs, it can be retrieved using CreatePictureCookie.Check()
func CreatePictureChecked(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) CreatePictureCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreatePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createPictureRequest(c, Pid, Drawable, Format, ValueMask, ValueList), cookie)
return CreatePictureCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreatePictureCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreatePicture
// createPictureRequest writes a CreatePicture request to a byte slice.
func createPictureRequest(c *xgb.Conn, Pid Picture, Drawable xproto.Drawable, Format Pictformat, ValueMask uint32, ValueList []uint32) []byte {
size := xgb.Pad((16 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 4 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Pid))
b += 4
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
xgb.Put32(buf[b:], uint32(Format))
b += 4
xgb.Put32(buf[b:], ValueMask)
b += 4
for i := 0; i < xgb.PopCount(int(ValueMask)); i++ {
xgb.Put32(buf[b:], ValueList[i])
b += 4
}
b = xgb.Pad(b)
return buf
}
// CreateRadialGradientCookie is a cookie used only for CreateRadialGradient requests.
type CreateRadialGradientCookie struct {
*xgb.Cookie
}
// CreateRadialGradient sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateRadialGradient(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie)
return CreateRadialGradientCookie{cookie}
}
// CreateRadialGradientChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateRadialGradientCookie.Check()
func CreateRadialGradientChecked(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) CreateRadialGradientCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateRadialGradient' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createRadialGradientRequest(c, Picture, Inner, Outer, InnerRadius, OuterRadius, NumStops, Stops, Colors), cookie)
return CreateRadialGradientCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateRadialGradientCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateRadialGradient
// createRadialGradientRequest writes a CreateRadialGradient request to a byte slice.
func createRadialGradientRequest(c *xgb.Conn, Picture Picture, Inner Pointfix, Outer Pointfix, InnerRadius Fixed, OuterRadius Fixed, NumStops uint32, Stops []Fixed, Colors []Color) []byte {
size := xgb.Pad((((36 + xgb.Pad((int(NumStops) * 4))) + 4) + xgb.Pad((int(NumStops) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 35 // request opcode
b += 1
blen := b
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
{
structBytes := Inner.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
{
structBytes := Outer.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
xgb.Put32(buf[b:], uint32(InnerRadius))
b += 4
xgb.Put32(buf[b:], uint32(OuterRadius))
b += 4
xgb.Put32(buf[b:], NumStops)
b += 4
for i := 0; i < int(NumStops); i++ {
xgb.Put32(buf[b:], uint32(Stops[i]))
b += 4
}
b = (b + 3) & ^3 // alignment gap
b += ColorListBytes(buf[b:], Colors)
b = xgb.Pad(b)
xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
return buf[:b]
}
// CreateSolidFillCookie is a cookie used only for CreateSolidFill requests.
type CreateSolidFillCookie struct {
*xgb.Cookie
}
// CreateSolidFill sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func CreateSolidFill(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie)
return CreateSolidFillCookie{cookie}
}
// CreateSolidFillChecked sends a checked request.
// If an error occurs, it can be retrieved using CreateSolidFillCookie.Check()
func CreateSolidFillChecked(c *xgb.Conn, Picture Picture, Color Color) CreateSolidFillCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'CreateSolidFill' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(createSolidFillRequest(c, Picture, Color), cookie)
return CreateSolidFillCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook CreateSolidFillCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for CreateSolidFill
// createSolidFillRequest writes a CreateSolidFill request to a byte slice.
func createSolidFillRequest(c *xgb.Conn, Picture Picture, Color Color) []byte {
size := 16
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 33 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
{
structBytes := Color.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return buf
}
// FillRectanglesCookie is a cookie used only for FillRectangles requests.
type FillRectanglesCookie struct {
*xgb.Cookie
}
// FillRectangles sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FillRectangles(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie)
return FillRectanglesCookie{cookie}
}
// FillRectanglesChecked sends a checked request.
// If an error occurs, it can be retrieved using FillRectanglesCookie.Check()
func FillRectanglesChecked(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) FillRectanglesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FillRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(fillRectanglesRequest(c, Op, Dst, Color, Rects), cookie)
return FillRectanglesCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook FillRectanglesCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for FillRectangles
// fillRectanglesRequest writes a FillRectangles request to a byte slice.
func fillRectanglesRequest(c *xgb.Conn, Op byte, Dst Picture, Color Color, Rects []xproto.Rectangle) []byte {
size := xgb.Pad((20 + xgb.Pad((len(Rects) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 26 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Dst))
b += 4
{
structBytes := Color.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
b += xproto.RectangleListBytes(buf[b:], Rects)
return buf
}
// FreeGlyphSetCookie is a cookie used only for FreeGlyphSet requests.
type FreeGlyphSetCookie struct {
*xgb.Cookie
}
// FreeGlyphSet sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FreeGlyphSet(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie)
return FreeGlyphSetCookie{cookie}
}
// FreeGlyphSetChecked sends a checked request.
// If an error occurs, it can be retrieved using FreeGlyphSetCookie.Check()
func FreeGlyphSetChecked(c *xgb.Conn, Glyphset Glyphset) FreeGlyphSetCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FreeGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(freeGlyphSetRequest(c, Glyphset), cookie)
return FreeGlyphSetCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook FreeGlyphSetCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for FreeGlyphSet
// freeGlyphSetRequest writes a FreeGlyphSet request to a byte slice.
func freeGlyphSetRequest(c *xgb.Conn, Glyphset Glyphset) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 19 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Glyphset))
b += 4
return buf
}
// FreeGlyphsCookie is a cookie used only for FreeGlyphs requests.
type FreeGlyphsCookie struct {
*xgb.Cookie
}
// FreeGlyphs sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FreeGlyphs(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie)
return FreeGlyphsCookie{cookie}
}
// FreeGlyphsChecked sends a checked request.
// If an error occurs, it can be retrieved using FreeGlyphsCookie.Check()
func FreeGlyphsChecked(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) FreeGlyphsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FreeGlyphs' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(freeGlyphsRequest(c, Glyphset, Glyphs), cookie)
return FreeGlyphsCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook FreeGlyphsCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for FreeGlyphs
// freeGlyphsRequest writes a FreeGlyphs request to a byte slice.
func freeGlyphsRequest(c *xgb.Conn, Glyphset Glyphset, Glyphs []Glyph) []byte {
size := xgb.Pad((8 + xgb.Pad((len(Glyphs) * 4))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 22 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Glyphset))
b += 4
for i := 0; i < int(len(Glyphs)); i++ {
xgb.Put32(buf[b:], uint32(Glyphs[i]))
b += 4
}
return buf
}
// FreePictureCookie is a cookie used only for FreePicture requests.
type FreePictureCookie struct {
*xgb.Cookie
}
// FreePicture sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func FreePicture(c *xgb.Conn, Picture Picture) FreePictureCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(freePictureRequest(c, Picture), cookie)
return FreePictureCookie{cookie}
}
// FreePictureChecked sends a checked request.
// If an error occurs, it can be retrieved using FreePictureCookie.Check()
func FreePictureChecked(c *xgb.Conn, Picture Picture) FreePictureCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'FreePicture' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(freePictureRequest(c, Picture), cookie)
return FreePictureCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook FreePictureCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for FreePicture
// freePictureRequest writes a FreePicture request to a byte slice.
func freePictureRequest(c *xgb.Conn, Picture Picture) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 7 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
return buf
}
// QueryFiltersCookie is a cookie used only for QueryFilters requests.
type QueryFiltersCookie struct {
*xgb.Cookie
}
// QueryFilters sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryFiltersCookie.Reply()
func QueryFilters(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryFiltersRequest(c, Drawable), cookie)
return QueryFiltersCookie{cookie}
}
// QueryFiltersUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryFiltersUnchecked(c *xgb.Conn, Drawable xproto.Drawable) QueryFiltersCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryFilters' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryFiltersRequest(c, Drawable), cookie)
return QueryFiltersCookie{cookie}
}
// QueryFiltersReply represents the data returned from a QueryFilters request.
type QueryFiltersReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumAliases uint32
NumFilters uint32
// padding: 16 bytes
Aliases []uint16 // size: xgb.Pad((int(NumAliases) * 2))
Filters []xproto.Str // size: xproto.StrListSize(Filters)
}
// Reply blocks and returns the reply data for a QueryFilters request.
func (cook QueryFiltersCookie) Reply() (*QueryFiltersReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryFiltersReply(buf), nil
}
// queryFiltersReply reads a byte slice into a QueryFiltersReply value.
func queryFiltersReply(buf []byte) *QueryFiltersReply {
v := new(QueryFiltersReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.NumAliases = xgb.Get32(buf[b:])
b += 4
v.NumFilters = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
v.Aliases = make([]uint16, v.NumAliases)
for i := 0; i < int(v.NumAliases); i++ {
v.Aliases[i] = xgb.Get16(buf[b:])
b += 2
}
v.Filters = make([]xproto.Str, v.NumFilters)
b += xproto.StrReadList(buf[b:], v.Filters)
return v
}
// Write request to wire for QueryFilters
// queryFiltersRequest writes a QueryFilters request to a byte slice.
func queryFiltersRequest(c *xgb.Conn, Drawable xproto.Drawable) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 29 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Drawable))
b += 4
return buf
}
// QueryPictFormatsCookie is a cookie used only for QueryPictFormats requests.
type QueryPictFormatsCookie struct {
*xgb.Cookie
}
// QueryPictFormats sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryPictFormatsCookie.Reply()
func QueryPictFormats(c *xgb.Conn) QueryPictFormatsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryPictFormatsRequest(c), cookie)
return QueryPictFormatsCookie{cookie}
}
// QueryPictFormatsUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryPictFormatsUnchecked(c *xgb.Conn) QueryPictFormatsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryPictFormats' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryPictFormatsRequest(c), cookie)
return QueryPictFormatsCookie{cookie}
}
// QueryPictFormatsReply represents the data returned from a QueryPictFormats request.
type QueryPictFormatsReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumFormats uint32
NumScreens uint32
NumDepths uint32
NumVisuals uint32
NumSubpixel uint32
// padding: 4 bytes
Formats []Pictforminfo // size: xgb.Pad((int(NumFormats) * 28))
// alignment gap to multiple of 4
Screens []Pictscreen // size: PictscreenListSize(Screens)
// alignment gap to multiple of 4
Subpixels []uint32 // size: xgb.Pad((int(NumSubpixel) * 4))
}
// Reply blocks and returns the reply data for a QueryPictFormats request.
func (cook QueryPictFormatsCookie) Reply() (*QueryPictFormatsReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryPictFormatsReply(buf), nil
}
// queryPictFormatsReply reads a byte slice into a QueryPictFormatsReply value.
func queryPictFormatsReply(buf []byte) *QueryPictFormatsReply {
v := new(QueryPictFormatsReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.NumFormats = xgb.Get32(buf[b:])
b += 4
v.NumScreens = xgb.Get32(buf[b:])
b += 4
v.NumDepths = xgb.Get32(buf[b:])
b += 4
v.NumVisuals = xgb.Get32(buf[b:])
b += 4
v.NumSubpixel = xgb.Get32(buf[b:])
b += 4
b += 4 // padding
v.Formats = make([]Pictforminfo, v.NumFormats)
b += PictforminfoReadList(buf[b:], v.Formats)
b = (b + 3) & ^3 // alignment gap
v.Screens = make([]Pictscreen, v.NumScreens)
b += PictscreenReadList(buf[b:], v.Screens)
b = (b + 3) & ^3 // alignment gap
v.Subpixels = make([]uint32, v.NumSubpixel)
for i := 0; i < int(v.NumSubpixel); i++ {
v.Subpixels[i] = xgb.Get32(buf[b:])
b += 4
}
return v
}
// Write request to wire for QueryPictFormats
// queryPictFormatsRequest writes a QueryPictFormats request to a byte slice.
func queryPictFormatsRequest(c *xgb.Conn) []byte {
size := 4
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 1 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
return buf
}
// QueryPictIndexValuesCookie is a cookie used only for QueryPictIndexValues requests.
type QueryPictIndexValuesCookie struct {
*xgb.Cookie
}
// QueryPictIndexValues sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryPictIndexValuesCookie.Reply()
func QueryPictIndexValues(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie)
return QueryPictIndexValuesCookie{cookie}
}
// QueryPictIndexValuesUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryPictIndexValuesUnchecked(c *xgb.Conn, Format Pictformat) QueryPictIndexValuesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryPictIndexValues' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryPictIndexValuesRequest(c, Format), cookie)
return QueryPictIndexValuesCookie{cookie}
}
// QueryPictIndexValuesReply represents the data returned from a QueryPictIndexValues request.
type QueryPictIndexValuesReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
NumValues uint32
// padding: 20 bytes
Values []Indexvalue // size: xgb.Pad((int(NumValues) * 12))
}
// Reply blocks and returns the reply data for a QueryPictIndexValues request.
func (cook QueryPictIndexValuesCookie) Reply() (*QueryPictIndexValuesReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryPictIndexValuesReply(buf), nil
}
// queryPictIndexValuesReply reads a byte slice into a QueryPictIndexValuesReply value.
func queryPictIndexValuesReply(buf []byte) *QueryPictIndexValuesReply {
v := new(QueryPictIndexValuesReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.NumValues = xgb.Get32(buf[b:])
b += 4
b += 20 // padding
v.Values = make([]Indexvalue, v.NumValues)
b += IndexvalueReadList(buf[b:], v.Values)
return v
}
// Write request to wire for QueryPictIndexValues
// queryPictIndexValuesRequest writes a QueryPictIndexValues request to a byte slice.
func queryPictIndexValuesRequest(c *xgb.Conn, Format Pictformat) []byte {
size := 8
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 2 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Format))
b += 4
return buf
}
// QueryVersionCookie is a cookie used only for QueryVersion requests.
type QueryVersionCookie struct {
*xgb.Cookie
}
// QueryVersion sends a checked request.
// If an error occurs, it will be returned with the reply by calling QueryVersionCookie.Reply()
func QueryVersion(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, true)
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
return QueryVersionCookie{cookie}
}
// QueryVersionUnchecked sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func QueryVersionUnchecked(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) QueryVersionCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'QueryVersion' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, true)
c.NewRequest(queryVersionRequest(c, ClientMajorVersion, ClientMinorVersion), cookie)
return QueryVersionCookie{cookie}
}
// QueryVersionReply represents the data returned from a QueryVersion request.
type QueryVersionReply struct {
Sequence uint16 // sequence number of the request for this reply
Length uint32 // number of bytes in this reply
// padding: 1 bytes
MajorVersion uint32
MinorVersion uint32
// padding: 16 bytes
}
// Reply blocks and returns the reply data for a QueryVersion request.
func (cook QueryVersionCookie) Reply() (*QueryVersionReply, error) {
buf, err := cook.Cookie.Reply()
if err != nil {
return nil, err
}
if buf == nil {
return nil, nil
}
return queryVersionReply(buf), nil
}
// queryVersionReply reads a byte slice into a QueryVersionReply value.
func queryVersionReply(buf []byte) *QueryVersionReply {
v := new(QueryVersionReply)
b := 1 // skip reply determinant
b += 1 // padding
v.Sequence = xgb.Get16(buf[b:])
b += 2
v.Length = xgb.Get32(buf[b:]) // 4-byte units
b += 4
v.MajorVersion = xgb.Get32(buf[b:])
b += 4
v.MinorVersion = xgb.Get32(buf[b:])
b += 4
b += 16 // padding
return v
}
// Write request to wire for QueryVersion
// queryVersionRequest writes a QueryVersion request to a byte slice.
func queryVersionRequest(c *xgb.Conn, ClientMajorVersion uint32, ClientMinorVersion uint32) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 0 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], ClientMajorVersion)
b += 4
xgb.Put32(buf[b:], ClientMinorVersion)
b += 4
return buf
}
// ReferenceGlyphSetCookie is a cookie used only for ReferenceGlyphSet requests.
type ReferenceGlyphSetCookie struct {
*xgb.Cookie
}
// ReferenceGlyphSet sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func ReferenceGlyphSet(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie)
return ReferenceGlyphSetCookie{cookie}
}
// ReferenceGlyphSetChecked sends a checked request.
// If an error occurs, it can be retrieved using ReferenceGlyphSetCookie.Check()
func ReferenceGlyphSetChecked(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) ReferenceGlyphSetCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'ReferenceGlyphSet' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(referenceGlyphSetRequest(c, Gsid, Existing), cookie)
return ReferenceGlyphSetCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook ReferenceGlyphSetCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for ReferenceGlyphSet
// referenceGlyphSetRequest writes a ReferenceGlyphSet request to a byte slice.
func referenceGlyphSetRequest(c *xgb.Conn, Gsid Glyphset, Existing Glyphset) []byte {
size := 12
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 18 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Gsid))
b += 4
xgb.Put32(buf[b:], uint32(Existing))
b += 4
return buf
}
// SetPictureClipRectanglesCookie is a cookie used only for SetPictureClipRectangles requests.
type SetPictureClipRectanglesCookie struct {
*xgb.Cookie
}
// SetPictureClipRectangles sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetPictureClipRectangles(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie)
return SetPictureClipRectanglesCookie{cookie}
}
// SetPictureClipRectanglesChecked sends a checked request.
// If an error occurs, it can be retrieved using SetPictureClipRectanglesCookie.Check()
func SetPictureClipRectanglesChecked(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) SetPictureClipRectanglesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'SetPictureClipRectangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(setPictureClipRectanglesRequest(c, Picture, ClipXOrigin, ClipYOrigin, Rectangles), cookie)
return SetPictureClipRectanglesCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetPictureClipRectanglesCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SetPictureClipRectangles
// setPictureClipRectanglesRequest writes a SetPictureClipRectangles request to a byte slice.
func setPictureClipRectanglesRequest(c *xgb.Conn, Picture Picture, ClipXOrigin int16, ClipYOrigin int16, Rectangles []xproto.Rectangle) []byte {
size := xgb.Pad((12 + xgb.Pad((len(Rectangles) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 6 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
xgb.Put16(buf[b:], uint16(ClipXOrigin))
b += 2
xgb.Put16(buf[b:], uint16(ClipYOrigin))
b += 2
b += xproto.RectangleListBytes(buf[b:], Rectangles)
return buf
}
// SetPictureFilterCookie is a cookie used only for SetPictureFilter requests.
type SetPictureFilterCookie struct {
*xgb.Cookie
}
// SetPictureFilter sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetPictureFilter(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie)
return SetPictureFilterCookie{cookie}
}
// SetPictureFilterChecked sends a checked request.
// If an error occurs, it can be retrieved using SetPictureFilterCookie.Check()
func SetPictureFilterChecked(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) SetPictureFilterCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'SetPictureFilter' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(setPictureFilterRequest(c, Picture, FilterLen, Filter, Values), cookie)
return SetPictureFilterCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetPictureFilterCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SetPictureFilter
// setPictureFilterRequest writes a SetPictureFilter request to a byte slice.
func setPictureFilterRequest(c *xgb.Conn, Picture Picture, FilterLen uint16, Filter string, Values []Fixed) []byte {
size := xgb.Pad((((12 + xgb.Pad((int(FilterLen) * 1))) + 4) + xgb.Pad((len(Values) * 4))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 30 // request opcode
b += 1
blen := b
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
xgb.Put16(buf[b:], FilterLen)
b += 2
b += 2 // padding
copy(buf[b:], Filter[:FilterLen])
b += int(FilterLen)
b = (b + 3) & ^3 // alignment gap
for i := 0; i < int(len(Values)); i++ {
xgb.Put32(buf[b:], uint32(Values[i]))
b += 4
}
b = xgb.Pad(b)
xgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units
return buf[:b]
}
// SetPictureTransformCookie is a cookie used only for SetPictureTransform requests.
type SetPictureTransformCookie struct {
*xgb.Cookie
}
// SetPictureTransform sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func SetPictureTransform(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie)
return SetPictureTransformCookie{cookie}
}
// SetPictureTransformChecked sends a checked request.
// If an error occurs, it can be retrieved using SetPictureTransformCookie.Check()
func SetPictureTransformChecked(c *xgb.Conn, Picture Picture, Transform Transform) SetPictureTransformCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'SetPictureTransform' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(setPictureTransformRequest(c, Picture, Transform), cookie)
return SetPictureTransformCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook SetPictureTransformCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for SetPictureTransform
// setPictureTransformRequest writes a SetPictureTransform request to a byte slice.
func setPictureTransformRequest(c *xgb.Conn, Picture Picture, Transform Transform) []byte {
size := 44
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 28 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
xgb.Put32(buf[b:], uint32(Picture))
b += 4
{
structBytes := Transform.Bytes()
copy(buf[b:], structBytes)
b += len(structBytes)
}
return buf
}
// TrapezoidsCookie is a cookie used only for Trapezoids requests.
type TrapezoidsCookie struct {
*xgb.Cookie
}
// Trapezoids sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func Trapezoids(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie)
return TrapezoidsCookie{cookie}
}
// TrapezoidsChecked sends a checked request.
// If an error occurs, it can be retrieved using TrapezoidsCookie.Check()
func TrapezoidsChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) TrapezoidsCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'Trapezoids' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(trapezoidsRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Traps), cookie)
return TrapezoidsCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook TrapezoidsCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for Trapezoids
// trapezoidsRequest writes a Trapezoids request to a byte slice.
func trapezoidsRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Traps []Trapezoid) []byte {
size := xgb.Pad((24 + xgb.Pad((len(Traps) * 40))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 10 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
b += TrapezoidListBytes(buf[b:], Traps)
return buf
}
// TriFanCookie is a cookie used only for TriFan requests.
type TriFanCookie struct {
*xgb.Cookie
}
// TriFan sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func TriFan(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie)
return TriFanCookie{cookie}
}
// TriFanChecked sends a checked request.
// If an error occurs, it can be retrieved using TriFanCookie.Check()
func TriFanChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriFanCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'TriFan' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(triFanRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie)
return TriFanCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook TriFanCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for TriFan
// triFanRequest writes a TriFan request to a byte slice.
func triFanRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte {
size := xgb.Pad((24 + xgb.Pad((len(Points) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 13 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
b += PointfixListBytes(buf[b:], Points)
return buf
}
// TriStripCookie is a cookie used only for TriStrip requests.
type TriStripCookie struct {
*xgb.Cookie
}
// TriStrip sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func TriStrip(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie)
return TriStripCookie{cookie}
}
// TriStripChecked sends a checked request.
// If an error occurs, it can be retrieved using TriStripCookie.Check()
func TriStripChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) TriStripCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'TriStrip' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(triStripRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Points), cookie)
return TriStripCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook TriStripCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for TriStrip
// triStripRequest writes a TriStrip request to a byte slice.
func triStripRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Points []Pointfix) []byte {
size := xgb.Pad((24 + xgb.Pad((len(Points) * 8))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 12 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
b += PointfixListBytes(buf[b:], Points)
return buf
}
// TrianglesCookie is a cookie used only for Triangles requests.
type TrianglesCookie struct {
*xgb.Cookie
}
// Triangles sends an unchecked request.
// If an error occurs, it can only be retrieved using xgb.WaitForEvent or xgb.PollForEvent.
func Triangles(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(false, false)
c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie)
return TrianglesCookie{cookie}
}
// TrianglesChecked sends a checked request.
// If an error occurs, it can be retrieved using TrianglesCookie.Check()
func TrianglesChecked(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) TrianglesCookie {
if _, ok := c.Extensions["RENDER"]; !ok {
panic("Cannot issue request 'Triangles' using the uninitialized extension 'RENDER'. render.Init(connObj) must be called first.")
}
cookie := c.NewCookie(true, false)
c.NewRequest(trianglesRequest(c, Op, Src, Dst, MaskFormat, SrcX, SrcY, Triangles), cookie)
return TrianglesCookie{cookie}
}
// Check returns an error if one occurred for checked requests that are not expecting a reply.
// This cannot be called for requests expecting a reply, nor for unchecked requests.
func (cook TrianglesCookie) Check() error {
return cook.Cookie.Check()
}
// Write request to wire for Triangles
// trianglesRequest writes a Triangles request to a byte slice.
func trianglesRequest(c *xgb.Conn, Op byte, Src Picture, Dst Picture, MaskFormat Pictformat, SrcX int16, SrcY int16, Triangles []Triangle) []byte {
size := xgb.Pad((24 + xgb.Pad((len(Triangles) * 24))))
b := 0
buf := make([]byte, size)
buf[b] = c.Extensions["RENDER"]
b += 1
buf[b] = 11 // request opcode
b += 1
xgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units
b += 2
buf[b] = Op
b += 1
b += 3 // padding
xgb.Put32(buf[b:], uint32(Src))
b += 4
xgb.Put32(buf[b:], uint32(Dst))
b += 4
xgb.Put32(buf[b:], uint32(MaskFormat))
b += 4
xgb.Put16(buf[b:], uint16(SrcX))
b += 2
xgb.Put16(buf[b:], uint16(SrcY))
b += 2
b += TriangleListBytes(buf[b:], Triangles)
return buf
}
|