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
|
--- libgd2.orig/configure.ac
+++ libgd2/configure.ac
@@ -6,12 +6,12 @@ AC_PREREQ(2.54)
# Some m4 magic to have correct version number everywhere
m4_define([gd_MAJOR],[2])dnl
m4_define([gd_MINOR],[1])dnl
-m4_define([gd_REVISION],[0])dnl
-dnl m4_define([gd_EXTRA],[rc2])
+m4_define([gd_REVISION],[1])dnl
+m4_define([gd_EXTRA],[dev])dnl
-m4_ifdef([gd_EXTRA],
- [m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION-gd_EXTRA])],
- [m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION])]
+m4_if(m4_len(gd_EXTRA), 0,dnl
+ [m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION])],dnl
+ [m4_define([gd_PKG_VERSION],[gd_MAJOR.gd_MINOR.gd_REVISION-gd_EXTRA])]dnl
)dnl
AC_INIT([GD], gd_PKG_VERSION, [https://bitbucket.org/libgd/gd-libgd/issues], [libgd], [http://lib.gd])
@@ -25,10 +25,12 @@ GDLIB_MAJOR=gd_MAJOR
GDLIB_MINOR=gd_MINOR
GDLIB_REVISION=gd_REVISION
GDLIB_EXTRA=gd_EXTRA
+GDLIB_VERSION=gd_PKG_VERSION
AC_SUBST(GDLIB_MAJOR)
AC_SUBST(GDLIB_MINOR)
AC_SUBST(GDLIB_REVISION)
AC_SUBST(GDLIB_EXTRA)
+AC_SUBST(GDLIB_VERSION)
# Dynamic library version information
# See http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
@@ -455,6 +457,7 @@ AC_MSG_RESULT([
AC_CONFIG_FILES([Makefile
src/Makefile
+ src/gd.h
tests/Makefile
tests/test_config.h
config/Makefile
--- libgd2.orig/src/gd.h
+++ /dev/null
@@ -1,1113 +0,0 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef GD_H
-#define GD_H 1
-
-#define GD_MAJOR_VERSION 2
-#define GD_MINOR_VERSION 1
-#define GD_RELEASE_VERSION 0
-#define GD_EXTRA_VERSION "alpha"
-#define GD_VERSION_STRING "2.1.0-alpha"
-
-/* Do the DLL dance: dllexport when building the DLL,
- dllimport when importing from it, nothing when
- not on Silly Silly Windows (tm Aardman Productions). */
-
-/* 2.0.20: for headers */
-
-/* 2.0.24: __stdcall also needed for Visual BASIC
- and other languages. This breaks ABI compatibility
- with previous DLL revs, but it's necessary. */
-
-/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
- wish to build gd as a static library or by directly including
- the gd sources in a project. */
-
-/* http://gcc.gnu.org/wiki/Visibility */
-#if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
-# ifdef BGDWIN32
-# ifdef NONDLL
-# define BGD_EXPORT_DATA_PROT
-# else
-# ifdef __GNUC__
-# define BGD_EXPORT_DATA_PROT __attribute__ ((dllexport))
-# else
-# define BGD_EXPORT_DATA_PROT __declspec(dllexport)
-# endif
-# endif
-# else
-# ifdef __GNUC__
-# define BGD_EXPORT_DATA_PROT __attribute__ ((dllimport))
-# else
-# define BGD_EXPORT_DATA_PROT __declspec(dllimport)
-# endif
-# endif
-# define BGD_STDCALL __stdcall
-# define BGD_EXPORT_DATA_IMPL
-#else
-# ifdef HAVE_VISIBILITY
-# define BGD_EXPORT_DATA_PROT __attribute__ ((visibility ("default")))
-# define BGD_EXPORT_DATA_IMPL __attribute__ ((visibility ("hidden")))
-# else
-# define BGD_EXPORT_DATA_PROT
-# define BGD_EXPORT_DATA_IMPL
-# endif
-# define BGD_STDCALL
-#endif
-
-#define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL
-
-#ifdef __cplusplus
- extern "C"
- {
-#endif
-
-/* gd.h: declarations file for the graphic-draw module.
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation. This software is provided "AS IS." Thomas Boutell and
- * Boutell.Com, Inc. disclaim all warranties, either express or implied,
- * including but not limited to implied warranties of merchantability and
- * fitness for a particular purpose, with respect to this code and accompanying
- * documentation. */
-
-/* stdio is needed for file I/O. */
-#include <stdio.h>
-#include <stdarg.h>
-#include "gd_io.h"
-
-/* The maximum number of palette entries in palette-based images.
- In the wonderful new world of gd 2.0, you can of course have
- many more colors when using truecolor mode. */
-
-#define gdMaxColors 256
-
-/* Image type. See functions below; you will not need to change
- the elements directly. Use the provided macros to
- access sx, sy, the color table, and colorsTotal for
- read-only purposes. */
-
-/* If 'truecolor' is set true, the image is truecolor;
- pixels are represented by integers, which
- must be 32 bits wide or more.
-
- True colors are repsented as follows:
-
- ARGB
-
- Where 'A' (alpha channel) occupies only the
- LOWER 7 BITS of the MSB. This very small
- loss of alpha channel resolution allows gd 2.x
- to keep backwards compatibility by allowing
- signed integers to be used to represent colors,
- and negative numbers to represent special cases,
- just as in gd 1.x. */
-
-#define gdAlphaMax 127
-#define gdAlphaOpaque 0
-#define gdAlphaTransparent 127
-#define gdRedMax 255
-#define gdGreenMax 255
-#define gdBlueMax 255
-#define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
-#define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
-#define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
-#define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
-#define gdEffectReplace 0
-#define gdEffectAlphaBlend 1
-#define gdEffectNormal 2
-#define gdEffectOverlay 3
-
-#define GD_TRUE 1
-#define GD_FALSE 0
-
-#define GD_EPSILON 1e-6
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
-
-/* This function accepts truecolor pixel values only. The
- source color is composited with the destination color
- based on the alpha channel value of the source color.
- The resulting color is opaque. */
-
-BGD_DECLARE(int) gdAlphaBlend (int dest, int src);
-
-enum gdPaletteQuantizationMethod {
- GD_QUANT_DEFAULT = 0,
- GD_QUANT_JQUANT = 1, /* libjpeg's old median cut. Fast, but only uses 16-bit color. */
- GD_QUANT_NEUQUANT = 2, /* neuquant - approximation using kohonen neural network. */
- GD_QUANT_LIQ = 3 /* combination of algorithms used in libimagequant/pngquant2 aiming for highest quality at cost of speed */
-};
-
-/**
- * Group: Transform
- *
- * Constants: gdInterpolationMethod
-
- * GD_BELL - Bell
- * GD_BESSEL - Bessel
- * GD_BILINEAR_FIXED - fixed point bilinear
- * GD_BICUBIC - Bicubic
- * GD_BICUBIC_FIXED - fixed point bicubic integer
- * GD_BLACKMAN - Blackman
- * GD_BOX - Box
- * GD_BSPLINE - BSpline
- * GD_CATMULLROM - Catmullrom
- * GD_GAUSSIAN - Gaussian
- * GD_GENERALIZED_CUBIC - Generalized cubic
- * GD_HERMITE - Hermite
- * GD_HAMMING - Hamming
- * GD_HANNING - Hannig
- * GD_MITCHELL - Mitchell
- * GD_NEAREST_NEIGHBOUR - Nearest neighbour interpolation
- * GD_POWER - Power
- * GD_QUADRATIC - Quadratic
- * GD_SINC - Sinc
- * GD_TRIANGLE - Triangle
- * GD_WEIGHTED4 - 4 pixels weighted bilinear interpolation
- *
- * See also:
- * <gdSetInterpolationMethod>
- **/
-typedef enum {
- GD_DEFAULT = 0,
- GD_BELL,
- GD_BESSEL,
- GD_BILINEAR_FIXED,
- GD_BICUBIC,
- GD_BICUBIC_FIXED,
- GD_BLACKMAN,
- GD_BOX,
- GD_BSPLINE,
- GD_CATMULLROM,
- GD_GAUSSIAN,
- GD_GENERALIZED_CUBIC,
- GD_HERMITE,
- GD_HAMMING,
- GD_HANNING,
- GD_MITCHELL,
- GD_NEAREST_NEIGHBOUR,
- GD_POWER,
- GD_QUADRATIC,
- GD_SINC,
- GD_TRIANGLE,
- GD_WEIGHTED4,
- GD_METHOD_COUNT = 21
-} gdInterpolationMethod;
-
-/* define struct with name and func ptr and add it to gdImageStruct gdInterpolationMethod interpolation; */
-
-/* Interpolation function ptr */
-typedef double (* interpolation_method )(double);
-
-typedef struct gdImageStruct {
- /* Palette-based image pixels */
- unsigned char **pixels;
- int sx;
- int sy;
- /* These are valid in palette images only. See also
- 'alpha', which appears later in the structure to
- preserve binary backwards compatibility */
- int colorsTotal;
- int red[gdMaxColors];
- int green[gdMaxColors];
- int blue[gdMaxColors];
- int open[gdMaxColors];
- /* For backwards compatibility, this is set to the
- first palette entry with 100% transparency,
- and is also set and reset by the
- gdImageColorTransparent function. Newer
- applications can allocate palette entries
- with any desired level of transparency; however,
- bear in mind that many viewers, notably
- many web browsers, fail to implement
- full alpha channel for PNG and provide
- support for full opacity or transparency only. */
- int transparent;
- int *polyInts;
- int polyAllocated;
- struct gdImageStruct *brush;
- struct gdImageStruct *tile;
- int brushColorMap[gdMaxColors];
- int tileColorMap[gdMaxColors];
- int styleLength;
- int stylePos;
- int *style;
- int interlace;
- /* New in 2.0: thickness of line. Initialized to 1. */
- int thick;
- /* New in 2.0: alpha channel for palettes. Note that only
- Macintosh Internet Explorer and (possibly) Netscape 6
- really support multiple levels of transparency in
- palettes, to my knowledge, as of 2/15/01. Most
- common browsers will display 100% opaque and
- 100% transparent correctly, and do something
- unpredictable and/or undesirable for levels
- in between. TBB */
- int alpha[gdMaxColors];
- /* Truecolor flag and pixels. New 2.0 fields appear here at the
- end to minimize breakage of existing object code. */
- int trueColor;
- int **tpixels;
- /* Should alpha channel be copied, or applied, each time a
- pixel is drawn? This applies to truecolor images only.
- No attempt is made to alpha-blend in palette images,
- even if semitransparent palette entries exist.
- To do that, build your image as a truecolor image,
- then quantize down to 8 bits. */
- int alphaBlendingFlag;
- /* Should the alpha channel of the image be saved? This affects
- PNG at the moment; other future formats may also
- have that capability. JPEG doesn't. */
- int saveAlphaFlag;
-
- /* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this
- part of the structure can be safely changed in new releases. */
-
- /* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after
- switching to the fast, memory-cheap implementation from PHP-gd. */
- int AA;
- int AA_color;
- int AA_dont_blend;
-
- /* 2.0.12: simple clipping rectangle. These values
- must be checked for safety when set; please use
- gdImageSetClip */
- int cx1;
- int cy1;
- int cx2;
- int cy2;
-
- /* 2.1.0: allows to specify resolution in dpi */
- unsigned int res_x;
- unsigned int res_y;
-
- /* Selects quantization method, see gdImageTrueColorToPaletteSetMethod() and gdPaletteQuantizationMethod enum. */
- int paletteQuantizationMethod;
- /* speed/quality trade-off. 1 = best quality, 10 = best speed. 0 = method-specific default.
- Applicable to GD_QUANT_LIQ and GD_QUANT_NEUQUANT. */
- int paletteQuantizationSpeed;
- /* Image will remain true-color if conversion to palette cannot achieve given quality.
- Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
- int paletteQuantizationMinQuality;
- /* Image will use minimum number of palette colors needed to achieve given quality. Must be higher than paletteQuantizationMinQuality
- Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
- int paletteQuantizationMaxQuality;
- gdInterpolationMethod interpolation_id;
- interpolation_method interpolation;
-}
-gdImage;
-
-typedef gdImage *gdImagePtr;
-
-
-/* Point type for use in polygon drawing. */
-
-/**
- * Group: Types
- *
- * typedef: gdPointF
- * Defines a point in a 2D coordinate system using floating point
- * values.
- * x - Floating point position (increase from left to right)
- * y - Floating point Row position (increase from top to bottom)
- *
- * typedef: gdPointFPtr
- * Pointer to a <gdPointF>
- *
- * See also:
- * <gdImageCreate>, <gdImageCreateTrueColor>,
- **/
-typedef struct
-{
- double x, y;
-}
-gdPointF, *gdPointFPtr;
-
-typedef struct {
- /* # of characters in font */
- int nchars;
- /* First character is numbered... (usually 32 = space) */
- int offset;
- /* Character width and height */
- int w;
- int h;
- /* Font data; array of characters, one row after another.
- Easily included in code, also easily loaded from
- data files. */
- char *data;
-}
-gdFont;
-
-/* Text functions take these. */
-typedef gdFont *gdFontPtr;
-
-typedef void(*gdErrorMethod)(int, const char *, va_list);
-
-BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod);
-BGD_DECLARE(void) gdClearErrorMethod(void);
-
-/* For backwards compatibility only. Use gdImageSetStyle()
- for MUCH more flexible line drawing. Also see
- gdImageSetBrush(). */
-#define gdDashSize 4
-
-/* Special colors. */
-
-#define gdStyled (-2)
-#define gdBrushed (-3)
-#define gdStyledBrushed (-4)
-#define gdTiled (-5)
-
-/* NOT the same as the transparent color index.
- This is used in line styles only. */
-#define gdTransparent (-6)
-
-#define gdAntiAliased (-7)
-
-/* Functions to manipulate images. */
-
-/* Creates a palette-based image (up to 256 colors). */
-BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy);
-
-/* An alternate name for the above (2.0). */
-#define gdImageCreatePalette gdImageCreate
-
-/* Creates a truecolor image (millions of colors). */
-BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
-
-/* Creates an image from various file types. These functions
- return a palette or truecolor image based on the
- nature of the file being loaded. Truecolor PNG
- stays truecolor; palette PNG stays palette-based;
- JPEG is always truecolor. */
-BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data);
-
-/* These read the first frame only */
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGif (FILE * fd);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx (gdIOCtxPtr in);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr (int size, void *data);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP (FILE * inFile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx (gdIOCtx * infile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr (int size, void *data);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg (FILE * infile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegEx (FILE * infile, int ignore_warning);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx (gdIOCtx * infile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr (int size, void *data);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp (FILE * inFile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr (int size, void *data);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile);
-
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTiff(FILE *inFile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffCtx(gdIOCtx *infile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffPtr(int size, void *data);
-
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTga( FILE * fp );
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtx* ctx);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaPtr(int size, void *data);
-
-BGD_DECLARE(gdImagePtr) gdImageCreateFromBmp (FILE * inFile);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpPtr (int size, void *data);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpCtx (gdIOCtxPtr infile);
-
-/* A custom data source. */
-/* The source function must return -1 on error, otherwise the number
- of bytes fetched. 0 is EOF, not an error! */
-/* context will be passed to your source function. */
-
-typedef struct {
- int (*source) (void *context, char *buffer, int len);
- void *context;
-}
-gdSource, *gdSourcePtr;
-
-/* Deprecated in favor of gdImageCreateFromPngCtx */
-BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr in);
-
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd (FILE * in);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx (gdIOCtxPtr in);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr (int size, void *data);
-
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * in);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data);
-
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
- int h);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
- int w, int h);
-BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
- int w, int h);
-/* 2.0.10: prototype was missing */
-BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in);
-BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
-
-/* NOTE: filename, not FILE */
-BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename);
-
-BGD_DECLARE(void) gdImageDestroy (gdImagePtr im);
-
-/* Replaces or blends with the background depending on the
- most recent call to gdImageAlphaBlending and the
- alpha channel value of 'color'; default is to overwrite.
- Tiling and line styling are also implemented
- here. All other gd drawing functions pass through this call,
- allowing for many useful effects. */
-
-BGD_DECLARE(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color);
-/* FreeType 2 text output with hook to extra flags */
-
-BGD_DECLARE(int) gdImageGetPixel (gdImagePtr im, int x, int y);
-BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y);
-
-BGD_DECLARE(void) gdImageAABlend (gdImagePtr im);
-
-BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
-
-/* For backwards compatibility only. Use gdImageSetStyle()
- for much more flexible line drawing. */
-BGD_DECLARE(void) gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2,
- int color);
-/* Corners specified (not width and height). Upper left first, lower right
- second. */
-BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
- int color);
-/* Solid bar. Upper left corner first, lower right corner second. */
-BGD_DECLARE(void) gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
- int color);
-BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
-BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
-BGD_DECLARE(void) gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y);
-BGD_DECLARE(int) gdImageBoundsSafe (gdImagePtr im, int x, int y);
-BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c,
- int color);
-BGD_DECLARE(void) gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c,
- int color);
-BGD_DECLARE(void) gdImageString (gdImagePtr im, gdFontPtr f, int x, int y,
- unsigned char *s, int color);
-BGD_DECLARE(void) gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y,
- unsigned char *s, int color);
-BGD_DECLARE(void) gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y,
- unsigned short *s, int color);
-BGD_DECLARE(void) gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y,
- unsigned short *s, int color);
-
-/* 2.0.16: for thread-safe use of gdImageStringFT and friends,
- call this before allowing any thread to call gdImageStringFT.
- Otherwise it is invoked by the first thread to invoke
- gdImageStringFT, with a very small but real risk of a race condition.
- Return 0 on success, nonzero on failure to initialize freetype. */
-BGD_DECLARE(int) gdFontCacheSetup (void);
-
-/* Optional: clean up after application is done using fonts in
- gdImageStringFT(). */
-BGD_DECLARE(void) gdFontCacheShutdown (void);
-/* 2.0.20: for backwards compatibility. A few applications did start calling
- this function when it first appeared although it was never documented.
- Simply invokes gdFontCacheShutdown. */
-BGD_DECLARE(void) gdFreeFontCache (void);
-
-/* Calls gdImageStringFT. Provided for backwards compatibility only. */
-BGD_DECLARE(char *) gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y,
- char *string);
-
-/* FreeType 2 text output */
-BGD_DECLARE(char *) gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y,
- char *string);
-
-/* 2.0.5: provides an extensible way to pass additional parameters.
- Thanks to Wez Furlong, sorry for the delay. */
-
-typedef struct {
- int flags; /* Logical OR of gdFTEX_ values */
- double linespacing; /* fine tune line spacing for '\n' */
- int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode,
- gdFTEX_Shift_JIS, gdFTEX_Big5,
- or gdFTEX_Adobe_Custom;
- when not specified, maps are searched
- for in the above order. */
- int hdpi; /* if (flags & gdFTEX_RESOLUTION) */
- int vdpi; /* if (flags & gdFTEX_RESOLUTION) */
- char *xshow; /* if (flags & gdFTEX_XSHOW)
- then, on return, xshow is a malloc'ed
- string containing xshow position data for
- the last string.
-
- NB. The caller is responsible for gdFree'ing
- the xshow string.
- */
- char *fontpath; /* if (flags & gdFTEX_RETURNFONTPATHNAME)
- then, on return, fontpath is a malloc'ed
- string containing the actual font file path name
- used, which can be interesting when fontconfig
- is in use.
-
- The caller is responsible for gdFree'ing the
- fontpath string.
- */
-
-}
-gdFTStringExtra, *gdFTStringExtraPtr;
-
-#define gdFTEX_LINESPACE 1
-#define gdFTEX_CHARMAP 2
-#define gdFTEX_RESOLUTION 4
-#define gdFTEX_DISABLE_KERNING 8
-#define gdFTEX_XSHOW 16
-/* The default unless gdFTUseFontConfig(1); has been called:
- fontlist is a full or partial font file pathname or list thereof
- (i.e. just like before 2.0.29) */
-#define gdFTEX_FONTPATHNAME 32
-/* Necessary to use fontconfig patterns instead of font pathnames
- as the fontlist argument, unless gdFTUseFontConfig(1); has
- been called. New in 2.0.29 */
-#define gdFTEX_FONTCONFIG 64
-/* Sometimes interesting when fontconfig is used: the fontpath
- element of the structure above will contain a gdMalloc'd string
- copy of the actual font file pathname used, if this flag is set
- when the call is made */
-#define gdFTEX_RETURNFONTPATHNAME 128
-
-/* If flag is nonzero, the fontlist parameter to gdImageStringFT
- and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
- if fontconfig was compiled into gd. This function returns zero
- if fontconfig is not available, nonzero otherwise. */
-BGD_DECLARE(int) gdFTUseFontConfig(int flag);
-
-/* These are NOT flags; set one in 'charmap' if you set the
- gdFTEX_CHARMAP bit in 'flags'. */
-#define gdFTEX_Unicode 0
-#define gdFTEX_Shift_JIS 1
-#define gdFTEX_Big5 2
-#define gdFTEX_Adobe_Custom 3
-
-BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
- double ptsize, double angle, int x, int y,
- char *string, gdFTStringExtraPtr strex);
-
-/* Point type for use in polygon drawing. */
-typedef struct {
- int x, y;
-}
-gdPoint, *gdPointPtr;
-
-typedef struct {
- int x, y;
- int width, height;
-}
-gdRect, *gdRectPtr;
-
-
-BGD_DECLARE(void) gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c);
-BGD_DECLARE(void) gdImageOpenPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
-BGD_DECLARE(void) gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
-
-/* These functions still work with truecolor images,
- for which they never return error. */
-BGD_DECLARE(int) gdImageColorAllocate (gdImagePtr im, int r, int g, int b);
-/* gd 2.0: palette entries with non-opaque transparency are permitted. */
-BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a);
-/* Assumes opaque is the preferred alpha channel value */
-BGD_DECLARE(int) gdImageColorClosest (gdImagePtr im, int r, int g, int b);
-/* Closest match taking all four parameters into account.
- A slightly different color with the same transparency
- beats the exact same color with radically different
- transparency */
-BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a);
-/* An alternate method */
-BGD_DECLARE(int) gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b);
-/* Returns exact, 100% opaque matches only */
-BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b);
-/* Returns an exact match only, including alpha */
-BGD_DECLARE(int) gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a);
-/* Opaque only */
-BGD_DECLARE(int) gdImageColorResolve (gdImagePtr im, int r, int g, int b);
-/* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha */
-BGD_DECLARE(int) gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a);
-
-/* A simpler way to obtain an opaque truecolor value for drawing on a
- truecolor image. Not for use with palette images! */
-
-#define gdTrueColor(r, g, b) (((r) << 16) + \
- ((g) << 8) + \
- (b))
-
-/* Returns a truecolor value with an alpha channel component.
- gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
- opaque. */
-
-#define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
- ((r) << 16) + \
- ((g) << 8) + \
- (b))
-
-BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color);
-
-/* Converts a truecolor image to a palette-based image,
- using a high-quality two-pass quantization routine
- which attempts to preserve alpha channel information
- as well as R/G/B color information when creating
- a palette. If ditherFlag is set, the image will be
- dithered to approximate colors better, at the expense
- of some obvious "speckling." colorsWanted can be
- anything up to 256. If the original source image
- includes photographic information or anything that
- came out of a JPEG, 256 is strongly recommended.
-
- Better yet, don't use these function -- write real
- truecolor PNGs and JPEGs. The disk space gain of
- conversion to palette is not great (for small images
- it can be negative) and the quality loss is ugly.
-
- DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
- returns a new image. gdImageTrueColorToPalette modifies
- an existing image, and the truecolor pixels are discarded.
-
- gdImageTrueColorToPalette() returns TRUE on success, FALSE on failure.
-*/
-
-BGD_DECLARE(gdImagePtr) gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag,
- int colorsWanted);
-
-BGD_DECLARE(int) gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag,
- int colorsWanted);
-
-BGD_DECLARE(int) gdImagePaletteToTrueColor(gdImagePtr src);
-
-/* An attempt at getting the results of gdImageTrueColorToPalette to
- * look a bit more like the original (im1 is the original and im2 is
- * the palette version */
-
-BGD_DECLARE(int) gdImageColorMatch(gdImagePtr im1, gdImagePtr im2);
-
-/* Selects quantization method used for subsequent gdImageTrueColorToPalette calls.
- See gdPaletteQuantizationMethod enum (e.g. GD_QUANT_NEUQUANT, GD_QUANT_LIQ).
- Speed is from 1 (highest quality) to 10 (fastest).
- Speed 0 selects method-specific default (recommended).
-
- Returns FALSE if the given method is invalid or not available.
-*/
-BGD_DECLARE(int) gdImageTrueColorToPaletteSetMethod (gdImagePtr im, int method, int speed);
-
-/*
- Chooses quality range that subsequent call to gdImageTrueColorToPalette will aim for.
- Min and max quality is in range 1-100 (1 = ugly, 100 = perfect). Max must be higher than min.
- If palette cannot represent image with at least min_quality, then image will remain true-color.
- If palette can represent image with quality better than max_quality, then lower number of colors will be used.
- This function has effect only when GD_QUANT_LIQ method has been selected and the source image is true-color.
-*/
-BGD_DECLARE(void) gdImageTrueColorToPaletteSetQuality (gdImagePtr im, int min_quality, int max_quality);
-
-/* Specifies a color index (if a palette image) or an
- RGB color (if a truecolor image) which should be
- considered 100% transparent. FOR TRUECOLOR IMAGES,
- THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
- SAVED. Use gdImageSaveAlpha(im, 0); to
- turn off the saving of a full alpha channel in
- a truecolor image. Note that gdImageColorTransparent
- is usually compatible with older browsers that
- do not understand full alpha channels well. TBB */
-BGD_DECLARE(void) gdImageColorTransparent (gdImagePtr im, int color);
-
-BGD_DECLARE(void) gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src);
-
-typedef int (*gdCallbackImageColor)(gdImagePtr im, int src);
-
-BGD_DECLARE(int) gdImageColorReplace(gdImagePtr im, int src, int dst);
-BGD_DECLARE(int) gdImageColorReplaceThreshold(gdImagePtr im, int src, int dst, float threshold);
-BGD_DECLARE(int) gdImageColorReplaceArray(gdImagePtr im, int len, int *src, int *dst);
-BGD_DECLARE(int) gdImageColorReplaceCallback(gdImagePtr im, gdCallbackImageColor callback);
-
-BGD_DECLARE(void) gdImageGif (gdImagePtr im, FILE * out);
-BGD_DECLARE(void) gdImagePng (gdImagePtr im, FILE * out);
-BGD_DECLARE(void) gdImagePngCtx (gdImagePtr im, gdIOCtx * out);
-BGD_DECLARE(void) gdImageGifCtx (gdImagePtr im, gdIOCtx * out);
-BGD_DECLARE(void) gdImageTiff(gdImagePtr im, FILE *outFile);
-BGD_DECLARE(void *) gdImageTiffPtr(gdImagePtr im, int *size);
-BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out);
-
-BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression);
-BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression);
-BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
-
-/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
- 1 is FASTEST but produces larger files, 9 provides the best
- compression (smallest files) but takes a long time to compress, and
- -1 selects the default compiled into the zlib library. */
-BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level);
-BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
-
-BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out);
-BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
-
-/* Guaranteed to correctly free memory returned by the gdImage*Ptr
- functions */
-BGD_DECLARE(void) gdFree (void *m);
-
-/* Best to free this memory with gdFree(), not free() */
-BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg);
-
-/* 100 is highest quality (there is always a little loss with JPEG).
- 0 is lowest. 10 is about the lowest useful setting. */
-BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality);
-BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality);
-
-/* Best to free this memory with gdFree(), not free() */
-BGD_DECLARE(void *) gdImageJpegPtr (gdImagePtr im, int *size, int quality);
-
-BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization);
-BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile);
-BGD_DECLARE(void *) gdImageWebpPtr (gdImagePtr im, int *size);
-BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quantization);
-BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization);
-
-/* Legal values for Disposal. gdDisposalNone is always used by
- the built-in optimizer if previm is passed. */
-
-enum {
- gdDisposalUnknown,
- gdDisposalNone,
- gdDisposalRestoreBackground,
- gdDisposalRestorePrevious
-};
-
-BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
-BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
-BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile);
-BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtx *out, int GlobalCM, int Loops);
-BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
-BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtx *out);
-BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops);
-BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
-BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
-
-/* A custom data sink. For backwards compatibility. Use gdIOCtx
- instead. The sink function must return -1 on error, otherwise the
- number of bytes written, which must be equal to len. Context will
- be passed to your sink function.
-*/
-typedef struct {
- int (*sink) (void *context, const char *buffer, int len);
- void *context;
-}
-gdSink, *gdSinkPtr;
-
-BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
-
-BGD_DECLARE(void) gdImageGd (gdImagePtr im, FILE * out);
-BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * out, int cs, int fmt);
-
-/* Best to free this memory with gdFree(), not free() */
-BGD_DECLARE(void *) gdImageGifPtr (gdImagePtr im, int *size);
-
-/* Best to free this memory with gdFree(), not free() */
-BGD_DECLARE(void *) gdImagePngPtr (gdImagePtr im, int *size);
-BGD_DECLARE(void *) gdImagePngPtrEx (gdImagePtr im, int *size, int level);
-
-/* Best to free this memory with gdFree(), not free() */
-BGD_DECLARE(void *) gdImageGdPtr (gdImagePtr im, int *size);
-
-/* Best to free this memory with gdFree(), not free() */
-BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size);
-
-/* Style is a bitwise OR ( | operator ) of these.
- gdArc and gdChord are mutually exclusive;
- gdChord just connects the starting and ending
- angles with a straight line, while gdArc produces
- a rounded edge. gdPie is a synonym for gdArc.
- gdNoFill indicates that the arc or chord should be
- outlined, not filled. gdEdged, used together with
- gdNoFill, indicates that the beginning and ending
- angles should be connected to the center; this is
- a good way to outline (rather than fill) a
- 'pie slice'. */
-#define gdArc 0
-#define gdPie gdArc
-#define gdChord 1
-#define gdNoFill 2
-#define gdEdged 4
-
-BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s,
- int e, int color, int style);
-BGD_DECLARE(void) gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e,
- int color);
-BGD_DECLARE(void) gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
-BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h,
- int color);
-BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border,
- int color);
-BGD_DECLARE(void) gdImageFill (gdImagePtr im, int x, int y, int color);
-BGD_DECLARE(void) gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
- int srcX, int srcY, int w, int h);
-BGD_DECLARE(void) gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
- int srcX, int srcY, int w, int h, int pct);
-BGD_DECLARE(void) gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX,
- int dstY, int srcX, int srcY, int w, int h,
- int pct);
-
-/* Stretches or shrinks to fit, as needed. Does NOT attempt
- to average the entire set of source pixels that scale down onto the
- destination pixel. */
-BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
- int srcX, int srcY, int dstW, int dstH, int srcW,
- int srcH);
-
-/* gd 2.0: stretches or shrinks to fit, as needed. When called with a
- truecolor destination image, this function averages the
- entire set of source pixels that scale down onto the
- destination pixel, taking into account what portion of the
- destination pixel each source pixel represents. This is a
- floating point operation, but this is not a performance issue
- on modern hardware, except for some embedded devices. If the
- destination is a palette image, gdImageCopyResized is
- substituted automatically. */
-BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX,
- int dstY, int srcX, int srcY, int dstW, int dstH,
- int srcW, int srcH);
-
-/* gd 2.0.8: gdImageCopyRotated is added. Source
- is a rectangle, with its upper left corner at
- srcX and srcY. Destination is the *center* of
- the rotated copy. Angle is in degrees, same as
- gdImageArc. Floating point destination center
- coordinates allow accurate rotation of
- objects of odd-numbered width or height. */
-BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst,
- gdImagePtr src,
- double dstX, double dstY,
- int srcX, int srcY,
- int srcWidth, int srcHeight, int angle);
-
-BGD_DECLARE(gdImagePtr) gdImageClone (gdImagePtr src);
-
-BGD_DECLARE(void) gdImageSetBrush (gdImagePtr im, gdImagePtr brush);
-BGD_DECLARE(void) gdImageSetTile (gdImagePtr im, gdImagePtr tile);
-BGD_DECLARE(void) gdImageSetAntiAliased (gdImagePtr im, int c);
-BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend);
-BGD_DECLARE(void) gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels);
-/* Line thickness (defaults to 1). Affects lines, ellipses,
- rectangles, polygons and so forth. */
-BGD_DECLARE(void) gdImageSetThickness (gdImagePtr im, int thickness);
-/* On or off (1 or 0) for all three of these. */
-BGD_DECLARE(void) gdImageInterlace (gdImagePtr im, int interlaceArg);
-BGD_DECLARE(void) gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg);
-BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg);
-
-BGD_DECLARE(gdImagePtr) gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor);
-
-enum gdPixelateMode {
- GD_PIXELATE_UPPERLEFT,
- GD_PIXELATE_AVERAGE
-};
-
-BGD_DECLARE(int) gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode);
-
-typedef struct {
- int sub;
- int plus;
- unsigned int num_colors;
- int *colors;
- unsigned int seed;
-} gdScatter, *gdScatterPtr;
-
-BGD_DECLARE(int) gdImageScatter(gdImagePtr im, int sub, int plus);
-BGD_DECLARE(int) gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors);
-BGD_DECLARE(int) gdImageScatterEx(gdImagePtr im, gdScatterPtr s);
-BGD_DECLARE(int) gdImageSmooth(gdImagePtr im, float weight);
-BGD_DECLARE(int) gdImageMeanRemoval(gdImagePtr im);
-BGD_DECLARE(int) gdImageEmboss(gdImagePtr im);
-BGD_DECLARE(int) gdImageGaussianBlur(gdImagePtr im);
-BGD_DECLARE(int) gdImageEdgeDetectQuick(gdImagePtr src);
-BGD_DECLARE(int) gdImageSelectiveBlur( gdImagePtr src);
-BGD_DECLARE(int) gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, float offset);
-BGD_DECLARE(int) gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
-BGD_DECLARE(int) gdImageContrast(gdImagePtr src, double contrast);
-BGD_DECLARE(int) gdImageBrightness(gdImagePtr src, int brightness);
-BGD_DECLARE(int) gdImageGrayScale(gdImagePtr src);
-BGD_DECLARE(int) gdImageNegate(gdImagePtr src);
-
-/* Macros to access information about images. */
-
-/* Returns nonzero if the image is a truecolor image,
- zero for a palette image. */
-#define gdImageTrueColor(im) ((im)->trueColor)
-
-#define gdImageSX(im) ((im)->sx)
-#define gdImageSY(im) ((im)->sy)
-#define gdImageColorsTotal(im) ((im)->colorsTotal)
-#define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
- (im)->red[(c)])
-#define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
- (im)->green[(c)])
-#define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
- (im)->blue[(c)])
-#define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
- (im)->alpha[(c)])
-#define gdImageGetTransparent(im) ((im)->transparent)
-#define gdImageGetInterlaced(im) ((im)->interlace)
-
-/* These macros provide direct access to pixels in
- palette-based and truecolor images, respectively.
- If you use these macros, you must perform your own
- bounds checking. Use of the macro for the correct type
- of image is also your responsibility. */
-#define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
-#define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
-
-#define gdImageResolutionX(im) (im)->res_x
-#define gdImageResolutionY(im) (im)->res_y
-
-/* I/O Support routines. */
-
-BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *);
-/* If data is null, size is ignored and an initial data buffer is
- allocated automatically. NOTE: this function assumes gd has the right
- to free or reallocate "data" at will! Also note that gd will free
- "data" when the IO context is freed. If data is not null, it must point
- to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
- If not, see gdNewDynamicCtxEx for an alternative. */
-BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
-/* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
- needed as described above. If freeFlag is zero, gd will never free
- or reallocate "data", which means that the context should only be used
- for *reading* an image from a memory buffer, or writing an image to a
- memory buffer which is already large enough. If the memory buffer is
- not large enough and an image write is attempted, the write operation
- will fail. Those wishing to write an image to a buffer in memory have
- a much simpler alternative in the gdImage[something]Ptr functions. */
-BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag);
-BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
-BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size);
-
-#define GD2_CHUNKSIZE 128
-#define GD2_CHUNKSIZE_MIN 64
-#define GD2_CHUNKSIZE_MAX 4096
-
-#define GD2_VERS 2
-#define GD2_ID "gd2"
-
-#define GD2_FMT_RAW 1
-#define GD2_FMT_COMPRESSED 2
-
-/* Image comparison definitions */
-BGD_DECLARE(int) gdImageCompare (gdImagePtr im1, gdImagePtr im2);
-
-BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im);
-BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im);
-BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im);
-
-#define GD_FLIP_HORINZONTAL 1
-#define GD_FLIP_VERTICAL 2
-#define GD_FLIP_BOTH 3
-
-/**
- * Group: Crop
- *
- * Constants: gdCropMode
- * GD_CROP_DEFAULT - Default crop mode (4 corners or background)
- * GD_CROP_TRANSPARENT - Crop using the transparent color
- * GD_CROP_BLACK - Crop black borders
- * GD_CROP_WHITE - Crop white borders
- * GD_CROP_SIDES - Crop using colors of the 4 corners
- *
- * See also:
- * <gdImageAutoCrop>
- **/
-enum gdCropMode {
- GD_CROP_DEFAULT = 0,
- GD_CROP_TRANSPARENT,
- GD_CROP_BLACK,
- GD_CROP_WHITE,
- GD_CROP_SIDES,
- GD_CROP_THRESHOLD
-};
-
-BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop);
-BGD_DECLARE(gdImagePtr) gdImageCropAuto(gdImagePtr im, const unsigned int mode);
-BGD_DECLARE(gdImagePtr) gdImageCropThreshold(gdImagePtr im, const unsigned int color, const float threshold);
-
-BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id);
-
-gdImagePtr gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, const unsigned int new_height);
-gdImagePtr gdImageScaleBicubic(gdImagePtr src_img, const unsigned int new_width, const unsigned int new_height);
-gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height);
-gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height);
-gdImagePtr gdImageScaleTwoPass(const gdImagePtr pOrigImage, const unsigned int uOrigWidth, const unsigned int uOrigHeight, const unsigned int uNewWidth, const unsigned int uNewHeight);
-BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height);
-
-gdImagePtr gdImageRotate90(gdImagePtr src, int ignoretransparent);
-gdImagePtr gdImageRotate180(gdImagePtr src, int ignoretransparent);
-gdImagePtr gdImageRotate270(gdImagePtr src, int ignoretransparent);
-gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgColor);
-gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor);
-gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor);
-gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor);
-BGD_DECLARE(gdImagePtr) gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
-
-typedef enum {
- GD_AFFINE_TRANSLATE = 0,
- GD_AFFINE_SCALE,
- GD_AFFINE_ROTATE,
- GD_AFFINE_SHEAR_HORIZONTAL,
- GD_AFFINE_SHEAR_VERTICAL
-} gdAffineStandardMatrix;
-
-BGD_DECLARE(int) gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src, const double affine[6]);
-BGD_DECLARE(int) gdAffineInvert (double dst[6], const double src[6]);
-BGD_DECLARE(int) gdAffineFlip (double dst_affine[6], const double src_affine[6], const int flip_h, const int flip_v);
-BGD_DECLARE(int) gdAffineConcat (double dst[6], const double m1[6], const double m2[6]);
-
-BGD_DECLARE(int) gdAffineIdentity (double dst[6]);
-BGD_DECLARE(int) gdAffineScale (double dst[6], const double scale_x, const double scale_y);
-BGD_DECLARE(int) gdAffineRotate (double dst[6], const double angle);
-BGD_DECLARE(int) gdAffineShearHorizontal (double dst[6], const double angle);
-BGD_DECLARE(int) gdAffineShearVertical(double dst[6], const double angle);
-BGD_DECLARE(int) gdAffineTranslate (double dst[6], const double offset_x, const double offset_y);
-BGD_DECLARE(double) gdAffineExpansion (const double src[6]);
-BGD_DECLARE(int) gdAffineRectilinear (const double src[6]);
-BGD_DECLARE(int) gdAffineEqual (const double matrix1[6], const double matrix2[6]);
-BGD_DECLARE(int) gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]);
-BGD_DECLARE(int) gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]);
-/*
-gdTransformAffineCopy(gdImagePtr dst, int x0, int y0, int x1, int y1,
- const gdImagePtr src, int src_width, int src_height,
- const double affine[6]);
-*/
-BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox);
-
-#define GD_CMP_IMAGE 1 /* Actual image IS different */
-#define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */
-#define GD_CMP_COLOR 4 /* Image colours differ */
-#define GD_CMP_SIZE_X 8 /* Image width differs */
-#define GD_CMP_SIZE_Y 16 /* Image heights differ */
-#define GD_CMP_TRANSPARENT 32 /* Transparent colour */
-#define GD_CMP_BACKGROUND 64 /* Background colour */
-#define GD_CMP_INTERLACE 128 /* Interlaced setting */
-#define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */
-
-/* resolution affects ttf font rendering, particularly hinting */
-#define GD_RESOLUTION 96 /* pixels per inch */
-
-#ifdef __cplusplus
-}
-#endif
-
-/* newfangled special effects */
-#include "gdfx.h"
-
-#endif /* GD_H */
-
-#ifdef __cplusplus
-}
-#endif
--- /dev/null
+++ libgd2/src/gd.h.in
@@ -0,0 +1,1113 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef GD_H
+#define GD_H 1
+
+#define GD_MAJOR_VERSION @GDLIB_MAJOR@
+#define GD_MINOR_VERSION @GDLIB_MINOR@
+#define GD_RELEASE_VERSION @GDLIB_REVISION@
+#define GD_EXTRA_VERSION "@GDLIB_EXTRA@"
+#define GD_VERSION_STRING "@GDLIB_VERSION@"
+
+/* Do the DLL dance: dllexport when building the DLL,
+ dllimport when importing from it, nothing when
+ not on Silly Silly Windows (tm Aardman Productions). */
+
+/* 2.0.20: for headers */
+
+/* 2.0.24: __stdcall also needed for Visual BASIC
+ and other languages. This breaks ABI compatibility
+ with previous DLL revs, but it's necessary. */
+
+/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they
+ wish to build gd as a static library or by directly including
+ the gd sources in a project. */
+
+/* http://gcc.gnu.org/wiki/Visibility */
+#if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE)
+# ifdef BGDWIN32
+# ifdef NONDLL
+# define BGD_EXPORT_DATA_PROT
+# else
+# ifdef __GNUC__
+# define BGD_EXPORT_DATA_PROT __attribute__ ((dllexport))
+# else
+# define BGD_EXPORT_DATA_PROT __declspec(dllexport)
+# endif
+# endif
+# else
+# ifdef __GNUC__
+# define BGD_EXPORT_DATA_PROT __attribute__ ((dllimport))
+# else
+# define BGD_EXPORT_DATA_PROT __declspec(dllimport)
+# endif
+# endif
+# define BGD_STDCALL __stdcall
+# define BGD_EXPORT_DATA_IMPL
+#else
+# ifdef HAVE_VISIBILITY
+# define BGD_EXPORT_DATA_PROT __attribute__ ((visibility ("default")))
+# define BGD_EXPORT_DATA_IMPL __attribute__ ((visibility ("hidden")))
+# else
+# define BGD_EXPORT_DATA_PROT
+# define BGD_EXPORT_DATA_IMPL
+# endif
+# define BGD_STDCALL
+#endif
+
+#define BGD_DECLARE(rt) BGD_EXPORT_DATA_PROT rt BGD_STDCALL
+
+#ifdef __cplusplus
+ extern "C"
+ {
+#endif
+
+/* gd.h: declarations file for the graphic-draw module.
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation. This software is provided "AS IS." Thomas Boutell and
+ * Boutell.Com, Inc. disclaim all warranties, either express or implied,
+ * including but not limited to implied warranties of merchantability and
+ * fitness for a particular purpose, with respect to this code and accompanying
+ * documentation. */
+
+/* stdio is needed for file I/O. */
+#include <stdio.h>
+#include <stdarg.h>
+#include "gd_io.h"
+
+/* The maximum number of palette entries in palette-based images.
+ In the wonderful new world of gd 2.0, you can of course have
+ many more colors when using truecolor mode. */
+
+#define gdMaxColors 256
+
+/* Image type. See functions below; you will not need to change
+ the elements directly. Use the provided macros to
+ access sx, sy, the color table, and colorsTotal for
+ read-only purposes. */
+
+/* If 'truecolor' is set true, the image is truecolor;
+ pixels are represented by integers, which
+ must be 32 bits wide or more.
+
+ True colors are repsented as follows:
+
+ ARGB
+
+ Where 'A' (alpha channel) occupies only the
+ LOWER 7 BITS of the MSB. This very small
+ loss of alpha channel resolution allows gd 2.x
+ to keep backwards compatibility by allowing
+ signed integers to be used to represent colors,
+ and negative numbers to represent special cases,
+ just as in gd 1.x. */
+
+#define gdAlphaMax 127
+#define gdAlphaOpaque 0
+#define gdAlphaTransparent 127
+#define gdRedMax 255
+#define gdGreenMax 255
+#define gdBlueMax 255
+#define gdTrueColorGetAlpha(c) (((c) & 0x7F000000) >> 24)
+#define gdTrueColorGetRed(c) (((c) & 0xFF0000) >> 16)
+#define gdTrueColorGetGreen(c) (((c) & 0x00FF00) >> 8)
+#define gdTrueColorGetBlue(c) ((c) & 0x0000FF)
+#define gdEffectReplace 0
+#define gdEffectAlphaBlend 1
+#define gdEffectNormal 2
+#define gdEffectOverlay 3
+
+#define GD_TRUE 1
+#define GD_FALSE 0
+
+#define GD_EPSILON 1e-6
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+
+/* This function accepts truecolor pixel values only. The
+ source color is composited with the destination color
+ based on the alpha channel value of the source color.
+ The resulting color is opaque. */
+
+BGD_DECLARE(int) gdAlphaBlend (int dest, int src);
+
+enum gdPaletteQuantizationMethod {
+ GD_QUANT_DEFAULT = 0,
+ GD_QUANT_JQUANT = 1, /* libjpeg's old median cut. Fast, but only uses 16-bit color. */
+ GD_QUANT_NEUQUANT = 2, /* neuquant - approximation using kohonen neural network. */
+ GD_QUANT_LIQ = 3 /* combination of algorithms used in libimagequant/pngquant2 aiming for highest quality at cost of speed */
+};
+
+/**
+ * Group: Transform
+ *
+ * Constants: gdInterpolationMethod
+
+ * GD_BELL - Bell
+ * GD_BESSEL - Bessel
+ * GD_BILINEAR_FIXED - fixed point bilinear
+ * GD_BICUBIC - Bicubic
+ * GD_BICUBIC_FIXED - fixed point bicubic integer
+ * GD_BLACKMAN - Blackman
+ * GD_BOX - Box
+ * GD_BSPLINE - BSpline
+ * GD_CATMULLROM - Catmullrom
+ * GD_GAUSSIAN - Gaussian
+ * GD_GENERALIZED_CUBIC - Generalized cubic
+ * GD_HERMITE - Hermite
+ * GD_HAMMING - Hamming
+ * GD_HANNING - Hannig
+ * GD_MITCHELL - Mitchell
+ * GD_NEAREST_NEIGHBOUR - Nearest neighbour interpolation
+ * GD_POWER - Power
+ * GD_QUADRATIC - Quadratic
+ * GD_SINC - Sinc
+ * GD_TRIANGLE - Triangle
+ * GD_WEIGHTED4 - 4 pixels weighted bilinear interpolation
+ *
+ * See also:
+ * <gdSetInterpolationMethod>
+ **/
+typedef enum {
+ GD_DEFAULT = 0,
+ GD_BELL,
+ GD_BESSEL,
+ GD_BILINEAR_FIXED,
+ GD_BICUBIC,
+ GD_BICUBIC_FIXED,
+ GD_BLACKMAN,
+ GD_BOX,
+ GD_BSPLINE,
+ GD_CATMULLROM,
+ GD_GAUSSIAN,
+ GD_GENERALIZED_CUBIC,
+ GD_HERMITE,
+ GD_HAMMING,
+ GD_HANNING,
+ GD_MITCHELL,
+ GD_NEAREST_NEIGHBOUR,
+ GD_POWER,
+ GD_QUADRATIC,
+ GD_SINC,
+ GD_TRIANGLE,
+ GD_WEIGHTED4,
+ GD_METHOD_COUNT = 21
+} gdInterpolationMethod;
+
+/* define struct with name and func ptr and add it to gdImageStruct gdInterpolationMethod interpolation; */
+
+/* Interpolation function ptr */
+typedef double (* interpolation_method )(double);
+
+typedef struct gdImageStruct {
+ /* Palette-based image pixels */
+ unsigned char **pixels;
+ int sx;
+ int sy;
+ /* These are valid in palette images only. See also
+ 'alpha', which appears later in the structure to
+ preserve binary backwards compatibility */
+ int colorsTotal;
+ int red[gdMaxColors];
+ int green[gdMaxColors];
+ int blue[gdMaxColors];
+ int open[gdMaxColors];
+ /* For backwards compatibility, this is set to the
+ first palette entry with 100% transparency,
+ and is also set and reset by the
+ gdImageColorTransparent function. Newer
+ applications can allocate palette entries
+ with any desired level of transparency; however,
+ bear in mind that many viewers, notably
+ many web browsers, fail to implement
+ full alpha channel for PNG and provide
+ support for full opacity or transparency only. */
+ int transparent;
+ int *polyInts;
+ int polyAllocated;
+ struct gdImageStruct *brush;
+ struct gdImageStruct *tile;
+ int brushColorMap[gdMaxColors];
+ int tileColorMap[gdMaxColors];
+ int styleLength;
+ int stylePos;
+ int *style;
+ int interlace;
+ /* New in 2.0: thickness of line. Initialized to 1. */
+ int thick;
+ /* New in 2.0: alpha channel for palettes. Note that only
+ Macintosh Internet Explorer and (possibly) Netscape 6
+ really support multiple levels of transparency in
+ palettes, to my knowledge, as of 2/15/01. Most
+ common browsers will display 100% opaque and
+ 100% transparent correctly, and do something
+ unpredictable and/or undesirable for levels
+ in between. TBB */
+ int alpha[gdMaxColors];
+ /* Truecolor flag and pixels. New 2.0 fields appear here at the
+ end to minimize breakage of existing object code. */
+ int trueColor;
+ int **tpixels;
+ /* Should alpha channel be copied, or applied, each time a
+ pixel is drawn? This applies to truecolor images only.
+ No attempt is made to alpha-blend in palette images,
+ even if semitransparent palette entries exist.
+ To do that, build your image as a truecolor image,
+ then quantize down to 8 bits. */
+ int alphaBlendingFlag;
+ /* Should the alpha channel of the image be saved? This affects
+ PNG at the moment; other future formats may also
+ have that capability. JPEG doesn't. */
+ int saveAlphaFlag;
+
+ /* There should NEVER BE ACCESSOR MACROS FOR ITEMS BELOW HERE, so this
+ part of the structure can be safely changed in new releases. */
+
+ /* 2.0.12: anti-aliased globals. 2.0.26: just a few vestiges after
+ switching to the fast, memory-cheap implementation from PHP-gd. */
+ int AA;
+ int AA_color;
+ int AA_dont_blend;
+
+ /* 2.0.12: simple clipping rectangle. These values
+ must be checked for safety when set; please use
+ gdImageSetClip */
+ int cx1;
+ int cy1;
+ int cx2;
+ int cy2;
+
+ /* 2.1.0: allows to specify resolution in dpi */
+ unsigned int res_x;
+ unsigned int res_y;
+
+ /* Selects quantization method, see gdImageTrueColorToPaletteSetMethod() and gdPaletteQuantizationMethod enum. */
+ int paletteQuantizationMethod;
+ /* speed/quality trade-off. 1 = best quality, 10 = best speed. 0 = method-specific default.
+ Applicable to GD_QUANT_LIQ and GD_QUANT_NEUQUANT. */
+ int paletteQuantizationSpeed;
+ /* Image will remain true-color if conversion to palette cannot achieve given quality.
+ Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
+ int paletteQuantizationMinQuality;
+ /* Image will use minimum number of palette colors needed to achieve given quality. Must be higher than paletteQuantizationMinQuality
+ Value from 1 to 100, 1 = ugly, 100 = perfect. Applicable to GD_QUANT_LIQ.*/
+ int paletteQuantizationMaxQuality;
+ gdInterpolationMethod interpolation_id;
+ interpolation_method interpolation;
+}
+gdImage;
+
+typedef gdImage *gdImagePtr;
+
+
+/* Point type for use in polygon drawing. */
+
+/**
+ * Group: Types
+ *
+ * typedef: gdPointF
+ * Defines a point in a 2D coordinate system using floating point
+ * values.
+ * x - Floating point position (increase from left to right)
+ * y - Floating point Row position (increase from top to bottom)
+ *
+ * typedef: gdPointFPtr
+ * Pointer to a <gdPointF>
+ *
+ * See also:
+ * <gdImageCreate>, <gdImageCreateTrueColor>,
+ **/
+typedef struct
+{
+ double x, y;
+}
+gdPointF, *gdPointFPtr;
+
+typedef struct {
+ /* # of characters in font */
+ int nchars;
+ /* First character is numbered... (usually 32 = space) */
+ int offset;
+ /* Character width and height */
+ int w;
+ int h;
+ /* Font data; array of characters, one row after another.
+ Easily included in code, also easily loaded from
+ data files. */
+ char *data;
+}
+gdFont;
+
+/* Text functions take these. */
+typedef gdFont *gdFontPtr;
+
+typedef void(*gdErrorMethod)(int, const char *, va_list);
+
+BGD_DECLARE(void) gdSetErrorMethod(gdErrorMethod);
+BGD_DECLARE(void) gdClearErrorMethod(void);
+
+/* For backwards compatibility only. Use gdImageSetStyle()
+ for MUCH more flexible line drawing. Also see
+ gdImageSetBrush(). */
+#define gdDashSize 4
+
+/* Special colors. */
+
+#define gdStyled (-2)
+#define gdBrushed (-3)
+#define gdStyledBrushed (-4)
+#define gdTiled (-5)
+
+/* NOT the same as the transparent color index.
+ This is used in line styles only. */
+#define gdTransparent (-6)
+
+#define gdAntiAliased (-7)
+
+/* Functions to manipulate images. */
+
+/* Creates a palette-based image (up to 256 colors). */
+BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy);
+
+/* An alternate name for the above (2.0). */
+#define gdImageCreatePalette gdImageCreate
+
+/* Creates a truecolor image (millions of colors). */
+BGD_DECLARE(gdImagePtr) gdImageCreateTrueColor (int sx, int sy);
+
+/* Creates an image from various file types. These functions
+ return a palette or truecolor image based on the
+ nature of the file being loaded. Truecolor PNG
+ stays truecolor; palette PNG stays palette-based;
+ JPEG is always truecolor. */
+BGD_DECLARE(gdImagePtr) gdImageCreateFromPng (FILE * fd);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromPngCtx (gdIOCtxPtr in);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromPngPtr (int size, void *data);
+
+/* These read the first frame only */
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGif (FILE * fd);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx (gdIOCtxPtr in);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGifPtr (int size, void *data);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMP (FILE * inFile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPCtx (gdIOCtx * infile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromWBMPPtr (int size, void *data);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromJpeg (FILE * infile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegEx (FILE * infile, int ignore_warning);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx (gdIOCtx * infile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtxEx (gdIOCtx * infile, int ignore_warning);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtr (int size, void *data);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegPtrEx (int size, void *data, int ignore_warning);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromWebp (FILE * inFile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpPtr (int size, void *data);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromWebpCtx (gdIOCtx * infile);
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTiff(FILE *inFile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffCtx(gdIOCtx *infile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffPtr(int size, void *data);
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTga( FILE * fp );
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaCtx(gdIOCtx* ctx);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromTgaPtr(int size, void *data);
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromBmp (FILE * inFile);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpPtr (int size, void *data);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromBmpCtx (gdIOCtxPtr infile);
+
+/* A custom data source. */
+/* The source function must return -1 on error, otherwise the number
+ of bytes fetched. 0 is EOF, not an error! */
+/* context will be passed to your source function. */
+
+typedef struct {
+ int (*source) (void *context, char *buffer, int len);
+ void *context;
+}
+gdSource, *gdSourcePtr;
+
+/* Deprecated in favor of gdImageCreateFromPngCtx */
+BGD_DECLARE(gdImagePtr) gdImageCreateFromPngSource (gdSourcePtr in);
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd (FILE * in);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGdCtx (gdIOCtxPtr in);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGdPtr (int size, void *data);
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * in);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data);
+
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * in, int srcx, int srcy, int w,
+ int h);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtxPtr in, int srcx, int srcy,
+ int w, int h);
+BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy,
+ int w, int h);
+/* 2.0.10: prototype was missing */
+BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm (FILE * in);
+BGD_DECLARE(void) gdImageXbmCtx(gdImagePtr image, char* file_name, int fg, gdIOCtx * out);
+
+/* NOTE: filename, not FILE */
+BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm (char *filename);
+
+BGD_DECLARE(void) gdImageDestroy (gdImagePtr im);
+
+/* Replaces or blends with the background depending on the
+ most recent call to gdImageAlphaBlending and the
+ alpha channel value of 'color'; default is to overwrite.
+ Tiling and line styling are also implemented
+ here. All other gd drawing functions pass through this call,
+ allowing for many useful effects. */
+
+BGD_DECLARE(void) gdImageSetPixel (gdImagePtr im, int x, int y, int color);
+/* FreeType 2 text output with hook to extra flags */
+
+BGD_DECLARE(int) gdImageGetPixel (gdImagePtr im, int x, int y);
+BGD_DECLARE(int) gdImageGetTrueColorPixel (gdImagePtr im, int x, int y);
+
+BGD_DECLARE(void) gdImageAABlend (gdImagePtr im);
+
+BGD_DECLARE(void) gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
+
+/* For backwards compatibility only. Use gdImageSetStyle()
+ for much more flexible line drawing. */
+BGD_DECLARE(void) gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2,
+ int color);
+/* Corners specified (not width and height). Upper left first, lower right
+ second. */
+BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
+ int color);
+/* Solid bar. Upper left corner first, lower right corner second. */
+BGD_DECLARE(void) gdImageFilledRectangle (gdImagePtr im, int x1, int y1, int x2, int y2,
+ int color);
+BGD_DECLARE(void) gdImageSetClip(gdImagePtr im, int x1, int y1, int x2, int y2);
+BGD_DECLARE(void) gdImageGetClip(gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P);
+BGD_DECLARE(void) gdImageSetResolution(gdImagePtr im, const unsigned int res_x, const unsigned int res_y);
+BGD_DECLARE(int) gdImageBoundsSafe (gdImagePtr im, int x, int y);
+BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c,
+ int color);
+BGD_DECLARE(void) gdImageCharUp (gdImagePtr im, gdFontPtr f, int x, int y, int c,
+ int color);
+BGD_DECLARE(void) gdImageString (gdImagePtr im, gdFontPtr f, int x, int y,
+ unsigned char *s, int color);
+BGD_DECLARE(void) gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y,
+ unsigned char *s, int color);
+BGD_DECLARE(void) gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y,
+ unsigned short *s, int color);
+BGD_DECLARE(void) gdImageStringUp16 (gdImagePtr im, gdFontPtr f, int x, int y,
+ unsigned short *s, int color);
+
+/* 2.0.16: for thread-safe use of gdImageStringFT and friends,
+ call this before allowing any thread to call gdImageStringFT.
+ Otherwise it is invoked by the first thread to invoke
+ gdImageStringFT, with a very small but real risk of a race condition.
+ Return 0 on success, nonzero on failure to initialize freetype. */
+BGD_DECLARE(int) gdFontCacheSetup (void);
+
+/* Optional: clean up after application is done using fonts in
+ gdImageStringFT(). */
+BGD_DECLARE(void) gdFontCacheShutdown (void);
+/* 2.0.20: for backwards compatibility. A few applications did start calling
+ this function when it first appeared although it was never documented.
+ Simply invokes gdFontCacheShutdown. */
+BGD_DECLARE(void) gdFreeFontCache (void);
+
+/* Calls gdImageStringFT. Provided for backwards compatibility only. */
+BGD_DECLARE(char *) gdImageStringTTF (gdImage * im, int *brect, int fg, char *fontlist,
+ double ptsize, double angle, int x, int y,
+ char *string);
+
+/* FreeType 2 text output */
+BGD_DECLARE(char *) gdImageStringFT (gdImage * im, int *brect, int fg, char *fontlist,
+ double ptsize, double angle, int x, int y,
+ char *string);
+
+/* 2.0.5: provides an extensible way to pass additional parameters.
+ Thanks to Wez Furlong, sorry for the delay. */
+
+typedef struct {
+ int flags; /* Logical OR of gdFTEX_ values */
+ double linespacing; /* fine tune line spacing for '\n' */
+ int charmap; /* TBB: 2.0.12: may be gdFTEX_Unicode,
+ gdFTEX_Shift_JIS, gdFTEX_Big5,
+ or gdFTEX_Adobe_Custom;
+ when not specified, maps are searched
+ for in the above order. */
+ int hdpi; /* if (flags & gdFTEX_RESOLUTION) */
+ int vdpi; /* if (flags & gdFTEX_RESOLUTION) */
+ char *xshow; /* if (flags & gdFTEX_XSHOW)
+ then, on return, xshow is a malloc'ed
+ string containing xshow position data for
+ the last string.
+
+ NB. The caller is responsible for gdFree'ing
+ the xshow string.
+ */
+ char *fontpath; /* if (flags & gdFTEX_RETURNFONTPATHNAME)
+ then, on return, fontpath is a malloc'ed
+ string containing the actual font file path name
+ used, which can be interesting when fontconfig
+ is in use.
+
+ The caller is responsible for gdFree'ing the
+ fontpath string.
+ */
+
+}
+gdFTStringExtra, *gdFTStringExtraPtr;
+
+#define gdFTEX_LINESPACE 1
+#define gdFTEX_CHARMAP 2
+#define gdFTEX_RESOLUTION 4
+#define gdFTEX_DISABLE_KERNING 8
+#define gdFTEX_XSHOW 16
+/* The default unless gdFTUseFontConfig(1); has been called:
+ fontlist is a full or partial font file pathname or list thereof
+ (i.e. just like before 2.0.29) */
+#define gdFTEX_FONTPATHNAME 32
+/* Necessary to use fontconfig patterns instead of font pathnames
+ as the fontlist argument, unless gdFTUseFontConfig(1); has
+ been called. New in 2.0.29 */
+#define gdFTEX_FONTCONFIG 64
+/* Sometimes interesting when fontconfig is used: the fontpath
+ element of the structure above will contain a gdMalloc'd string
+ copy of the actual font file pathname used, if this flag is set
+ when the call is made */
+#define gdFTEX_RETURNFONTPATHNAME 128
+
+/* If flag is nonzero, the fontlist parameter to gdImageStringFT
+ and gdImageStringFTEx shall be assumed to be a fontconfig font pattern
+ if fontconfig was compiled into gd. This function returns zero
+ if fontconfig is not available, nonzero otherwise. */
+BGD_DECLARE(int) gdFTUseFontConfig(int flag);
+
+/* These are NOT flags; set one in 'charmap' if you set the
+ gdFTEX_CHARMAP bit in 'flags'. */
+#define gdFTEX_Unicode 0
+#define gdFTEX_Shift_JIS 1
+#define gdFTEX_Big5 2
+#define gdFTEX_Adobe_Custom 3
+
+BGD_DECLARE(char *) gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist,
+ double ptsize, double angle, int x, int y,
+ char *string, gdFTStringExtraPtr strex);
+
+/* Point type for use in polygon drawing. */
+typedef struct {
+ int x, y;
+}
+gdPoint, *gdPointPtr;
+
+typedef struct {
+ int x, y;
+ int width, height;
+}
+gdRect, *gdRectPtr;
+
+
+BGD_DECLARE(void) gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c);
+BGD_DECLARE(void) gdImageOpenPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
+BGD_DECLARE(void) gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c);
+
+/* These functions still work with truecolor images,
+ for which they never return error. */
+BGD_DECLARE(int) gdImageColorAllocate (gdImagePtr im, int r, int g, int b);
+/* gd 2.0: palette entries with non-opaque transparency are permitted. */
+BGD_DECLARE(int) gdImageColorAllocateAlpha (gdImagePtr im, int r, int g, int b, int a);
+/* Assumes opaque is the preferred alpha channel value */
+BGD_DECLARE(int) gdImageColorClosest (gdImagePtr im, int r, int g, int b);
+/* Closest match taking all four parameters into account.
+ A slightly different color with the same transparency
+ beats the exact same color with radically different
+ transparency */
+BGD_DECLARE(int) gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a);
+/* An alternate method */
+BGD_DECLARE(int) gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b);
+/* Returns exact, 100% opaque matches only */
+BGD_DECLARE(int) gdImageColorExact (gdImagePtr im, int r, int g, int b);
+/* Returns an exact match only, including alpha */
+BGD_DECLARE(int) gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a);
+/* Opaque only */
+BGD_DECLARE(int) gdImageColorResolve (gdImagePtr im, int r, int g, int b);
+/* Based on gdImageColorExactAlpha and gdImageColorClosestAlpha */
+BGD_DECLARE(int) gdImageColorResolveAlpha (gdImagePtr im, int r, int g, int b, int a);
+
+/* A simpler way to obtain an opaque truecolor value for drawing on a
+ truecolor image. Not for use with palette images! */
+
+#define gdTrueColor(r, g, b) (((r) << 16) + \
+ ((g) << 8) + \
+ (b))
+
+/* Returns a truecolor value with an alpha channel component.
+ gdAlphaMax (127, **NOT 255**) is transparent, 0 is completely
+ opaque. */
+
+#define gdTrueColorAlpha(r, g, b, a) (((a) << 24) + \
+ ((r) << 16) + \
+ ((g) << 8) + \
+ (b))
+
+BGD_DECLARE(void) gdImageColorDeallocate (gdImagePtr im, int color);
+
+/* Converts a truecolor image to a palette-based image,
+ using a high-quality two-pass quantization routine
+ which attempts to preserve alpha channel information
+ as well as R/G/B color information when creating
+ a palette. If ditherFlag is set, the image will be
+ dithered to approximate colors better, at the expense
+ of some obvious "speckling." colorsWanted can be
+ anything up to 256. If the original source image
+ includes photographic information or anything that
+ came out of a JPEG, 256 is strongly recommended.
+
+ Better yet, don't use these function -- write real
+ truecolor PNGs and JPEGs. The disk space gain of
+ conversion to palette is not great (for small images
+ it can be negative) and the quality loss is ugly.
+
+ DIFFERENCES: gdImageCreatePaletteFromTrueColor creates and
+ returns a new image. gdImageTrueColorToPalette modifies
+ an existing image, and the truecolor pixels are discarded.
+
+ gdImageTrueColorToPalette() returns TRUE on success, FALSE on failure.
+*/
+
+BGD_DECLARE(gdImagePtr) gdImageCreatePaletteFromTrueColor (gdImagePtr im, int ditherFlag,
+ int colorsWanted);
+
+BGD_DECLARE(int) gdImageTrueColorToPalette (gdImagePtr im, int ditherFlag,
+ int colorsWanted);
+
+BGD_DECLARE(int) gdImagePaletteToTrueColor(gdImagePtr src);
+
+/* An attempt at getting the results of gdImageTrueColorToPalette to
+ * look a bit more like the original (im1 is the original and im2 is
+ * the palette version */
+
+BGD_DECLARE(int) gdImageColorMatch(gdImagePtr im1, gdImagePtr im2);
+
+/* Selects quantization method used for subsequent gdImageTrueColorToPalette calls.
+ See gdPaletteQuantizationMethod enum (e.g. GD_QUANT_NEUQUANT, GD_QUANT_LIQ).
+ Speed is from 1 (highest quality) to 10 (fastest).
+ Speed 0 selects method-specific default (recommended).
+
+ Returns FALSE if the given method is invalid or not available.
+*/
+BGD_DECLARE(int) gdImageTrueColorToPaletteSetMethod (gdImagePtr im, int method, int speed);
+
+/*
+ Chooses quality range that subsequent call to gdImageTrueColorToPalette will aim for.
+ Min and max quality is in range 1-100 (1 = ugly, 100 = perfect). Max must be higher than min.
+ If palette cannot represent image with at least min_quality, then image will remain true-color.
+ If palette can represent image with quality better than max_quality, then lower number of colors will be used.
+ This function has effect only when GD_QUANT_LIQ method has been selected and the source image is true-color.
+*/
+BGD_DECLARE(void) gdImageTrueColorToPaletteSetQuality (gdImagePtr im, int min_quality, int max_quality);
+
+/* Specifies a color index (if a palette image) or an
+ RGB color (if a truecolor image) which should be
+ considered 100% transparent. FOR TRUECOLOR IMAGES,
+ THIS IS IGNORED IF AN ALPHA CHANNEL IS BEING
+ SAVED. Use gdImageSaveAlpha(im, 0); to
+ turn off the saving of a full alpha channel in
+ a truecolor image. Note that gdImageColorTransparent
+ is usually compatible with older browsers that
+ do not understand full alpha channels well. TBB */
+BGD_DECLARE(void) gdImageColorTransparent (gdImagePtr im, int color);
+
+BGD_DECLARE(void) gdImagePaletteCopy (gdImagePtr dst, gdImagePtr src);
+
+typedef int (*gdCallbackImageColor)(gdImagePtr im, int src);
+
+BGD_DECLARE(int) gdImageColorReplace(gdImagePtr im, int src, int dst);
+BGD_DECLARE(int) gdImageColorReplaceThreshold(gdImagePtr im, int src, int dst, float threshold);
+BGD_DECLARE(int) gdImageColorReplaceArray(gdImagePtr im, int len, int *src, int *dst);
+BGD_DECLARE(int) gdImageColorReplaceCallback(gdImagePtr im, gdCallbackImageColor callback);
+
+BGD_DECLARE(void) gdImageGif (gdImagePtr im, FILE * out);
+BGD_DECLARE(void) gdImagePng (gdImagePtr im, FILE * out);
+BGD_DECLARE(void) gdImagePngCtx (gdImagePtr im, gdIOCtx * out);
+BGD_DECLARE(void) gdImageGifCtx (gdImagePtr im, gdIOCtx * out);
+BGD_DECLARE(void) gdImageTiff(gdImagePtr im, FILE *outFile);
+BGD_DECLARE(void *) gdImageTiffPtr(gdImagePtr im, int *size);
+BGD_DECLARE(void) gdImageTiffCtx(gdImagePtr image, gdIOCtx *out);
+
+BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression);
+BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression);
+BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression);
+
+/* 2.0.12: Compression level: 0-9 or -1, where 0 is NO COMPRESSION at all,
+ 1 is FASTEST but produces larger files, 9 provides the best
+ compression (smallest files) but takes a long time to compress, and
+ -1 selects the default compiled into the zlib library. */
+BGD_DECLARE(void) gdImagePngEx (gdImagePtr im, FILE * out, int level);
+BGD_DECLARE(void) gdImagePngCtxEx (gdImagePtr im, gdIOCtx * out, int level);
+
+BGD_DECLARE(void) gdImageWBMP (gdImagePtr image, int fg, FILE * out);
+BGD_DECLARE(void) gdImageWBMPCtx (gdImagePtr image, int fg, gdIOCtx * out);
+
+/* Guaranteed to correctly free memory returned by the gdImage*Ptr
+ functions */
+BGD_DECLARE(void) gdFree (void *m);
+
+/* Best to free this memory with gdFree(), not free() */
+BGD_DECLARE(void *) gdImageWBMPPtr (gdImagePtr im, int *size, int fg);
+
+/* 100 is highest quality (there is always a little loss with JPEG).
+ 0 is lowest. 10 is about the lowest useful setting. */
+BGD_DECLARE(void) gdImageJpeg (gdImagePtr im, FILE * out, int quality);
+BGD_DECLARE(void) gdImageJpegCtx (gdImagePtr im, gdIOCtx * out, int quality);
+
+/* Best to free this memory with gdFree(), not free() */
+BGD_DECLARE(void *) gdImageJpegPtr (gdImagePtr im, int *size, int quality);
+
+BGD_DECLARE(void) gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization);
+BGD_DECLARE(void) gdImageWebp (gdImagePtr im, FILE * outFile);
+BGD_DECLARE(void *) gdImageWebpPtr (gdImagePtr im, int *size);
+BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quantization);
+BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quantization);
+
+/* Legal values for Disposal. gdDisposalNone is always used by
+ the built-in optimizer if previm is passed. */
+
+enum {
+ gdDisposalUnknown,
+ gdDisposalNone,
+ gdDisposalRestoreBackground,
+ gdDisposalRestorePrevious
+};
+
+BGD_DECLARE(void) gdImageGifAnimBegin(gdImagePtr im, FILE *outFile, int GlobalCM, int Loops);
+BGD_DECLARE(void) gdImageGifAnimAdd(gdImagePtr im, FILE *outFile, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
+BGD_DECLARE(void) gdImageGifAnimEnd(FILE *outFile);
+BGD_DECLARE(void) gdImageGifAnimBeginCtx(gdImagePtr im, gdIOCtx *out, int GlobalCM, int Loops);
+BGD_DECLARE(void) gdImageGifAnimAddCtx(gdImagePtr im, gdIOCtx *out, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
+BGD_DECLARE(void) gdImageGifAnimEndCtx(gdIOCtx *out);
+BGD_DECLARE(void *) gdImageGifAnimBeginPtr(gdImagePtr im, int *size, int GlobalCM, int Loops);
+BGD_DECLARE(void *) gdImageGifAnimAddPtr(gdImagePtr im, int *size, int LocalCM, int LeftOfs, int TopOfs, int Delay, int Disposal, gdImagePtr previm);
+BGD_DECLARE(void *) gdImageGifAnimEndPtr(int *size);
+
+/* A custom data sink. For backwards compatibility. Use gdIOCtx
+ instead. The sink function must return -1 on error, otherwise the
+ number of bytes written, which must be equal to len. Context will
+ be passed to your sink function.
+*/
+typedef struct {
+ int (*sink) (void *context, const char *buffer, int len);
+ void *context;
+}
+gdSink, *gdSinkPtr;
+
+BGD_DECLARE(void) gdImagePngToSink (gdImagePtr im, gdSinkPtr out);
+
+BGD_DECLARE(void) gdImageGd (gdImagePtr im, FILE * out);
+BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * out, int cs, int fmt);
+
+/* Best to free this memory with gdFree(), not free() */
+BGD_DECLARE(void *) gdImageGifPtr (gdImagePtr im, int *size);
+
+/* Best to free this memory with gdFree(), not free() */
+BGD_DECLARE(void *) gdImagePngPtr (gdImagePtr im, int *size);
+BGD_DECLARE(void *) gdImagePngPtrEx (gdImagePtr im, int *size, int level);
+
+/* Best to free this memory with gdFree(), not free() */
+BGD_DECLARE(void *) gdImageGdPtr (gdImagePtr im, int *size);
+
+/* Best to free this memory with gdFree(), not free() */
+BGD_DECLARE(void *) gdImageGd2Ptr (gdImagePtr im, int cs, int fmt, int *size);
+
+/* Style is a bitwise OR ( | operator ) of these.
+ gdArc and gdChord are mutually exclusive;
+ gdChord just connects the starting and ending
+ angles with a straight line, while gdArc produces
+ a rounded edge. gdPie is a synonym for gdArc.
+ gdNoFill indicates that the arc or chord should be
+ outlined, not filled. gdEdged, used together with
+ gdNoFill, indicates that the beginning and ending
+ angles should be connected to the center; this is
+ a good way to outline (rather than fill) a
+ 'pie slice'. */
+#define gdArc 0
+#define gdPie gdArc
+#define gdChord 1
+#define gdNoFill 2
+#define gdEdged 4
+
+BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s,
+ int e, int color, int style);
+BGD_DECLARE(void) gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e,
+ int color);
+BGD_DECLARE(void) gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color);
+BGD_DECLARE(void) gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h,
+ int color);
+BGD_DECLARE(void) gdImageFillToBorder (gdImagePtr im, int x, int y, int border,
+ int color);
+BGD_DECLARE(void) gdImageFill (gdImagePtr im, int x, int y, int color);
+BGD_DECLARE(void) gdImageCopy (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
+ int srcX, int srcY, int w, int h);
+BGD_DECLARE(void) gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
+ int srcX, int srcY, int w, int h, int pct);
+BGD_DECLARE(void) gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX,
+ int dstY, int srcX, int srcY, int w, int h,
+ int pct);
+
+/* Stretches or shrinks to fit, as needed. Does NOT attempt
+ to average the entire set of source pixels that scale down onto the
+ destination pixel. */
+BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY,
+ int srcX, int srcY, int dstW, int dstH, int srcW,
+ int srcH);
+
+/* gd 2.0: stretches or shrinks to fit, as needed. When called with a
+ truecolor destination image, this function averages the
+ entire set of source pixels that scale down onto the
+ destination pixel, taking into account what portion of the
+ destination pixel each source pixel represents. This is a
+ floating point operation, but this is not a performance issue
+ on modern hardware, except for some embedded devices. If the
+ destination is a palette image, gdImageCopyResized is
+ substituted automatically. */
+BGD_DECLARE(void) gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX,
+ int dstY, int srcX, int srcY, int dstW, int dstH,
+ int srcW, int srcH);
+
+/* gd 2.0.8: gdImageCopyRotated is added. Source
+ is a rectangle, with its upper left corner at
+ srcX and srcY. Destination is the *center* of
+ the rotated copy. Angle is in degrees, same as
+ gdImageArc. Floating point destination center
+ coordinates allow accurate rotation of
+ objects of odd-numbered width or height. */
+BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst,
+ gdImagePtr src,
+ double dstX, double dstY,
+ int srcX, int srcY,
+ int srcWidth, int srcHeight, int angle);
+
+BGD_DECLARE(gdImagePtr) gdImageClone (gdImagePtr src);
+
+BGD_DECLARE(void) gdImageSetBrush (gdImagePtr im, gdImagePtr brush);
+BGD_DECLARE(void) gdImageSetTile (gdImagePtr im, gdImagePtr tile);
+BGD_DECLARE(void) gdImageSetAntiAliased (gdImagePtr im, int c);
+BGD_DECLARE(void) gdImageSetAntiAliasedDontBlend (gdImagePtr im, int c, int dont_blend);
+BGD_DECLARE(void) gdImageSetStyle (gdImagePtr im, int *style, int noOfPixels);
+/* Line thickness (defaults to 1). Affects lines, ellipses,
+ rectangles, polygons and so forth. */
+BGD_DECLARE(void) gdImageSetThickness (gdImagePtr im, int thickness);
+/* On or off (1 or 0) for all three of these. */
+BGD_DECLARE(void) gdImageInterlace (gdImagePtr im, int interlaceArg);
+BGD_DECLARE(void) gdImageAlphaBlending (gdImagePtr im, int alphaBlendingArg);
+BGD_DECLARE(void) gdImageSaveAlpha (gdImagePtr im, int saveAlphaArg);
+
+BGD_DECLARE(gdImagePtr) gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor);
+
+enum gdPixelateMode {
+ GD_PIXELATE_UPPERLEFT,
+ GD_PIXELATE_AVERAGE
+};
+
+BGD_DECLARE(int) gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode);
+
+typedef struct {
+ int sub;
+ int plus;
+ unsigned int num_colors;
+ int *colors;
+ unsigned int seed;
+} gdScatter, *gdScatterPtr;
+
+BGD_DECLARE(int) gdImageScatter(gdImagePtr im, int sub, int plus);
+BGD_DECLARE(int) gdImageScatterColor(gdImagePtr im, int sub, int plus, int colors[], unsigned int num_colors);
+BGD_DECLARE(int) gdImageScatterEx(gdImagePtr im, gdScatterPtr s);
+BGD_DECLARE(int) gdImageSmooth(gdImagePtr im, float weight);
+BGD_DECLARE(int) gdImageMeanRemoval(gdImagePtr im);
+BGD_DECLARE(int) gdImageEmboss(gdImagePtr im);
+BGD_DECLARE(int) gdImageGaussianBlur(gdImagePtr im);
+BGD_DECLARE(int) gdImageEdgeDetectQuick(gdImagePtr src);
+BGD_DECLARE(int) gdImageSelectiveBlur( gdImagePtr src);
+BGD_DECLARE(int) gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, float offset);
+BGD_DECLARE(int) gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha);
+BGD_DECLARE(int) gdImageContrast(gdImagePtr src, double contrast);
+BGD_DECLARE(int) gdImageBrightness(gdImagePtr src, int brightness);
+BGD_DECLARE(int) gdImageGrayScale(gdImagePtr src);
+BGD_DECLARE(int) gdImageNegate(gdImagePtr src);
+
+/* Macros to access information about images. */
+
+/* Returns nonzero if the image is a truecolor image,
+ zero for a palette image. */
+#define gdImageTrueColor(im) ((im)->trueColor)
+
+#define gdImageSX(im) ((im)->sx)
+#define gdImageSY(im) ((im)->sy)
+#define gdImageColorsTotal(im) ((im)->colorsTotal)
+#define gdImageRed(im, c) ((im)->trueColor ? gdTrueColorGetRed(c) : \
+ (im)->red[(c)])
+#define gdImageGreen(im, c) ((im)->trueColor ? gdTrueColorGetGreen(c) : \
+ (im)->green[(c)])
+#define gdImageBlue(im, c) ((im)->trueColor ? gdTrueColorGetBlue(c) : \
+ (im)->blue[(c)])
+#define gdImageAlpha(im, c) ((im)->trueColor ? gdTrueColorGetAlpha(c) : \
+ (im)->alpha[(c)])
+#define gdImageGetTransparent(im) ((im)->transparent)
+#define gdImageGetInterlaced(im) ((im)->interlace)
+
+/* These macros provide direct access to pixels in
+ palette-based and truecolor images, respectively.
+ If you use these macros, you must perform your own
+ bounds checking. Use of the macro for the correct type
+ of image is also your responsibility. */
+#define gdImagePalettePixel(im, x, y) (im)->pixels[(y)][(x)]
+#define gdImageTrueColorPixel(im, x, y) (im)->tpixels[(y)][(x)]
+
+#define gdImageResolutionX(im) (im)->res_x
+#define gdImageResolutionY(im) (im)->res_y
+
+/* I/O Support routines. */
+
+BGD_DECLARE(gdIOCtx *) gdNewFileCtx (FILE *);
+/* If data is null, size is ignored and an initial data buffer is
+ allocated automatically. NOTE: this function assumes gd has the right
+ to free or reallocate "data" at will! Also note that gd will free
+ "data" when the IO context is freed. If data is not null, it must point
+ to memory allocated with gdMalloc, or by a call to gdImage[something]Ptr.
+ If not, see gdNewDynamicCtxEx for an alternative. */
+BGD_DECLARE(gdIOCtx *) gdNewDynamicCtx (int size, void *data);
+/* 2.0.21: if freeFlag is nonzero, gd will free and/or reallocate "data" as
+ needed as described above. If freeFlag is zero, gd will never free
+ or reallocate "data", which means that the context should only be used
+ for *reading* an image from a memory buffer, or writing an image to a
+ memory buffer which is already large enough. If the memory buffer is
+ not large enough and an image write is attempted, the write operation
+ will fail. Those wishing to write an image to a buffer in memory have
+ a much simpler alternative in the gdImage[something]Ptr functions. */
+BGD_DECLARE(gdIOCtx *) gdNewDynamicCtxEx (int size, void *data, int freeFlag);
+BGD_DECLARE(gdIOCtx *) gdNewSSCtx (gdSourcePtr in, gdSinkPtr out);
+BGD_DECLARE(void *) gdDPExtractData (struct gdIOCtx *ctx, int *size);
+
+#define GD2_CHUNKSIZE 128
+#define GD2_CHUNKSIZE_MIN 64
+#define GD2_CHUNKSIZE_MAX 4096
+
+#define GD2_VERS 2
+#define GD2_ID "gd2"
+
+#define GD2_FMT_RAW 1
+#define GD2_FMT_COMPRESSED 2
+
+/* Image comparison definitions */
+BGD_DECLARE(int) gdImageCompare (gdImagePtr im1, gdImagePtr im2);
+
+BGD_DECLARE(void) gdImageFlipHorizontal(gdImagePtr im);
+BGD_DECLARE(void) gdImageFlipVertical(gdImagePtr im);
+BGD_DECLARE(void) gdImageFlipBoth(gdImagePtr im);
+
+#define GD_FLIP_HORINZONTAL 1
+#define GD_FLIP_VERTICAL 2
+#define GD_FLIP_BOTH 3
+
+/**
+ * Group: Crop
+ *
+ * Constants: gdCropMode
+ * GD_CROP_DEFAULT - Default crop mode (4 corners or background)
+ * GD_CROP_TRANSPARENT - Crop using the transparent color
+ * GD_CROP_BLACK - Crop black borders
+ * GD_CROP_WHITE - Crop white borders
+ * GD_CROP_SIDES - Crop using colors of the 4 corners
+ *
+ * See also:
+ * <gdImageAutoCrop>
+ **/
+enum gdCropMode {
+ GD_CROP_DEFAULT = 0,
+ GD_CROP_TRANSPARENT,
+ GD_CROP_BLACK,
+ GD_CROP_WHITE,
+ GD_CROP_SIDES,
+ GD_CROP_THRESHOLD
+};
+
+BGD_DECLARE(gdImagePtr) gdImageCrop(gdImagePtr src, const gdRect *crop);
+BGD_DECLARE(gdImagePtr) gdImageCropAuto(gdImagePtr im, const unsigned int mode);
+BGD_DECLARE(gdImagePtr) gdImageCropThreshold(gdImagePtr im, const unsigned int color, const float threshold);
+
+BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id);
+
+gdImagePtr gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, const unsigned int new_height);
+gdImagePtr gdImageScaleBicubic(gdImagePtr src_img, const unsigned int new_width, const unsigned int new_height);
+gdImagePtr gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height);
+gdImagePtr gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height);
+gdImagePtr gdImageScaleTwoPass(const gdImagePtr pOrigImage, const unsigned int uOrigWidth, const unsigned int uOrigHeight, const unsigned int uNewWidth, const unsigned int uNewHeight);
+BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height);
+
+gdImagePtr gdImageRotate90(gdImagePtr src, int ignoretransparent);
+gdImagePtr gdImageRotate180(gdImagePtr src, int ignoretransparent);
+gdImagePtr gdImageRotate270(gdImagePtr src, int ignoretransparent);
+gdImagePtr gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees, const int bgColor);
+gdImagePtr gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor);
+gdImagePtr gdImageRotateBicubicFixed(gdImagePtr src, const float degrees, const int bgColor);
+gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor);
+BGD_DECLARE(gdImagePtr) gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor);
+
+typedef enum {
+ GD_AFFINE_TRANSLATE = 0,
+ GD_AFFINE_SCALE,
+ GD_AFFINE_ROTATE,
+ GD_AFFINE_SHEAR_HORIZONTAL,
+ GD_AFFINE_SHEAR_VERTICAL
+} gdAffineStandardMatrix;
+
+BGD_DECLARE(int) gdAffineApplyToPointF (gdPointFPtr dst, const gdPointFPtr src, const double affine[6]);
+BGD_DECLARE(int) gdAffineInvert (double dst[6], const double src[6]);
+BGD_DECLARE(int) gdAffineFlip (double dst_affine[6], const double src_affine[6], const int flip_h, const int flip_v);
+BGD_DECLARE(int) gdAffineConcat (double dst[6], const double m1[6], const double m2[6]);
+
+BGD_DECLARE(int) gdAffineIdentity (double dst[6]);
+BGD_DECLARE(int) gdAffineScale (double dst[6], const double scale_x, const double scale_y);
+BGD_DECLARE(int) gdAffineRotate (double dst[6], const double angle);
+BGD_DECLARE(int) gdAffineShearHorizontal (double dst[6], const double angle);
+BGD_DECLARE(int) gdAffineShearVertical(double dst[6], const double angle);
+BGD_DECLARE(int) gdAffineTranslate (double dst[6], const double offset_x, const double offset_y);
+BGD_DECLARE(double) gdAffineExpansion (const double src[6]);
+BGD_DECLARE(int) gdAffineRectilinear (const double src[6]);
+BGD_DECLARE(int) gdAffineEqual (const double matrix1[6], const double matrix2[6]);
+BGD_DECLARE(int) gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]);
+BGD_DECLARE(int) gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]);
+/*
+gdTransformAffineCopy(gdImagePtr dst, int x0, int y0, int x1, int y1,
+ const gdImagePtr src, int src_width, int src_height,
+ const double affine[6]);
+*/
+BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox);
+
+#define GD_CMP_IMAGE 1 /* Actual image IS different */
+#define GD_CMP_NUM_COLORS 2 /* Number of Colours in pallette differ */
+#define GD_CMP_COLOR 4 /* Image colours differ */
+#define GD_CMP_SIZE_X 8 /* Image width differs */
+#define GD_CMP_SIZE_Y 16 /* Image heights differ */
+#define GD_CMP_TRANSPARENT 32 /* Transparent colour */
+#define GD_CMP_BACKGROUND 64 /* Background colour */
+#define GD_CMP_INTERLACE 128 /* Interlaced setting */
+#define GD_CMP_TRUECOLOR 256 /* Truecolor vs palette differs */
+
+/* resolution affects ttf font rendering, particularly hinting */
+#define GD_RESOLUTION 96 /* pixels per inch */
+
+#ifdef __cplusplus
+}
+#endif
+
+/* newfangled special effects */
+#include "gdfx.h"
+
+#endif /* GD_H */
+
+#ifdef __cplusplus
+}
+#endif
|