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
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 / Imagick |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar |
| ImageMagick (c) ImageMagick Studio LLC |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Mikko Kopppanen <mkoppanen@php.net> |
| Scott MacVicar <scottmac@php.net> |
+----------------------------------------------------------------------+
*/
#include "php_imagick.h"
#include "php_imagick_defs.h"
#include "php_imagick_macros.h"
#include "php_imagick_helpers.h"
#if MagickLibVersion > 0x628
/* {{{ proto bool ImagickDraw::resetvectorgraphics()
Resets the vector graphics
*/
PHP_METHOD(imagickdraw, resetvectorgraphics)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawResetVectorGraphics(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x649
/* {{{ proto bool ImagickDraw::getTextKerning()
Gets the text kerning
*/
PHP_METHOD(imagickdraw, gettextkerning)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
RETURN_DOUBLE(DrawGetTextKerning(internd->drawing_wand));
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextKerning(float kerning)
Sets the text kerning
*/
PHP_METHOD(imagickdraw, settextkerning)
{
php_imagickdraw_object *internd;
double kerning;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &kerning) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextKerning(internd->drawing_wand, kerning);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::getTextInterwordSpacing()
Gets the text interword spacing
*/
PHP_METHOD(imagickdraw, gettextinterwordspacing)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
RETURN_DOUBLE(DrawGetTextInterwordSpacing(internd->drawing_wand));
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextInterwordSpacing(float spacing)
Sets the text interword spacing
*/
PHP_METHOD(imagickdraw, settextinterwordspacing)
{
php_imagickdraw_object *internd;
double spacing;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextInterwordSpacing(internd->drawing_wand, spacing);
RETURN_TRUE;
}
/* }}} */
#endif
#if MagickLibVersion > 0x655
/* {{{ proto bool ImagickDraw::getTextInterlineSpacing()
Gets the text interword spacing
*/
PHP_METHOD(imagickdraw, gettextinterlinespacing)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
RETURN_DOUBLE(DrawGetTextInterlineSpacing(internd->drawing_wand));
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextInterlineSpacing(float spacing)
Sets the text interword spacing
*/
PHP_METHOD(imagickdraw, settextinterlinespacing)
{
php_imagickdraw_object *internd;
double spacing;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextInterlineSpacing(internd->drawing_wand, spacing);
RETURN_TRUE;
}
/* }}} */
#endif
/* {{{ proto ImagickDraw ImagickDraw::__construct()
The ImagickDraw constructor
*/
PHP_METHOD(imagickdraw, __construct)
{
/* Empty constructor for possible future uses */
#ifdef ZEND_ENGINE_3
// This suppresses an 'unused parameter' warning.
(void)execute_data;
(void)return_value;
#endif
}
/* }}} */
/* {{{ proto bool ImagickDraw::circle(float ox, float oy, float px, float py)
Draws a circle on the image.
*/
PHP_METHOD(imagickdraw, circle)
{
double ox, oy, px, py;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &ox, &oy, &px, &py) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawCircle(internd->drawing_wand, ox, oy, px, py);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::rectangle(float x1, float y1, float x2, float y2)
Draws a rectangle given two coordinates and using the current stroke, stroke width, and fill settings.
*/
PHP_METHOD(imagickdraw, rectangle)
{
double x1, y1, x2, y2;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x2, &y2) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawRectangle(internd->drawing_wand, x1, y1, x2, y2);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::roundRectangle(float x1, float y1, float x2, float y2, float rx, float ry)
Draws a rounted rectangle given two coordinates, x & y corner radiuses and using the current stroke, stroke width, and fill settings.
*/
PHP_METHOD(imagickdraw, roundrectangle)
{
double x1, y1, x2, y2, rx, ry;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &x1, &y1, &x2, &y2, &rx, &ry) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawRoundRectangle(internd->drawing_wand, x1, y1, x2, y2, rx, ry);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::ellipse(float ox, float oy, float rx, float ry, float start, float end)
Draws an ellipse on the image.
*/
PHP_METHOD(imagickdraw, ellipse)
{
double ox, oy, rx, ry, start, end;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &ox, &oy, &rx, &ry, &start, &end) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawEllipse(internd->drawing_wand, ox, oy, rx, ry, start, end);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::skewX(float degrees)
Skews the current coordinate system in the horizontal direction.
*/
PHP_METHOD(imagickdraw, skewx)
{
double degrees;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSkewX(internd->drawing_wand, degrees);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::skewY(float degrees)
Skews the current coordinate system in the vertical direction.
*/
PHP_METHOD(imagickdraw, skewy)
{
double degrees;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSkewY(internd->drawing_wand, degrees);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::translate(float x, float y)
Applies a translation to the current coordinate system which moves the coordinate system origin to the specified coordinate.
*/
PHP_METHOD(imagickdraw, translate)
{
double x, y;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawTranslate(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFillColor(PixelWand fill_wand)
Sets the fill color to be used for drawing filled objects.
*/
PHP_METHOD(imagickdraw, setfillcolor)
{
zval *param;
php_imagickdraw_object *internd;
PixelWand *color_wand;
zend_bool allocated;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
color_wand = php_imagick_zval_to_pixelwand(param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC);
if (!color_wand)
return;
DrawSetFillColor(internd->drawing_wand, color_wand);
if (allocated)
color_wand = DestroyPixelWand (color_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setResolution(float x, float y)
Sets the resolution
*/
PHP_METHOD(imagickdraw, setresolution)
{
char *density, *buf = NULL;
double x, y;
php_imagickdraw_object *internd;
DrawInfo *draw_info;
DrawingWand *d_wand;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
spprintf(&buf, 512, "%fx%f", x, y);
density = AcquireString(buf);
efree (buf);
if (!density) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Failed to allocate memory" TSRMLS_CC);
return;
}
draw_info = PeekDrawingWand(internd->drawing_wand);
draw_info->density = density;
#if MagickLibVersion >= 0x693
d_wand = AcquireDrawingWand(draw_info, NULL);
#else
d_wand = (DrawingWand *) DrawAllocateWand(draw_info, NULL);
#endif
if (!d_wand) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Failed to allocate new DrawingWand structure" TSRMLS_CC);
return;
}
php_imagick_replace_drawingwand(internd, d_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeColor(PixelWand stroke_wand)
Sets the color used for stroking object outlines.
*/
PHP_METHOD(imagickdraw, setstrokecolor)
{
zval *param;
php_imagickdraw_object *internd;
PixelWand *color_wand;
zend_bool allocated;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
color_wand = php_imagick_zval_to_pixelwand (param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC);
if (!color_wand)
return;
DrawSetStrokeColor(internd->drawing_wand, color_wand);
if (allocated)
color_wand = DestroyPixelWand (color_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFillAlpha(float opacity)
Sets the opacity to use when drawing using the fill color or fill texture. Fully opaque is 1.0.
*/
PHP_METHOD(imagickdraw, setfillalpha)
{
php_imagickdraw_object *internd;
double opacity;
IMAGICK_METHOD_DEPRECATED("ImagickDraw", "setFillAlpha");
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
#if MagickLibVersion >= 0x635
DrawSetFillOpacity(internd->drawing_wand, opacity);
#else
DrawSetFillAlpha(internd->drawing_wand, opacity);
#endif
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::getAntialias()
Returns the antialias property associated with the wand.
*/
PHP_METHOD(imagickdraw, settextantialias)
{
php_imagickdraw_object *internd;
zend_bool antialias;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &antialias) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextAntialias(internd->drawing_wand, antialias);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextEncoding(string encoding)
Specifies specifies the code set to use for text annotations.
The only character encoding which may be specified at this time is "UTF-8" for representing Unicode as a sequence of bytes.
Specify an empty string to set text encoding to the system's default.
Successful text annotation using Unicode may require fonts designed to support Unicode.
*/
PHP_METHOD(imagickdraw, settextencoding)
{
php_imagickdraw_object *internd;
char *encoding;
IM_LEN_TYPE encoding_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &encoding, &encoding_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextEncoding(internd->drawing_wand, encoding);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeAlpha(float opacity)
Specifies the opacity of stroked object outlines.
*/
PHP_METHOD(imagickdraw, setstrokealpha)
{
php_imagickdraw_object *internd;
double opacity;
IMAGICK_METHOD_DEPRECATED("ImagickDraw", "setStrokeAlpha");
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
#if MagickLibVersion >= 0x635
DrawSetStrokeOpacity(internd->drawing_wand, opacity);
#else
DrawSetStrokeAlpha(internd->drawing_wand, opacity);
#endif
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeWidth(float stroke_width)
Sets the width of the stroke used to draw object outlines.
*/
PHP_METHOD(imagickdraw, setstrokewidth)
{
php_imagickdraw_object *internd;
double width;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &width) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetStrokeWidth(internd->drawing_wand, width);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFont(string font_name)
Sets the fully-sepecified font to use when annotating with text.
*/
PHP_METHOD(imagickdraw, setfont)
{
php_imagickdraw_object *internd;
char *font, *absolute;
IM_LEN_TYPE font_len;
MagickBooleanType status;
php_imagick_rw_result_t rc;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &font, &font_len) == FAILURE) {
return;
}
/* Check that no empty string is passed */
if (font_len == 0) {
php_imagick_throw_exception (IMAGICKDRAW_CLASS, "Can not set empty font" TSRMLS_CC);
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
/* And if it wasn't */
if (!php_imagick_check_font(font, font_len TSRMLS_CC)) {
if ((absolute = expand_filepath(font, NULL TSRMLS_CC)) == NULL) {
php_imagick_throw_exception (IMAGICKDRAW_CLASS, "Unable to set font, file path expansion failed" TSRMLS_CC);
return;
}
/* Do an access check for the font */
if ((rc = php_imagick_file_access_check (absolute TSRMLS_CC)) != IMAGICK_RW_OK) {
// Failed
php_imagick_imagickdraw_rw_fail_to_exception (internd->drawing_wand, rc, absolute TSRMLS_CC);
efree(absolute);
return;
}
status = DrawSetFont(internd->drawing_wand, absolute);
efree(absolute);
} else {
status = DrawSetFont(internd->drawing_wand, font);
}
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set font" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFontFamily(string font_family)
Sets the font family to use when annotating with text.
*/
PHP_METHOD(imagickdraw, setfontfamily)
{
php_imagickdraw_object *internd;
char *font_family;
IM_LEN_TYPE font_family_len;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &font_family, &font_family_len) == FAILURE) {
return;
}
/* Check that no empty string is passed */
if (font_family_len == 0) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Can not set empty font family" TSRMLS_CC);
return;
}
if (!php_imagick_check_font(font_family, font_family_len TSRMLS_CC )) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to set font family; parameter not found in the list of configured fonts" TSRMLS_CC);
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = DrawSetFontFamily(internd->drawing_wand, font_family);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set font family" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFontSize(float pointsize)
Sets the font pointsize to use when annotating with text.
*/
PHP_METHOD(imagickdraw, setfontsize)
{
php_imagickdraw_object *internd;
double font_size;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &font_size) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetFontSize(internd->drawing_wand, font_size);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFontStyle(int style)
Sets the font style to use when annotating with text. The AnyStyle enumeration acts as a wild-card "don't care" option.
*/
PHP_METHOD(imagickdraw, setfontstyle)
{
php_imagickdraw_object *internd;
im_long style_id = AnyStyle;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &style_id) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetFontStyle(internd->drawing_wand, style_id);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFontWeight(int font_weight)
Sets the font weight to use when annotating with text.
*/
PHP_METHOD(imagickdraw, setfontweight)
{
php_imagickdraw_object *internd;
im_long weight;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &weight) == FAILURE) {
return;
}
if (weight >= 100 && weight <= 900) {
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetFontWeight(internd->drawing_wand, weight);
RETURN_TRUE;
}
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Font weight valid range is 100-900" TSRMLS_CC);
return;
}
/* }}} */
/* {{{ proto int ImagickDraw::getFontStretch(int fontStretch)
Gets the font stretch to use when annotating with text
*/
PHP_METHOD(imagickdraw, getfontstretch)
{
php_imagickdraw_object *internd;
internd = Z_IMAGICKDRAW_P(getThis());;
RETVAL_LONG(DrawGetFontStretch(internd->drawing_wand));
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFontStretch(int fontStretch)
Sets the font stretch to use when annotating with text. The AnyStretch enumeration acts as a wild-card "don't care" option.
*/
PHP_METHOD(imagickdraw, setfontstretch)
{
php_imagickdraw_object *internd;
im_long stretch;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &stretch) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetFontStretch(internd->drawing_wand, stretch);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeAntialias(bool stroke_antialias)
Controls whether stroked outlines are antialiased. Stroked outlines are antialiased by default. When antialiasing is disabled stroked pixels are thresholded to determine if the stroke color or underlying canvas color should be used.
*/
PHP_METHOD(imagickdraw, setstrokeantialias)
{
php_imagickdraw_object *internd;
zend_bool antialias;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &antialias) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetStrokeAntialias(internd->drawing_wand, antialias);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextAlignment(int alignment)
Specifies a text alignment to be applied when annotating with text.
*/
PHP_METHOD(imagickdraw, settextalignment)
{
php_imagickdraw_object *internd;
im_long align;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &align) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextAlignment(internd->drawing_wand, align);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextDecoration(int decoration)
Specifies a decoration to be applied when annotating with text.
*/
PHP_METHOD(imagickdraw, settextdecoration)
{
php_imagickdraw_object *internd;
im_long decoration;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &decoration) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetTextDecoration(internd->drawing_wand, decoration);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextUnderColor(PixelWand under_wand)
Specifies the color of a background rectangle to place under text annotations.
*/
PHP_METHOD(imagickdraw, settextundercolor)
{
zval *param;
php_imagickdraw_object *internd;
PixelWand *color_wand;
zend_bool allocated;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
color_wand = php_imagick_zval_to_pixelwand (param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC);
if (!color_wand)
return;
DrawSetTextUnderColor(internd->drawing_wand, color_wand);
if (allocated)
color_wand = DestroyPixelWand (color_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setViewbox(float x1, float y1, float x2, float y2 )
Sets the overall canvas size to be recorded with the drawing vector data. Usually this will be specified using the same size as the canvas image. When the vector data is saved to SVG or MVG formats, the viewbox is use to specify the size of the canvas image that a viewer will render the vector data on.
*/
PHP_METHOD(imagickdraw, setviewbox)
{
php_imagickdraw_object *internd;
im_long x1, y1, x2, y2;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llll", &x1, &y1, &x2, &y2) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetViewbox(internd->drawing_wand, x1, y1, x2, y2);
RETURN_TRUE;
}
/* {{{ proto string ImagickDraw::getFont()
Returns a string specifying the font used when annotating with text
*/
PHP_METHOD(imagickdraw, getfont)
{
php_imagickdraw_object *internd;
char *font;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
font = DrawGetFont(internd->drawing_wand);
if (!font) {
RETURN_FALSE;
} else {
IM_ZVAL_STRING(return_value, font);
IMAGICK_FREE_MAGICK_MEMORY(font);
return;
}
}
/* }}} */
/* {{{ proto string ImagickDraw::getFontFamily()
Returns the font family to use when annotating with text. The value returned must be freed by the user when it is no longer needed.
*/
PHP_METHOD(imagickdraw, getfontfamily)
{
php_imagickdraw_object *internd;
char *font_family;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
font_family = DrawGetFontFamily(internd->drawing_wand);
if (!font_family) {
RETURN_FALSE;
} else {
IM_ZVAL_STRING(return_value, font_family);
IMAGICK_FREE_MAGICK_MEMORY(font_family);
return;
}
}
/* }}} */
/* {{{ proto float ImagickDraw::getFontSize()
Returns the font pointsize used when annotating with text.
*/
PHP_METHOD(imagickdraw, getfontsize)
{
php_imagickdraw_object *internd;
double font_size;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
font_size = DrawGetFontSize(internd->drawing_wand);
ZVAL_DOUBLE(return_value, font_size);
return;
}
/* }}} */
/* {{{ proto int ImagickDraw::getFontStyle()
Returns the font style used when annotating with text.
*/
PHP_METHOD(imagickdraw, getfontstyle)
{
php_imagickdraw_object *internd;
long font_style;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
font_style = DrawGetFontStyle(internd->drawing_wand);
ZVAL_LONG(return_value, font_style);
return;
}
/* }}} */
/* {{{ proto int ImagickDraw::getFontWeight()
Returns the font weight used when annotating with text.
*/
PHP_METHOD(imagickdraw, getfontweight)
{
php_imagickdraw_object *internd;
long weight;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
weight = DrawGetFontWeight(internd->drawing_wand);
ZVAL_LONG(return_value, weight);
return;
}
/* }}} */
/* {{{ proto bool ImagickDraw::clear()
Clears a DrawingWand resource of any accumulated commands, and resets the settings it contains to their defaults.
*/
PHP_METHOD(imagickdraw, clear)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
ClearDrawingWand(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto int ImagickDraw::getTextDecoration()
Returns the decoration applied when annotating with text.
*/
PHP_METHOD(imagickdraw, gettextdecoration)
{
php_imagickdraw_object *internd;
long decoration;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
decoration = DrawGetTextDecoration(internd->drawing_wand);
ZVAL_LONG(return_value, decoration);
return;
}
/* }}} */
/* {{{ proto string ImagickDraw::getTextEncoding()
Returns a null-terminated string which specifies the code set used for text annotations. The string must be freed by the user once it is no longer required.
*/
PHP_METHOD(imagickdraw, gettextencoding)
{
php_imagickdraw_object *internd;
char *encoding;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
encoding = DrawGetTextEncoding(internd->drawing_wand);
if (!encoding) {
RETURN_FALSE;
} else {
IM_ZVAL_STRING(return_value, encoding);
IMAGICK_FREE_MAGICK_MEMORY(encoding);
return;
}
}
/* }}} */
/* {{{ proto bool ImagickDraw::annotation(float x, float y, string *text)
Draws text on the image.
*/
PHP_METHOD(imagickdraw, annotation)
{
php_imagickdraw_object *internd;
double x, y;
unsigned char *text;
IM_LEN_TYPE text_len;
#if MagickLibVersion < 0x632
char *font;
#endif
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dds", &x, &y, &text, &text_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
#if MagickLibVersion < 0x632
font = DrawGetFont(internd->drawing_wand);
/* Fixes PECL Bug #11328 */
if (!font) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Font needs to be set before annotating an image" TSRMLS_CC);
return;
}
#endif
DrawAnnotation(internd->drawing_wand, x, y, text);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::arc(float sx, float sy, float ex, float ey, float sd, float ed)
Draws an arc falling within a specified bounding rectangle on the image.
*/
PHP_METHOD(imagickdraw, arc)
{
double sx, sy, ex, ey, sd, ed;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &sx, &sy, &ex, &ey, &sd, &ed) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawArc(internd->drawing_wand, sx, sy, ex, ey, sd, ed);
RETURN_TRUE;
}
/* }}} */
#if MagickLibVersion < 0x700
/* {{{ proto bool ImagickDraw::matte(float x, float y, int paintMethod)
Paints on the image's opacity channel in order to set effected pixels to transparent. to influence the opacity of pixels. The available paint methods are:
*/
PHP_METHOD(imagickdraw, matte)
{
double x, y;
php_imagickdraw_object *internd;
im_long paint_method;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddl", &x, &y, &paint_method) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawMatte(internd->drawing_wand, x, y, paint_method);
RETURN_TRUE;
}
/* }}} */
#else
/* {{{ proto bool ImagickDraw::matte(float x, float y, int paintMethod)
Paints on the image's alpha channel in order to set effected pixels to transparent. to influence the alpha of pixels. The available paint methods are:
PointMethod: Select the target pixel
ReplaceMethod: Select any pixel that matches the target pixel.
FloodfillMethod: Select the target pixel and matching neighbors.
FillToBorderMethod: Select the target pixel and neighbors not matching
border color.
ResetMethod: Select all pixels.
*/
PHP_METHOD(imagickdraw, alpha)
{
double x, y;
php_imagickdraw_object *internd;
im_long paint_method;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddl", &x, &y, &paint_method) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawAlpha(internd->drawing_wand, x, y, paint_method);
RETURN_TRUE;
}
/* }}} */
#endif
/* {{{ proto bool ImagickDraw::polygon(array coordinates)
Draws a polygon using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates.
*/
PHP_METHOD(imagickdraw, polygon)
{
zval *coordinate_array;
php_imagickdraw_object *internd;
PointInfo *coordinates;
int num_elements = 0;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &coordinate_array) == FAILURE) {
return;
}
coordinates = php_imagick_zval_to_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC);
if (!coordinates) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to read coordinate array" TSRMLS_CC);
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPolygon(internd->drawing_wand, num_elements, coordinates);
efree(coordinates);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::bezier(array coordinates)
Draws a bezier curve through a set of points on the image.
*/
PHP_METHOD(imagickdraw, bezier)
{
zval *coordinate_array;
php_imagickdraw_object *internd;
PointInfo *coordinates;
int num_elements = 0;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &coordinate_array) == FAILURE) {
return;
}
coordinates = php_imagick_zval_to_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC);
if (!coordinates) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to read coordinate array" TSRMLS_CC);
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawBezier(internd->drawing_wand, num_elements, coordinates);
efree(coordinates);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::point(float x, float y)
Draws a point using the current stroke color and stroke thickness at the specified coordinates.
*/
PHP_METHOD(imagickdraw, point)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPoint(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::line(float sx, float sy, float ex, float ey)
Draws a line on the image using the current stroke color, stroke opacity, and stroke width.
*/
PHP_METHOD(imagickdraw, line)
{
php_imagickdraw_object *internd;
double sx, sy, ex, ey;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &sx, &sy, &ex, &ey) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawLine(internd->drawing_wand, sx, sy, ex, ey);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto ImagickDraw ImagickDraw::clone()
Makes an exact copy of the specified wand.
*/
PHP_METHOD(imagickdraw, clone)
{
php_imagickdraw_object *internd, *intern_return;
DrawingWand *tmp_wand;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
IMAGICK_METHOD_DEPRECATED("ImagickDraw", "clone");
internd = Z_IMAGICKDRAW_P(getThis());;
tmp_wand = CloneDrawingWand(internd->drawing_wand);
if (!tmp_wand) {
php_imagick_throw_exception (IMAGICK_CLASS, "Failed to allocate DrawingWand structure" TSRMLS_CC);
return;
}
object_init_ex(return_value, php_imagickdraw_sc_entry);
intern_return = Z_IMAGICKDRAW_P(return_value);
php_imagick_replace_drawingwand(intern_return, tmp_wand);
return;
}
/* }}} */
/* {{{ proto bool ImagickDraw::affine(array affine)
Adjusts the current affine transformation matrix with the specified affine transformation matrix. Note that the current affine transform is adjusted rather than replaced.
*/
PHP_METHOD(imagickdraw, affine)
{
php_imagickdraw_object *internd;
zval *affine_matrix;
#ifdef ZEND_ENGINE_3
zval *pzval;
#else
HashTable *affine;
zval **ppzval;
#endif
char *matrix_elements[] = { "sx", "rx", "ry",
"sy", "tx", "ty" };
int i;
double value;
AffineMatrix matrix;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &affine_matrix) == FAILURE) {
return;
}
#ifndef ZEND_ENGINE_3
affine = Z_ARRVAL_P(affine_matrix);
zend_hash_internal_pointer_reset_ex(affine, (HashPosition *) 0);
#endif
for (i = 0; i < 6 ; i++) {
#ifdef ZEND_ENGINE_3
pzval = zend_hash_str_find(HASH_OF(affine_matrix), matrix_elements[i], 2);
ZVAL_DEREF(pzval);
if (pzval == NULL) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "AffineMatrix must contain keys: sx, rx, ry, sy, tx and ty" TSRMLS_CC);
return;
#else
if (zend_hash_find(affine, matrix_elements[i], 3, (void**)&ppzval) == FAILURE) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "AffineMatrix must contain keys: sx, rx, ry, sy, tx and ty" TSRMLS_CC);
return;
#endif
} else {
#ifdef ZEND_ENGINE_3
value = zval_get_double(pzval);
#else
zval tmp_zval, *tmp_pzval;
tmp_zval = **ppzval;
zval_copy_ctor(&tmp_zval);
tmp_pzval = &tmp_zval;
convert_to_double(tmp_pzval);
value = Z_DVAL(tmp_zval);
#endif
if (strcmp(matrix_elements[i], "sx") == 0) {
matrix.sx = value;
} else if (strcmp(matrix_elements[i], "rx") == 0) {
matrix.rx = value;
} else if (strcmp(matrix_elements[i], "ry") == 0) {
matrix.ry = value;
} else if (strcmp(matrix_elements[i], "sy") == 0) {
matrix.sy = value;
} else if (strcmp(matrix_elements[i], "tx") == 0) {
matrix.tx = value;
} else if (strcmp(matrix_elements[i], "ty") == 0) {
matrix.ty = value;
}
}
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawAffine(internd->drawing_wand, &matrix);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::composite(int compose, float x, float y, float width, float height, MagickWand magick_wand)
Composites an image onto the current image, using the specified composition operator, specified position, and at the specified size.
*/
PHP_METHOD(imagickdraw, composite)
{
php_imagickdraw_object *internd;
php_imagick_object *intern;
zval *magick_obj;
im_long compose;
double x, y, width, height;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lddddO", &compose, &x, &y, &width, &height, &magick_obj, php_imagick_sc_entry) == FAILURE) {
return;
}
intern = Z_IMAGICK_P(magick_obj);
if (php_imagick_ensure_not_empty (intern->magick_wand) == 0)
return;
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawComposite(internd->drawing_wand, compose, x, y, width, height, intern->magick_wand);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Compositing image failed" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::color(float x, float y, int paintMethod)
Draws color on image using the current fill color, starting at specified position, and using specified paint method. The available paint methods are:
*/
PHP_METHOD(imagickdraw, color)
{
php_imagickdraw_object *internd;
double x, y;
im_long paint_method;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddl", &x, &y, &paint_method) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawColor(internd->drawing_wand, x, y, paint_method);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::comment(string comment)
Adds a comment to a vector output stream.
*/
PHP_METHOD(imagickdraw, comment)
{
php_imagickdraw_object *internd;
char *comment;
IM_LEN_TYPE comment_len;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &comment, &comment_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawComment(internd->drawing_wand, comment);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string ImagickDraw::getClipPath()
Obtains the current clipping path ID. The value returned must be deallocated by the user when it is no longer needed.
*/
PHP_METHOD(imagickdraw, getclippath)
{
php_imagickdraw_object *internd;
char *clip_path;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
clip_path = DrawGetClipPath(internd->drawing_wand);
if (!clip_path) {
RETURN_FALSE;
} else {
IM_ZVAL_STRING(return_value, clip_path);
IMAGICK_FREE_MAGICK_MEMORY(clip_path);
return;
}
}
/* }}} */
/* {{{ proto int ImagickDraw::getClipRule()
Returns the current polygon fill rule to be used by the clipping path.
*/
PHP_METHOD(imagickdraw, getcliprule)
{
php_imagickdraw_object *internd;
long clip_rule;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
clip_rule = DrawGetClipRule(internd->drawing_wand);
RETVAL_LONG(clip_rule);
}
/* }}} */
/* {{{ proto int ImagickDraw::getClipUnits()
Returns the interpretation of clip path units.
*/
PHP_METHOD(imagickdraw, getclipunits)
{
php_imagickdraw_object *internd;
long units;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
units = DrawGetClipUnits(internd->drawing_wand);
RETVAL_LONG(units);
}
/* }}} */
/* {{{ proto ImagickPixel ImagickDraw::getFillColor()
Returns the fill color used for drawing filled objects.
*/
PHP_METHOD(imagickdraw, getfillcolor)
{
php_imagickpixel_object *internp;
php_imagickdraw_object *internd;
PixelWand *tmp_wand;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
tmp_wand = NewPixelWand();
DrawGetFillColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = Z_IMAGICKPIXEL_P(return_value);
php_imagick_replace_pixelwand(internp, tmp_wand);
return;
}
/* }}} */
/* {{{ proto float ImagickDraw::getFillOpacity()
Returns the opacity used when drawing using the fill color or fill texture. Fully opaque is 1.0.
*/
PHP_METHOD(imagickdraw, getfillopacity)
{
php_imagickdraw_object *internd;
double opacity;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
opacity = DrawGetFillOpacity(internd->drawing_wand);
RETVAL_DOUBLE(opacity);
}
/* }}} */
/* {{{ proto int ImagickDraw::getFillRule(const DrawingWand *wand)
Returns the fill rule used while drawing polygons.
*/
PHP_METHOD(imagickdraw, getfillrule)
{
php_imagickdraw_object *internd;
long fill_rule;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
fill_rule = DrawGetFillRule(internd->drawing_wand);
RETVAL_LONG(fill_rule);
}
/* }}} */
/* {{{ proto int ImagickDraw::getGravity()
Returns the text placement gravity used when annotating with text.
*/
PHP_METHOD(imagickdraw, getgravity)
{
php_imagickdraw_object *internd;
long gravity;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
gravity = DrawGetGravity(internd->drawing_wand);
RETVAL_LONG(gravity);
}
/* }}} */
/* {{{ proto bool ImagickDraw::getStrokeAntialias()
Returns the current stroke antialias setting. Stroked outlines are antialiased by default. When antialiasing is disabled stroked pixels are thresholded to determine if the stroke color or underlying canvas color should be used.
*/
PHP_METHOD(imagickdraw, getstrokeantialias)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = DrawGetStrokeAntialias(internd->drawing_wand);
if (status == MagickFalse) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
/* }}} */
/* {{{ proto ImagickPixel ImagickDraw::getStrokeColor(PixelWand stroke_color)
Returns the color used for stroking object outlines.
*/
PHP_METHOD(imagickdraw, getstrokecolor)
{
php_imagickpixel_object *internp;
php_imagickdraw_object *internd;
PixelWand *tmp_wand;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
tmp_wand = NewPixelWand();
DrawGetStrokeColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = Z_IMAGICKPIXEL_P(return_value);
php_imagick_replace_pixelwand(internp, tmp_wand);
return;
}
/* }}} */
/* {{{ proto array ImagickDraw::getStrokeDashArray()
Returns an array representing the pattern of dashes and gaps used to stroke paths (see DrawSetStrokeDashArray). The array must be freed once it is no longer required by the user.
*/
PHP_METHOD(imagickdraw, getstrokedasharray)
{
php_imagickdraw_object *internd;
double *stroke_array;
unsigned long i;
size_t num_elements;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
stroke_array = DrawGetStrokeDashArray(internd->drawing_wand, &num_elements);
array_init(return_value);
for (i = 0; i < num_elements ; i++) {
add_next_index_double(return_value, stroke_array[i]);
}
IMAGICK_FREE_MAGICK_MEMORY(stroke_array);
return;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeDashArray(array dashArray)
Specifies the pattern of dashes and gaps used to stroke paths. The strokeDashArray represents an array of numbers that specify the lengths of alternating dashes and gaps in pixels. If an odd number of values is provided, then the list of values is repeated to yield an even number of values. To remove an existing dash array, pass a zero number_elements argument and null dash_array. A typical strokeDashArray_ array might contain the members 5 3 2.
*/
PHP_METHOD(imagickdraw, setstrokedasharray)
{
zval *param_array;
double *double_array;
im_long elements;
php_imagickdraw_object *internd;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", ¶m_array) == FAILURE) {
return;
}
double_array = php_imagick_zval_to_double_array(param_array, &elements TSRMLS_CC);
if (!double_array) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Cannot read stroke dash array parameter" TSRMLS_CC);
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetStrokeDashArray(internd->drawing_wand, elements, double_array);
efree(double_array);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto float ImagickDraw::getStrokeDashOffset()
Returns the offset into the dash pattern to start the dash.
*/
PHP_METHOD(imagickdraw, getstrokedashoffset)
{
php_imagickdraw_object *internd;
double offset;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
offset = DrawGetStrokeDashOffset(internd->drawing_wand);
RETVAL_DOUBLE(offset);
}
/* }}} */
/* {{{ proto int ImagickDraw::getStrokeLineCap()
Returns the shape to be used at the end of open subpaths when they are stroked. Values of LineCap are UndefinedCap, ButtCap, RoundCap, and SquareCap.
*/
PHP_METHOD(imagickdraw, getstrokelinecap)
{
php_imagickdraw_object *internd;
long line_cap;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
line_cap = DrawGetStrokeLineCap(internd->drawing_wand);
RETVAL_LONG(line_cap);
}
/* }}} */
/* {{{ proto int ImagickDraw::getStrokeLineJoin()
Returns the shape to be used at the corners of paths (or other vector shapes) when they are stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
*/
PHP_METHOD(imagickdraw, getstrokelinejoin)
{
php_imagickdraw_object *internd;
long line_join;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
line_join = DrawGetStrokeLineJoin(internd->drawing_wand);
RETVAL_LONG(line_join);
}
/* }}} */
/* {{{ proto int ImagickDraw::getStrokeMiterLimit()
Returns the miter limit. When two line segments meet at a sharp angle and miter joins have been specified for 'lineJoin', it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterLimit' imposes a limit on the ratio of the miter length to the 'lineWidth'.
*/
PHP_METHOD(imagickdraw, getstrokemiterlimit)
{
php_imagickdraw_object *internd;
unsigned long miter_limit;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
miter_limit = DrawGetStrokeMiterLimit(internd->drawing_wand);
RETVAL_LONG(miter_limit);
}
/* }}} */
/* {{{ proto float ImagickDraw::getStrokeOpacity()
Returns the opacity of stroked object outlines.
*/
PHP_METHOD(imagickdraw, getstrokeopacity)
{
php_imagickdraw_object *internd;
double opacity;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
opacity = DrawGetStrokeOpacity(internd->drawing_wand);
RETVAL_DOUBLE(opacity);
}
/* }}} */
/* {{{ proto float ImagickDraw::getStrokeWidth()
Returns the width of the stroke used to draw object outlines.
*/
PHP_METHOD(imagickdraw, getstrokewidth)
{
php_imagickdraw_object *internd;
double width;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
width = DrawGetStrokeWidth(internd->drawing_wand);
RETVAL_DOUBLE(width);
}
/* }}} */
/* {{{ proto int ImagickDraw::getTextAlignment()
Returns the alignment applied when annotating with text.
*/
PHP_METHOD(imagickdraw, gettextalignment)
{
php_imagickdraw_object *internd;
long align_type;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
align_type = DrawGetTextAlignment(internd->drawing_wand);
RETVAL_LONG(align_type);
}
/* }}} */
/* {{{ proto bool ImagickDraw::getTextAntialias()
Returns the current text antialias setting, which determines whether text is antialiased. Text is antialiased by default.
*/
PHP_METHOD(imagickdraw, gettextantialias)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = DrawGetTextAntialias(internd->drawing_wand);
if (status == MagickFalse) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
/* }}} */
/* {{{ proto string ImagickDraw::getVectorGraphics()
Returns a null-terminated string which specifies the vector graphics generated by any graphics calls made since the wand was instantiated. The string must be freed by the user once it is no longer required.
*/
PHP_METHOD(imagickdraw, getvectorgraphics)
{
php_imagickdraw_object *internd;
char *vector;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
vector = DrawGetVectorGraphics(internd->drawing_wand);
IM_ZVAL_STRING(return_value, vector);
IMAGICK_FREE_MAGICK_MEMORY(vector);
return;
}
/* }}} */
/* {{{ proto ImagickPixel ImagickDraw::getTextUnderColor(PixelWand under_color)
Returns the color of a background rectangle to place under text annotations.
*/
PHP_METHOD(imagickdraw, gettextundercolor)
{
php_imagickpixel_object *internp;
php_imagickdraw_object *internd;
PixelWand *tmp_wand;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
tmp_wand = NewPixelWand();
if (!tmp_wand) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Failed to allocate space for new PixelWand" TSRMLS_CC);
return;
}
DrawGetTextUnderColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = Z_IMAGICKPIXEL_P(return_value);
php_imagick_replace_pixelwand(internp, tmp_wand);
return;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathClose()
Adds a path element to the current path which closes the current subpath by drawing a straight line from the current point to the current subpath's most recent starting point (usually, the most recent moveto point).
*/
PHP_METHOD(imagickdraw, pathclose)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPathClose(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToAbsolute(float x1, float y1, float x2, float y2, float x, float y)
Draws a cubic Bezier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve using absolute coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetoabsolute)
{
php_imagickdraw_object *internd;
double x1, y1, x2, y2, x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &x1, &y1, &x2, &y2, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToAbsolute(internd->drawing_wand, x1, y1, x2, y2, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToRelative(float x1, float y1, float x2, float y2, float x, float y)
Draws a cubic Bezier curve from the current point to (x,y) using (x1,y1) as the control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve using relative coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetorelative)
{
php_imagickdraw_object *internd;
double x1, y1, x2, y2, x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &x1, &y1, &x2, &y2, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToRelative(internd->drawing_wand, x1, y1, x2, y2, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierAbsolute(float x1, float y1, float x, float y)
Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point using absolute coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetoquadraticbezierabsolute)
{
php_imagickdraw_object *internd;
double x1, y1, x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToQuadraticBezierAbsolute(internd->drawing_wand, x1, y1, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierRelative(float x1, float y1, float x, float y)
Draws a quadratic Bezier curve from the current point to (x,y) using (x1,y1) as the control point using relative coordinates. At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetoquadraticbezierrelative)
{
php_imagickdraw_object *internd;
double x1, y1, x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToQuadraticBezierRelative(internd->drawing_wand, x1, y1, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierSmoothAbsolute(float x, float y)
Draws a quadratic Bezier curve (using relative coordinates) from the current point to (x,y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a DrawPathCurveToQuadraticBezierAbsolute, DrawPathCurveToQuadraticBezierRelative, DrawPathCurveToQuadraticBezierSmoothAbsolut or DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is coincident with the current point.). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetoquadraticbeziersmoothabsolute)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToQuadraticBezierSmoothAbsolute(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToQuadraticBezierSmoothRelative(float x, float y)
Draws a quadratic Bezier curve (using relative coordinates) from the current point to (x, y). The control point is assumed to be the reflection of the control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not a DrawPathCurveToQuadraticBezierAbsolute, DrawPathCurveToQuadraticBezierRelative, DrawPathCurveToQuadraticBezierSmoothAbsolut or DrawPathCurveToQuadraticBezierSmoothRelative, assume the control point is coincident with the current point). At the end of the command, the new current point becomes the final (x, y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetoquadraticbeziersmoothrelative)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToQuadraticBezierSmoothRelative(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToSmoothAbsolute(float x2, float y2, float x, float y)
Draws a cubic Bezier curve from the current point to (x,y) using absolute coordinates. The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an DrawPathCurveToAbsolute, DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetosmoothabsolute)
{
php_imagickdraw_object *internd;
double x1, y1, x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToSmoothAbsolute(internd->drawing_wand, x1, y1, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathCurveToSmoothRelative(float x2, float y2, float x, float y)
Draws a cubic Bezier curve from the current point to (x,y) using relative coordinates. The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an DrawPathCurveToAbsolute, DrawPathCurveToRelative, DrawPathCurveToSmoothAbsolute or DrawPathCurveToSmoothRelative, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). At the end of the command, the new current point becomes the final (x,y) coordinate pair used in the polybezier.
*/
PHP_METHOD(imagickdraw, pathcurvetosmoothrelative)
{
php_imagickdraw_object *internd;
double x1, y1, x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &x1, &y1, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathCurveToSmoothRelative(internd->drawing_wand, x1, y1, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathEllipticArcAbsolute(float rx, float ry, float x_axis_rotation, bool large_arc_flag, bool sweep_flag, float x, float y)
Draws an elliptical arc from the current point to (x, y) using absolute coordinates. The size and orientation of the ellipse are defined by two radii (rx, ry) and an xAxisRotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. largeArcFlag and sweepFlag contribute to the automatic calculations and help determine how the arc is drawn. If largeArcFlag is true then draw the larger of the available arcs. If sweepFlag is true, then draw the arc matching a clock-wise rotation.
*/
PHP_METHOD(imagickdraw, pathellipticarcabsolute)
{
php_imagickdraw_object *internd;
double rx, ry, x_axis_rotation, x, y;
zend_bool large_arc, sweep;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddbbdd", &rx, &ry, &x_axis_rotation, &large_arc, &sweep, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathEllipticArcAbsolute(internd->drawing_wand, rx, ry, x_axis_rotation, large_arc, sweep, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathEllipticArcRelative(float rx, float ry, float x_axis_rotation, bool large_arc_flag, bool sweep_flag, float x, float y)
Draws an elliptical arc from the current point to (x, y) using relative coordinates. The size and orientation of the ellipse are defined by two radii (rx, ry) and an xAxisRotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. largeArcFlag and sweepFlag contribute to the automatic calculations and help determine how the arc is drawn. If largeArcFlag is true then draw the larger of the available arcs. If sweepFlag is true, then draw the arc matching a clock-wise rotation.
*/
PHP_METHOD(imagickdraw, pathellipticarcrelative)
{
php_imagickdraw_object *internd;
double rx, ry, x_axis_rotation, x, y;
zend_bool large_arc, sweep;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddbbdd", &rx, &ry, &x_axis_rotation, &large_arc, &sweep, &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathEllipticArcRelative(internd->drawing_wand, rx, ry, x_axis_rotation, large_arc, sweep, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathFinish()
Terminates the current path.
*/
PHP_METHOD(imagickdraw, pathfinish)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPathFinish(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathLineToAbsolute(float x, float y)
Draws a line path from the current point to the given coordinate using absolute coordinates. The coordinate then becomes the new current point.
*/
PHP_METHOD(imagickdraw, pathlinetoabsolute)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathLineToAbsolute(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathLineToRelative(float x, float y)
Draws a line path from the current point to the given coordinate using relative coordinates. The coordinate then becomes the new current point.
*/
PHP_METHOD(imagickdraw, pathlinetorelative)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathLineToRelative(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathLineToHorizontalAbsolute(float x)
Draws a horizontal line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point.
*/
PHP_METHOD(imagickdraw, pathlinetohorizontalabsolute)
{
php_imagickdraw_object *internd;
double y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathLineToHorizontalAbsolute(internd->drawing_wand, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathLineToHorizontalRelative(float x)
Draws a horizontal line path from the current point to the target point using relative coordinates. The target point then becomes the new current point.
*/
PHP_METHOD(imagickdraw, pathlinetohorizontalrelative)
{
php_imagickdraw_object *internd;
double x;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathLineToHorizontalRelative(internd->drawing_wand, x);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathLineToVerticalAbsolute(float y)
Draws a vertical line path from the current point to the target point using absolute coordinates. The target point then becomes the new current point.
*/
PHP_METHOD(imagickdraw, pathlinetoverticalabsolute)
{
php_imagickdraw_object *internd;
double y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathLineToVerticalAbsolute(internd->drawing_wand, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathLineToVerticalRelative(float y)
Draws a vertical line path from the current point to the target point using relative coordinates. The target point then becomes the new current point.
*/
PHP_METHOD(imagickdraw, pathlinetoverticalrelative)
{
php_imagickdraw_object *internd;
double y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathLineToVerticalRelative(internd->drawing_wand, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathMoveToAbsolute(float x, float y)
Starts a new sub-path at the given coordinate using absolute coordinates. The current point then becomes the specified coordinate.
*/
PHP_METHOD(imagickdraw, pathmovetoabsolute)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathMoveToAbsolute(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathMoveToRelative(float x, float y)
Starts a new sub-path at the given coordinate using relative coordinates. The current point then becomes the specified coordinate.
*/
PHP_METHOD(imagickdraw, pathmovetorelative)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPathMoveToRelative(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pathStart()
Declares the start of a path drawing list which is terminated by a matching DrawPathFinish() command. All other DrawPath commands must be enclosed between a and a DrawPathFinish() command. This is because path drawing commands are subordinate commands and they do not function by themselves.
*/
PHP_METHOD(imagickdraw, pathstart)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPathStart(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::polyline(array coordinates)
Draws a polyline using the current stroke, stroke width, and fill color or texture, using the specified array of coordinates.
*/
PHP_METHOD(imagickdraw, polyline)
{
zval *coordinate_array;
php_imagickdraw_object *internd;
PointInfo *coordinates;
int num_elements = 0;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &coordinate_array) == FAILURE) {
return;
}
coordinates = php_imagick_zval_to_pointinfo_array(coordinate_array, &num_elements TSRMLS_CC);
if (!coordinates) {
php_imagick_throw_exception(IMAGICKDRAW_CLASS, "Unable to read coordinate array" TSRMLS_CC);
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPolyline(internd->drawing_wand, num_elements, coordinates);
efree(coordinates);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::popClipPath()
Terminates a clip path definition.
*/
PHP_METHOD(imagickdraw, popclippath)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPopClipPath(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::popDefs()
Terminates a definition list
*/
PHP_METHOD(imagickdraw, popdefs)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPopDefs(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::popPattern()
Terminates a pattern definition.
*/
PHP_METHOD(imagickdraw, poppattern)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = DrawPopPattern(internd->drawing_wand);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to terminate the pattern definition" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pushClipPath(string clip_mask_id)
Starts a clip path definition which is comprized of any number of drawing commands and terminated by a DrawPopClipPath() command.
*/
PHP_METHOD(imagickdraw, pushclippath)
{
php_imagickdraw_object *internd;
char *clip_mask;
IM_LEN_TYPE clip_mask_len;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &clip_mask, &clip_mask_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPushClipPath(internd->drawing_wand, clip_mask);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pushDefs()
Indicates that commands up to a terminating DrawPopDefs() command create named elements (e.g. clip-paths, textures, etc.) which may safely be processed earlier for the sake of efficiency.
*/
PHP_METHOD(imagickdraw, pushdefs)
{
php_imagickdraw_object *internd;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawPushDefs(internd->drawing_wand);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pushPattern(string pattern_id, float x, float y, float width, float height)
Indicates that subsequent commands up to a DrawPopPattern() command comprise the definition of a named pattern. The pattern space is assigned top left corner coordinates, a width and height, and becomes its own drawing space. Anything which can be drawn may be used in a pattern definition. Named patterns may be used as stroke or brush definitions.
*/
PHP_METHOD(imagickdraw, pushpattern)
{
php_imagickdraw_object *internd;
char *pattern_id;
IM_LEN_TYPE pattern_id_len;
double x, y, width, height;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdddd", &pattern_id, &pattern_id_len, &x, &y, &width, &height) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawPushPattern(internd->drawing_wand, pattern_id, x, y, width, height);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::render()
Renders all preceding drawing commands.
*/
PHP_METHOD(imagickdraw, render)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
char *old_locale;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
old_locale = php_imagick_set_locale (TSRMLS_C);
status = DrawRender(internd->drawing_wand);
php_imagick_restore_locale (old_locale);
if (old_locale)
efree (old_locale);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to render the drawing commands" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::rotate(float degrees)
Applies the specified rotation to the current coordinate space.
*/
PHP_METHOD(imagickdraw, rotate)
{
php_imagickdraw_object *internd;
double degrees;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawRotate(internd->drawing_wand, degrees);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::scale(float x, float y)
Adjusts the scaling factor to apply in the horizontal and vertical directions to the current coordinate space.
*/
PHP_METHOD(imagickdraw, scale)
{
php_imagickdraw_object *internd;
double x, y;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawScale(internd->drawing_wand, x, y);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setClipPath(string clip_mask)
Associates a named clipping path with the image. Only the areas drawn on by the clipping path will be modified as long as it remains in effect.
*/
PHP_METHOD(imagickdraw, setclippath)
{
php_imagickdraw_object *internd;
char *clip_mask;
IM_LEN_TYPE clip_mask_len;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &clip_mask, &clip_mask_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawSetClipPath(internd->drawing_wand, clip_mask);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set clipping path" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setClipRule(int fill_rule)
Set the polygon fill rule to be used by the clipping path.
*/
PHP_METHOD(imagickdraw, setcliprule)
{
php_imagickdraw_object *internd;
im_long fill_rule;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fill_rule) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetClipRule(internd->drawing_wand, fill_rule);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setClipUnits(int clip_units)
Sets the interpretation of clip path units.
*/
PHP_METHOD(imagickdraw, setclipunits)
{
php_imagickdraw_object *internd;
im_long units;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &units) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetClipUnits(internd->drawing_wand, units);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFillOpacity(float fillOpacity)
Sets the opacity to use when drawing using the fill color or fill texture. Fully opaque is 1.0.
*/
PHP_METHOD(imagickdraw, setfillopacity)
{
php_imagickdraw_object *internd;
double fillOpacity;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &fillOpacity) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetFillOpacity(internd->drawing_wand, fillOpacity);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFillPatternURL(string fill_url)
Sets the URL to use as a fill pattern for filling objects. Only local URLs ("#identifier") are supported at this time.
These local URLs are normally created by defining a named fill pattern with DrawPushPattern/DrawPopPattern.
*/
PHP_METHOD(imagickdraw, setfillpatternurl)
{
php_imagickdraw_object *internd;
char *url;
IM_LEN_TYPE url_len;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &url, &url_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawSetFillPatternURL(internd->drawing_wand, url);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set fill pattern URL" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setFillRule(int fill_rule)
Sets the fill rule to use while drawing polygons.
*/
PHP_METHOD(imagickdraw, setfillrule)
{
php_imagickdraw_object *internd;
im_long fill_rule;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &fill_rule) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetFillRule(internd->drawing_wand, fill_rule);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setGravity(int gravity)
Sets the text placement gravity to use when annotating with text.
*/
PHP_METHOD(imagickdraw, setgravity)
{
php_imagickdraw_object *internd;
im_long gravity;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &gravity) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetGravity(internd->drawing_wand, gravity);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokePatternURL(string stroke_url)
Sets the pattern used for stroking object outlines.
*/
PHP_METHOD(imagickdraw, setstrokepatternurl)
{
php_imagickdraw_object *internd;
char *url;
IM_LEN_TYPE url_len;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &url, &url_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawSetStrokePatternURL(internd->drawing_wand, url);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set stroke pattern URL" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeDashOffset(float dash_offset)
Specifies the offset into the dash pattern to start the dash.
*/
PHP_METHOD(imagickdraw, setstrokedashoffset)
{
php_imagickdraw_object *internd;
double offset;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &offset) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetStrokeDashOffset(internd->drawing_wand, offset);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeLineCap(int linecap)
Specifies the shape to be used at the end of open subpaths when they are stroked. Values of LineCap are UndefinedCap, ButtCap, RoundCap, and SquareCap.
*/
PHP_METHOD(imagickdraw, setstrokelinecap)
{
php_imagickdraw_object *internd;
im_long line_cap;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_cap) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetStrokeLineCap(internd->drawing_wand, line_cap);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeLineJoin(int linejoin)
Specifies the shape to be used at the corners of paths (or other vector shapes) when they are stroked. Values of LineJoin are UndefinedJoin, MiterJoin, RoundJoin, and BevelJoin.
*/
PHP_METHOD(imagickdraw, setstrokelinejoin)
{
php_imagickdraw_object *internd;
im_long line_join;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &line_join) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetStrokeLineJoin(internd->drawing_wand, line_join);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeMiterLimit(int miterlimit)
Specifies the miter limit. When two line segments meet at a sharp angle and miter joins have been specified for 'lineJoin', it is possible for the miter to extend far beyond the thickness of the line stroking the path. The miterLimit' imposes a limit on the ratio of the miter length to the 'lineWidth'.
*/
PHP_METHOD(imagickdraw, setstrokemiterlimit)
{
php_imagickdraw_object *internd;
im_long miter_limit;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &miter_limit) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetStrokeMiterLimit(internd->drawing_wand, miter_limit);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setStrokeOpacity(float stroke_opacity)
Specifies the opacity of stroked object outlines.
*/
PHP_METHOD(imagickdraw, setstrokeopacity)
{
php_imagickdraw_object *internd;
double opacity;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetStrokeOpacity(internd->drawing_wand, opacity);
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::setVectorGraphics(string xml)
Sets the vector graphics associated with the specified wand. Use this method with DrawGetVectorGraphics() as a method to persist the vector graphics state.
*/
PHP_METHOD(imagickdraw, setvectorgraphics)
{
php_imagickdraw_object *internd;
char *vector;
IM_LEN_TYPE vector_len;
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &vector, &vector_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawSetVectorGraphics(internd->drawing_wand, vector);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to set the vector graphics" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::pop()
Destroys the current DrawingWand in the stack, and returns to the previously pushed DrawingWand. Multiple DrawingWands may exist. It is an error to attempt to pop more DrawingWands than have been pushed, and it is proper form to pop all DrawingWands which have been pushed.
*/
PHP_METHOD(imagickdraw, pop)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = PopDrawingWand(internd->drawing_wand);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to pop the current ImagickDraw object" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto bool ImagickDraw::push()
Clones the current DrawingWand to create a new DrawingWand, which is then added to the DrawingWand stack. The original drawing DrawingWand(s) may be returned to by invoking PopDrawingWand(). The DrawingWands are stored on a DrawingWand stack. For every Pop there must have already been an equivalent Push.
*/
PHP_METHOD(imagickdraw, push)
{
php_imagickdraw_object *internd;
MagickBooleanType status;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = PushDrawingWand(internd->drawing_wand);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to push the current ImagickDraw object" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
#if MagickLibVersion >= 0x693
/* {{{ proto float ImagickDraw::getOpacity()
Returns the opacity used when drawing with the fill or stroke color or texture. Fully opaque is 1.0.
*/
PHP_METHOD(imagickdraw, getopacity)
{
php_imagickdraw_object *internd;
double opacity;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
opacity = DrawGetOpacity(internd->drawing_wand);
RETURN_DOUBLE(opacity);
}
/* }}} */
/* {{{ proto bool ImagickDraw::setOpacity(float opacity)
Sets the opacity to use when drawing using the fill or stroke color or texture. Fully opaque is 1.0.
*/
PHP_METHOD(imagickdraw, setopacity)
{
php_imagickdraw_object *internd;
double opacity;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &opacity) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
DrawSetOpacity(internd->drawing_wand, opacity);
RETURN_TRUE;
}
/* }}} */
#endif //#if MagickLibVersion >= 0x693
#if MagickLibVersion >= 0x675
/* {{{ proto array ImagickDraw::getFontResolution()
Gets the image X and Y resolution.
*/
PHP_METHOD(imagickdraw, getfontresolution)
{
php_imagickdraw_object *internd;
double x, y;
MagickBooleanType status;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawGetFontResolution(internd->drawing_wand, &x, &y);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to push the current ImagickDraw object" TSRMLS_CC);
return;
}
array_init(return_value);
add_assoc_double(return_value, "x", x);
add_assoc_double(return_value, "y", y);
return;
}
/* }}} */
#endif //#if MagickLibVersion >= 0x675
#if MagickLibVersion >= 0x675
/* {{{ proto bool ImagickDraw::setFontResolution(float x, float y)
Sets the image font resolution.
*/
PHP_METHOD(imagickdraw, setfontresolution)
{
php_imagickdraw_object *internd;
double x, y;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
status = DrawSetFontResolution(internd->drawing_wand, x, y);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to push the current ImagickDraw object" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
#endif //#if MagickLibVersion >= 0x675
#if MagickLibVersion >= 0x675
/* {{{ proto ImagickPixel ImagickDraw::getBorderColor()
Returns the border color used for drawing bordered objects.
*/
PHP_METHOD(imagickdraw, getbordercolor)
{
php_imagickpixel_object *internp;
php_imagickdraw_object *internd;
PixelWand *tmp_wand;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
tmp_wand = NewPixelWand();
DrawGetBorderColor(internd->drawing_wand, tmp_wand);
object_init_ex(return_value, php_imagickpixel_sc_entry);
internp = Z_IMAGICKPIXEL_P(return_value);
php_imagick_replace_pixelwand(internp, tmp_wand);
return;
}
/* }}} */
#endif //#if MagickLibVersion >= 0x675
#if MagickLibVersion >= 0x675
/* {{{ proto bool ImagickDraw::setBorderColor(ImagickPixel color)
Sets the border color to be used for drawing bordered objects.
*/
PHP_METHOD(imagickdraw, setbordercolor)
{
zval *param;
php_imagickdraw_object *internd;
PixelWand *color_wand;
zend_bool allocated;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶m) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());;
color_wand = php_imagick_zval_to_pixelwand(param, IMAGICKDRAW_CLASS, &allocated TSRMLS_CC);
if (!color_wand)
return;
DrawSetBorderColor(internd->drawing_wand, color_wand);
if (allocated)
color_wand = DestroyPixelWand (color_wand);
RETURN_TRUE;
}
/* }}} */
#endif //#if MagickLibVersion >= 0x675
#if MagickLibVersion >= 0x692
/* {{{ proto integer ImagickDraw::getTextDirection()
Returns the direction that will be used when annotating with text.
*/
PHP_METHOD(imagickdraw, gettextdirection)
{
php_imagickdraw_object *internd;
im_long direction;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
direction = DrawGetTextDirection(internd->drawing_wand);
RETURN_LONG(direction);
}
/* }}} */
/* {{{ proto bool ImagickDraw::setTextDirection(int direction)
Sets the font style to use when annotating with text. The AnyStyle enumeration acts as a wild-card "don't care" option.
*/
PHP_METHOD(imagickdraw, settextdirection)
{
php_imagickdraw_object *internd;
im_long direction;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &direction) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
DrawSetTextDirection(internd->drawing_wand, direction);
RETURN_TRUE;
}
/* }}} */
#endif //#if MagickLibVersion >= 0x692
#if MagickLibVersion >= 0x692
/* {{{ proto bool ImagickDraw::setDensity(string density_string)
Sets the vertical and horizontal resolution.
*/
PHP_METHOD(imagickdraw, setdensity)
{
php_imagickdraw_object *internd;
char *density;
IM_LEN_TYPE density_len;
MagickBooleanType status;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &density, &density_len) == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
status = DrawSetDensity(internd->drawing_wand, density);
if (status == MagickFalse) {
php_imagick_convert_imagickdraw_exception (internd->drawing_wand, "Unable to setdensity for ImagickDraw object" TSRMLS_CC);
return;
}
RETURN_TRUE;
}
/* }}} */
/* {{{ proto string|null ImagickDraw::getDensity()
Obtains the vertical and horizontal resolution.
*/
PHP_METHOD(imagickdraw, getdensity)
{
php_imagickdraw_object *internd;
char *density;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
internd = Z_IMAGICKDRAW_P(getThis());
density = DrawGetDensity(internd->drawing_wand);
if (density == NULL) {
RETURN_NULL();
}
else {
IM_RETURN_STRING(density);
}
}
/* }}} */
#endif// #if MagickLibVersion >= 0x692
/* END OF DRAWINGWAND METHODS */
|