/usr/share/doc/libimlib2-dev/html/index.html is in libimlib2-dev 1.4.7-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.72 [en] (X11; U; Linux 2.2.16-3ext3 i686) [Netscape]">
<meta name="Author" content="The Rasterman & Lightman">
<title>Imlib 2 - Documentation.</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FFFF00">
<center>
<h1>
<img SRC="imlib2.gif" ALT="Imlib2" height=128 width=256></h1></center>
<center><table BORDER=0 CELLSPACING=0 WIDTH="95%" BGCOLOR="#666666" NOSAVE ROWS="5" >
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td ALIGN=CENTER VALIGN=CENTER NOSAVE><b><font color="#FFFFFF"><font size=+2>What
is it?</font></font></b></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td><img SRC="img/blank.gif" height=1 width=1></td>
<td VALIGN=TOP HEIGHT="100%" BGCOLOR="#6a7a8a" NOSAVE>Imlib 2 is the successor
to Imlib. It is NOT a newer version - it is a completely new library. Imlib
2 can be installed alongside Imlib 1.x without any problems since they
are effectively different libraries - BUT they Have very similar functionality.
<p>Imlib 2 does the following:
<ul>
<li>
Load image files from disk in one of many formats</li>
<li>
Save images to disk in one of many formats</li>
<li>
Render image data onto other images</li>
<li>
Render images to an X-Windows drawable</li>
<li>
Produce pixmaps and pixmap masks of Images</li>
<li>
Apply filters to images</li>
<li>
Rotate images</li>
<li>
Accept RGBA Data for images</li>
<li>
Scale images</li>
<li>
Alpha blend Images on other images or drawables</li>
<li>
Apply color correction and modification tables and factors to images</li>
<li>
Render images onto images with color correction and modification tables</li>
<li>
Render truetype anti-aliased text</li>
<li>
Render truetype anti-aliased text at any angle</li>
<li>
Render anti-aliased lines</li>
<li>
Render rectangles</li>
<li>
Render linear multi-colored gradients</li>
<li>
Cache data intelligently for maximum performance</li>
<li>
Allocate colors automatically</li>
<li>
Allow full control over caching and color allocation</li>
<li>
Provide highly optimized MMX assembly for core routines</li>
<li>
Provide plug-in filter interface</li>
<li>
Provide on-the-fly runtime plug-in image loading and saving interface</li>
<li>
Fastest image compositing, rendering and manipulation library for X</li>
</ul>
If what you want isn't in the list above somewhere then likely Imlib 2
does not do it. If it does it it likely does it faster than any other library
you can find (this includes gdk-pixbuf, gdkrgb, etc.) primarily because
of highly optimized code and a smart subsystem that does the dirty work
for you and picks up the pieces for you so you can be lazy and let all
the optimizations for FOR you.
<p>Imlib 2 can run without a display, so it can be easily used for background
image processing for web sites or servers - it only requires the X libraries
to be installed - that is all - it does not require an XServer to run unless
you wish to display images.
<p>The interface is simple - once you get used to it, the functions do
exactly what they say they do.</td>
<td><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
</table></center>
<br>
<center><table BORDER=0 CELLSPACING=0 WIDTH="95%" BGCOLOR="#666666" NOSAVE ROWS="5" >
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td ALIGN=CENTER VALIGN=CENTER NOSAVE><b><font color="#FFFFFF"><font size=+2>A
Simple Example</font></font></b></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td><img SRC="img/blank.gif" height=1 width=1></td>
<td VALIGN=TOP HEIGHT="100%" BGCOLOR="#6a7a8a" NOSAVE>The best way to start
is to show a simple example of an Imlib2 program. This one will load an
image of any format you have a loader installed for (all loaders are dynamic
code objects that Imlib2 will use and update automatically runtime - anyone
is free to write a loader. All that has to be done is for the object to
be dropped into the loaders directory with the others and all Imlib2 programs
will automatically be able to use it - without a restart).
<blockquote>
<pre><tt><font color="#660000">/* standard headers */
#include <X11/Xlib.h>
#include <Imlib2.h>
#include <stdio.h>
#include <string.h>
/* main program */
int main(int argc, char **argv)
{
/* an image handle */
Imlib_Image image;
/* if we provided < 2 arguments after the command - exit */
if (argc != 3) exit(1);
/* load the image */
image = imlib_load_image(argv[1]);
/* if the load was successful */
if (image)
{
char *tmp;
/* set the image we loaded as the current context image to work on */
imlib_context_set_image(image);
/* set the image format to be the format of the extension of our last */
/* argument - i.e. .png = png, .tif = tiff etc. */
tmp = strrchr(argv[2], '.');
if(tmp)
imlib_image_set_format(tmp + 1);
/* save the image */
imlib_save_image(argv[2]);
}
}</font></tt></pre>
Now to compile this
<br>
<tt><font color="#000099">cc imlib2_convert.c -o imlib2_convert `imlib2-config --cflags` `imlib2-config --libs`</font></tt>
<br>
You now have a program that if used as follows:
<br>
<tt><font color="#000099">./imlib2_convert image1.jpg image2.png</font></tt>
<br>
will convert image1.jpg into a png called image2.png. It is that simple.</blockquote>
</td>
<td><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
</table></center>
<br>
<center><table BORDER=0 CELLSPACING=0 WIDTH="95%" BGCOLOR="#666666" NOSAVE ROWS="5" >
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td ALIGN=CENTER VALIGN=CENTER NOSAVE><b><font color="#FFFFFF"><font size=+2>How
Image Loading Works</font></font></b></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td><img SRC="img/blank.gif" height=1 width=1></td>
<td VALIGN=TOP HEIGHT="100%" BGCOLOR="#6a7a8a" NOSAVE>It is probably a
good idea to discuss how Imlib2 actually loads an Image so the programmer
knows what is going on, how to take advantage of the optimizations already
there and to explain why things work as they do.
<br>
<blockquote>
<h3>
Loading using imlib_load_image();</h3>
This is likely to be by far the most common way to load an image - when
you don't really care about the details of the loading process or why it
failed - all you care about is if you got a valid image handle.
<p>When you call this function Imlib2 attempts to find the file specified
as the parameter. This will involve Imlib2 first checking to see if that
file path already has been loaded and is in Imlib2's cache (a cache of
already decoded images in memory to save having to load and decode from
disk all the time). If there already is a copy in the cache (either already
active or speculatively cached from a previous load & free) this copy
will have its handle returned instead of Imlib2 checking on disk (in some
circumstances this is not true - see later in this section to find out).
This means if your program blindly loads an Image, renders it, then frees
it - then soon afterwards loads the same image again, it will not be loaded
from disk at all, instead it will simply be re-referenced from the cache
- meaning the load will be almost instant. A great way to take full advantage
of this is to set the cache to some size you are happy with for the image
data being used by your application and then all rendering o an image follows
the pseudo code:
<pre><tt><font color="#006600">set cache to some amount (e.g. 4 Mb)
...
rendering loop ...
load image
render image
free image
... continue loop</font></tt></pre>
This may normally sound silly - load image, render then free - EVERY time
we want to use it, BUT - it is actually the smartest way to use Imlib2
- since the caching will find the image for you in the cache - you do not
need to manage your own cache, or worry about filling up memory with image
data - only as much memory as you have set for the cache size will actually
ever be used to store image data - if you have lots of image data to work
with then increase the cache size for better performance, but this is the
only thing you need to worry about. you won't have problems of accidentally
forgetting to free images later since you free them immediately after use.
<p>Now what happens if the file changes on disk while it's in cache? By
default nothing. The file is ignored. This is an optimization (to avoid
hitting the disk to check if the file changed for every load if it's cached).
You can inform Imlib2 that you care about this by using the <tt><font color="#660000">imlib_image_set_changes_on_disk();
</font></tt><font color="#000000">call.
Do this whenever you load an Image that you expect will change on disk,
and the fact that it changes really matters. Remember this will marginally
reduce the caching performance.</font>
<p><font color="#000000">Now what actually happens when we try and load
an image using a filename? First the filename is broken down into 2 parts.
the filename before a colon (:) and the key after the colon. This means
when we have a filename like:</font>
<p><tt><font color="#000099">/path/to/file.jpg</font></tt>
<p><font color="#000000">the filename is:</font>
<p><tt><font color="#000099">/path/to/file.jpg</font></tt>
<p><font color="#000000">and the key is blank. If we have:</font>
<p><tt><font color="#000099">/path/to/file.db:key.value/blah</font></tt>
<p><font color="#000000">the filename is:</font>
<p><tt><font color="#000099">/path/to/file.db</font></tt>
<p><font color="#000000">and the key is:</font>
<p><tt><font color="#000099">key.value/blah</font></tt>
<p><font color="#000000">You may ask what is this thing with keys and filenames?
Well Imlib2 has loaders that are able to load data that is WITHIN a file
(the loader capable of this right now is the database loader that is able
to load image data stored with a key in a Berkeley-db database file). The
colon is used to delimit where the filename ends and the key begins. Fro
the majority of files you load you won't have to worry, but there is a
limit in this case that filenames cannot contain a color character.</font>
<p><font color="#000000">First Imlib2 checks to see if the file exists
and that you have permission to read it. If this fails it will abort the
load. Now that it has checked that this is the case it evaluates that it's
list of dynamically loaded loader modules it up to date then it runs through
the loader modules until one of them claims it can load this file. If this
is the case that loader is now used to decode the image and return
an Image handle to the calling program. If the loader is written correctly
and the file format sanely supports this, the loader will NOT decode any
image data at this point. It will ONLY read the header of the image to
figure out its size, if it has an alpha channel, format and any other header
information. The loader is remembered and it will be re-used to load the
image data itself later if and ONLY if the actual image data itself is
needed. This means you can scan vast directories of files figuring their
format and size and other such information just by loading and freeing
- and it will be fast because no image data is decoded. You can take advantage
of this by loading the image and checking its size to calculate the size
of an output area before you ever load the data. This means geometry
calculations can be done fast ahead of time.</font>
<p><font color="#000000">If you desire more detailed information about
why a load failed you can use </font><tt><font color="#000099">imlib_load_image_with_error_return();
</font></tt><font color="#000000">and
it will return a detailed error return code.</font>
<p><font color="#000000">If you do not wish to have the image data loaded
later using the optimized "deferred" method of loading, you can force the
data to be decoded immediately with </font><tt><font color="#000099">imlib_load_image_immediately();</font></tt>
<p><font color="#000000">If you wish to bypass the cache when loading images
you can using </font><tt><font color="#000099">imlib_load_image_without_cache();
</font></tt><font color="#000000">and
</font><tt><font color="#000099">imlib_load_image_immediately_without_cache();</font></tt><font color="#000000">.</font>
<p><font color="#000000">Sometimes loading images can take a while. Often
it is a good idea to provide feedback to the user whilst this is happening.
This is when you set the progress function callback. Setting this to NULL
will mean no progress function is called during load - this is the default.
When it is set you set it to a function that will get called every so often
(depending on the progress granularity) during load. Use </font><tt><font color="#000099">imlib_context_set_progress_function();</font></tt><font color="#000000">
and </font><tt><font color="#000099">imlib_context_set_progress_granularity();
</font></tt><font color="#000000">to
set this up.</font></blockquote>
</td>
<td><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
</table></center>
<br>
<center><table BORDER=0 CELLSPACING=0 WIDTH="95%" BGCOLOR="#666666" NOSAVE ROWS="5" >
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td ALIGN=CENTER VALIGN=CENTER NOSAVE><b><font color="#FFFFFF"><font size=+2>A
more advanced Example</font></font></b></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td><img SRC="img/blank.gif" height=1 width=1></td>
<td VALIGN=TOP HEIGHT="100%" BGCOLOR="#6a7a8a" NOSAVE>This is a more comprehensive
example that should show off a fair number of features of imlib2. The code
this was based off can be found in Imlib2's test directory. This covers
a lot of the core of Imlib2's API so you should have a pretty good idea
on how it works if you understand this code snippet.
<blockquote>
<pre><tt><font color="#660000">/* include X11 stuff */
#include <X11/Xlib.h>
/* include Imlib2 stuff */
#include <Imlib2.h>
/* sprintf include */
#include <stdio.h>
/* some globals for our window & X display */
Display *disp;
Window win;
Visual *vis;
Colormap cm;
int depth;
/* the program... */
int main(int argc, char **argv)
{
/* events we get from X */
XEvent ev;
/* areas to update */
Imlib_Updates updates, current_update;
/* our virtual framebuffer image we draw into */
Imlib_Image buffer;
/* a font */
Imlib_Font font;
/* our color range */
Imlib_Color_Range range;
/* our mouse x, y coordinates */
int mouse_x = 0, mouse_y = 0;
/* connect to X */
disp = XOpenDisplay(NULL);
/* get default visual , colormap etc. you could ask imlib2 for what it */
/* thinks is the best, but this example is intended to be simple */
vis = DefaultVisual(disp, DefaultScreen(disp));
depth = DefaultDepth(disp, DefaultScreen(disp));
cm = DefaultColormap(disp, DefaultScreen(disp));
/* create a window 640x480 */
win = XCreateSimpleWindow(disp, DefaultRootWindow(disp),
0, 0, 640, 480, 0, 0, 0);
/* tell X what events we are interested in */
XSelectInput(disp, win, ButtonPressMask | ButtonReleaseMask |
PointerMotionMask | ExposureMask);
/* show the window */
XMapWindow(disp, win);
/* set our cache to 2 Mb so it doesn't have to go hit the disk as long as */
/* the images we use use less than 2Mb of RAM (that is uncompressed) */
imlib_set_cache_size(2048 * 1024);
/* set the font cache to 512Kb - again to avoid re-loading */
imlib_set_font_cache_size(512 * 1024);
/* add the ./ttfonts dir to our font path - you'll want a notepad.ttf */
/* in that dir for the text to display */
imlib_add_path_to_font_path("./ttfonts");
/* set the maximum number of colors to allocate for 8bpp and less to 128 */
imlib_set_color_usage(128);
/* dither for depths < 24bpp */
imlib_context_set_dither(1);
/* set the display , visual, colormap and drawable we are using */
imlib_context_set_display(disp);
imlib_context_set_visual(vis);
imlib_context_set_colormap(cm);
imlib_context_set_drawable(win);
/* infinite event loop */
for (;;)
{
/* image variable */
Imlib_Image image;
/* width and height values */
int w, h, text_w, text_h;
/* init our updates to empty */
updates = imlib_updates_init();
/* while there are events form X - handle them */
do
{
XNextEvent(disp, &ev);
switch (ev.type)
{
case Expose:
/* window rectangle was exposed - add it to the list of */
/* rectangles we need to re-render */
updates = imlib_update_append_rect(updates,
ev.xexpose.x, ev.xexpose.y,
ev.xexpose.width, ev.xexpose.height);
break;
case ButtonPress:
/* if we click anywhere in the window, exit */
exit(0);
break;
case MotionNotify:
/* if the mouse moves - note it */
/* add a rectangle update for the new mouse position */
image = imlib_load_image("./test_images/mush.png");
imlib_context_set_image(image);
w = imlib_image_get_width();
h = imlib_image_get_height();
imlib_context_set_image(image);
imlib_free_image();
/* the old position - so we wipe over where it used to be */
updates = imlib_update_append_rect(updates,
mouse_x - (w / 2), mouse_y - (h / 2),
w, h);
font = imlib_load_font("notepad/30");
if (font)
{
char text[4096];
imlib_context_set_font(font);
sprintf(text, "Mouse is at %i, %i", mouse_x, mouse_y);
imlib_get_text_size(text, &text_w, &text_h);
imlib_free_font();
updates = imlib_update_append_rect(updates,
320 - (text_w / 2), 240 - (text_h / 2),
text_w, text_h);
}
mouse_x = ev.xmotion.x;
mouse_y = ev.xmotion.y;
/* the new one */
updates = imlib_update_append_rect(updates,
mouse_x - (w / 2), mouse_y - (h / 2),
w, h);
font = imlib_load_font("notepad/30");
if (font)
{
char text[4096];
imlib_context_set_font(font);
sprintf(text, "Mouse is at %i, %i", mouse_x, mouse_y);
imlib_get_text_size(text, &text_w, &text_h);
imlib_free_font();
updates = imlib_update_append_rect(updates,
320 - (text_w / 2), 240 - (text_h / 2),
text_w, text_h);
}
default:
/* any other events - do nothing */
break;
}
}
while (XPending(disp));
/* no more events for now ? ok - idle time so lets draw stuff */
/* take all the little rectangles to redraw and merge them into */
/* something sane for rendering */
updates = imlib_updates_merge_for_rendering(updates, 640, 480);
for (current_update = updates;
current_update;
current_update = imlib_updates_get_next(current_update))
{
int up_x, up_y, up_w, up_h;
/* find out where the first update is */
imlib_updates_get_coordinates(current_update,
&up_x, &up_y, &up_w, &up_h);
/* create our buffer image for rendering this update */
buffer = imlib_create_image(up_w, up_h);
/* we can blend stuff now */
imlib_context_set_blend(1);
/* fill the window background */
/* load the background image - you'll need to have some images */
/* in ./test_images lying around for this to actually work */
image = imlib_load_image("./test_images/bg.png");
/* we're working with this image now */
imlib_context_set_image(image);
/* get its size */
w = imlib_image_get_width();
h = imlib_image_get_height();
/* now we want to work with the buffer */
imlib_context_set_image(buffer);
/* if the iimage loaded */
if (image)
{
/* blend image onto the buffer and scale it to 640x480 */
imlib_blend_image_onto_image(image, 0,
0, 0, w, h,
- up_x, - up_y, 640, 480);
/* working with the loaded image */
imlib_context_set_image(image);
/* free it */
imlib_free_image();
}
/* draw an icon centered around the mouse position */
image = imlib_load_image("./test_images/mush.png");
imlib_context_set_image(image);
w = imlib_image_get_width();
h = imlib_image_get_height();
imlib_context_set_image(buffer);
if (image)
{
imlib_blend_image_onto_image(image, 0,
0, 0, w, h,
mouse_x - (w / 2) - up_x, mouse_y - (h / 2) - up_y, w, h);
imlib_context_set_image(image);
imlib_free_image();
}
/* draw a gradient on top of things at the top left of the window */
/* create a range */
range = imlib_create_color_range();
imlib_context_set_color_range(range);
/* add white opaque as the first color */
imlib_context_set_color(255, 255, 255, 255);
imlib_add_color_to_color_range(0);
/* add an orange color, semi-transparent 10 units from the first */
imlib_context_set_color(255, 200, 10, 100);
imlib_add_color_to_color_range(10);
/* add black, fully transparent at the end 20 units away */
imlib_context_set_color(0, 0, 0, 0);
imlib_add_color_to_color_range(20);
/* draw the range */
imlib_context_set_image(buffer);
imlib_image_fill_color_range_rectangle(- up_x, - up_y, 128, 128, -45.0);
/* free it */
imlib_free_color_range();
/* draw text - centered with the current mouse x, y */
font = imlib_load_font("notepad/30");
if (font)
{
char text[4096];
/* set the current font */
imlib_context_set_font(font);
/* set the image */
imlib_context_set_image(buffer);
/* set the color (black) */
imlib_context_set_color(0, 0, 0, 255);
/* print text to display in the buffer */
sprintf(text, "Mouse is at %i, %i", mouse_x, mouse_y);
/* query the size it will be */
imlib_get_text_size(text, &text_w, &text_h);
/* draw it */
imlib_text_draw(320 - (text_w / 2) - up_x, 240 - (text_h / 2) - up_y, text);
/* free the font */
imlib_free_font();
}
/* don't blend the image onto the drawable - slower */
imlib_context_set_blend(0);
/* set the buffer image as our current image */
imlib_context_set_image(buffer);
/* render the image at 0, 0 */
imlib_render_image_on_drawable(up_x, up_y);
/* don't need that temporary buffer image anymore */
imlib_free_image();
}
/* if we had updates - free them */
if (updates)
imlib_updates_free(updates);
/* loop again waiting for events */
}
return 0;
}</font></tt></pre>
</blockquote>
</td>
<td><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
</table></center>
<br>
<center><table BORDER=0 CELLSPACING=0 WIDTH="95%" BGCOLOR="#666666" NOSAVE ROWS="5" >
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td ALIGN=CENTER VALIGN=CENTER NOSAVE><b><font color="#FFFFFF"><font size=+2>API
Reference</font></font></b></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1" NOSAVE><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr NOSAVE>
<td>
<img SRC="img/blank.gif" height=1 width=1>
</td>
<td VALIGN=TOP HEIGHT="100%" BGCOLOR="#6a7a8a" NOSAVE><p>This is a list of
all the Imlib2 API calls and what each of them do. You should familiarize
yourself well with this API so you have a good idea of what can be done.</p>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_display(Display *display);</font></font></tt></b>
<blockquote>Sets the current X display to be used for rendering of images
to drawables. You do not need to set this if you do not intend to render
an image to an X drawable. If you do you will need to set this. If you
change displays just set this to the new display pointer. Do not use a
Display pointer if you have closed that display already - also note that
if you close a display connection and continue to render using Imlib2 without
setting the display pointer to NULL or something new, crashes may occur.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_visual(Visual *visual);</font></font></tt></b>
<blockquote>This sets the current visual to use when rendering images to
drawables or producing pixmaps. You need to set this for anything to render
to a drawable or produce any pixmaps (this can be the default visual).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_colormap(Colormap colormap);</font></font></tt></b>
<blockquote>Sets the colormap to use when rendering to drawables and allocating
colors. You must set this to the colormap you are using to render any images
or produce any pixmaps (this can be the default colormap).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_drawable(Drawable drawable);</font></font></tt></b>
<blockquote>This sets the X drawable to which images will be rendered when
you call a render call in Imlib2. This may be either a pixmap or a window.
You must set this to render anything.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_mask(Pixmap mask);</font></font></tt></b>
<blockquote>This sets the 1-bit deep pixmap to be drawn to when rendering
to generate a mask pixmap. This is only useful if the image you are rendering
has alpha. Set this to 0 to not render a pixmap mask.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_dither_mask(char dither_mask);</font></font></tt></b>
<blockquote>Selects if, you are rendering to a mask, or producing pixmap
masks from images, if the mask is to be dithered or not. passing in 1 for
dither_mask means the mask pixmap will be dithered, 0 means it will not
be dithered.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_anti_alias(char anti_alias);</font></font></tt></b>
<blockquote>Toggles "anti-aliased" scaling of images. This isn't quite
correct since it's actually super and sub pixel sampling that it turns
on and off, but anti-aliasing is used for having "smooth" edges to lines
and shapes and this means when images are scaled they will keep their smooth
appearance. Passing in 1 turns this on and 0 turns it off.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_dither(char dither);</font></font></tt></b>
<blockquote>Sets the dithering flag for rendering to a drawable or when
pixmaps are produced. This affects the color image appearance by enabling
dithering. Dithering slows down rendering but produces considerably better
results. this option has no effect foe rendering in 24 bit and up, but
in 16 bit and lower it will dither, producing smooth gradients and much
better quality images. setting dither to 1 enables it and 0 disables it.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_blend(char blend);</font></font></tt></b>
<blockquote>When rendering an image to a drawable, Imlib2 is able to blend
the image directly onto the drawable during rendering. setting this to
1 will enable this. If the image has no alpha channel this has no effect.
Setting it to 0 will disable this.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_color_modifier(Imlib_Color_Modifier color_modifier);</font></font></tt></b>
<blockquote>This sets the current color modifier used for rendering pixmaps
or images to a drawable or images onto other images. Color modifiers are
lookup tables that map the values in the red, green, blue and alpha channels
to other values in the same channel when rendering, allowing for fades,
color correction etc. to be done whilst rendering. pass in NULL as the
color_modifier to disable the color modifier for rendering.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_operation(Imlib_Operation operation);</font></font></tt></b>
<blockquote>When Imlib2 draws an image onto another or an image onto a
drawable it is able to do more than just blend the result on using the
given alpha channel of the image. It is also able to do saturating additive,
subtractive and a combination of the both (called reshade) rendering. The
default mode is IMLIB_OP_COPY. you can also set it to IMLIB_OP_ADD, IMLIB_OP_SUBTRACT
or IMLIB_OP_RESHADE. Use this function to set the rendering operation.
IMLIB_OP_COPY performs basic alpha blending: DST = (SRC * A) + (DST * (1
- A)). IMLIB_OP_ADD does DST = DST + (SRC * A). IMLIB_OP_SUBTRACT does
DST = DST - (SRC * A) and IMLIB_OP_RESHADE does DST = DST + (((SRC - 0.5)
/ 2) * A).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_font(Imlib_Font font);</font></font></tt></b>
<blockquote>This function sets the current font to use when rendering text.
you should load the font first with imlib_load_font().</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_direction(Imlib_Text_Direction direction);</font></font></tt></b>
<blockquote>This sets the direction in which to draw text in terms of simple
90 degree orientations or an arbitrary angle. The direction can be one
of IMLIB_TEXT_TO_RIGHT, IMLIB_TEXT_TO_LEFT, IMLIB_TEXT_TO_DOWN, IMLIB_TEXT_TO_UP
or IMLIB_TEXT_TO_ANGLE. The default is IMLIB_TEXT_TO_RIGHT. If you use
IMLIB_TEXT_TO_ANGLE, you will also have to set the angle with imlib_context_set_angle().</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_angle(double angle);</font></font></tt></b>
<blockquote>This sets the angle at which text strings will be drawn if
the text direction has been set to IMLIB_TEXT_TO_ANGLE with imlib_context_set_direction().</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_color(int red, int green, int blue, int alpha);</font></font></tt></b>
<blockquote>This sets the color with which text, lines and rectangles are
drawn when being rendered onto an image. Values for red, green, blue and
alpha are between 0 and 255 - any other values have undefined results.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_color_cmya(int cyan, magenta, int yellow, int alpha);</font></font></tt></b>
<blockquote>This sets the color in CMYA space. Values for cyan, magenta,
yellow and alpha are between 0 and 255 - any other values have undefined results.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_color_hsva(float hue, float saturation, float value, int alpha);</font></font></tt></b>
<blockquote>This sets the color in HSVA space. Values for hue are between 0 and 360,
values for saturation and value between 0 and 1, and values for alpha are between 0
and 255 - any other values have undefined results.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_color_hlsa(float hue, float lightness, float saturation, int alpha);</font></font></tt></b>
<blockquote>This sets the color in HLSA space. Values for hue are between 0 and 360,
values for lightness and saturation between 0 and 1, and values for alpha are
between 0 and 255 - any other values have undefined results.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_color_range(Imlib_Color_Range color_range);</font></font></tt></b>
<blockquote>This sets the current color range to use for rendering gradients.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_progress_function(Imlib_Progress_Function progress_function);</font></font></tt></b>
<blockquote>This sets the progress function to be called back whilst loading
images. Set this to the function to be called, or set it to NULL to disable
progress callbacks whilst loading.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_progress_granularity(char progress_granularity);</font></font></tt></b>
<blockquote>This hints as to how often to call the progress callback. 0
means as often as possible. 1 means whenever 15 more of the image has been
decoded, 10 means every 10% of the image decoding, 50 means every 50% and
100 means only call at the end. Values outside of the range 0-100 are undefined.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_image(Imlib_Image image);</font></font></tt></b>
<blockquote>This sets the current image Imlib2 will be using with its function
calls.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_filter(Imlib_Filter filter);</font></font></tt></b>
<blockquote>This sets the current filter to be used when applying filters
to images. Set this to NULL to disable filters.</blockquote>
<b><tt><font color="#660000"><font size=+2>Display *imlib_context_get_display(void);</font></font></tt></b>
<blockquote>This returns the current display used for Imlib2's display
context.</blockquote>
<b><tt><font color="#660000"><font size=+2>Visual *imlib_context_get_visual(void);</font></font></tt></b>
<blockquote>Returns the current visual used for Imlib2's context.</blockquote>
<b><tt><font color="#660000"><font size=+2>Colormap imlib_context_get_colormap(void);</font></font></tt></b>
<blockquote>Returns the current Colormap used for Imlib2's context.</blockquote>
<b><tt><font color="#660000"><font size=+2>Drawable imlib_context_get_drawable(void);</font></font></tt></b>
<blockquote>Returns the current Drawable used for Imlib2's context.</blockquote>
<b><tt><font color="#660000"><font size=+2>Pixmap imlib_context_get_mask(void);</font></font></tt></b>
<blockquote>Returns the current pixmap destination to be used to render
a mask into.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_context_get_dither_mask(void);</font></font></tt></b>
<blockquote>Returns the current mode for dithering pixmap masks. 1 means
dithering is enabled and 0 means it is not.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_context_get_anti_alias(void);</font></font></tt></b>
<blockquote>Returns if Imlib2 currently will smoothly scale images. 1 means
it will and 0 means it will not.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_context_get_dither(void);</font></font></tt></b>
<blockquote>Returns if image data is rendered with dithering currently.
1 means yes and 0 means no.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_context_get_blend(void);</font></font></tt></b>
<blockquote>Returns if Imlib2 will blend images onto a drawable whilst
rendering to that drawable. 1 means yes and 0 means no.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Color_Modifier imlib_context_get_color_modifier(void);</font></font></tt></b>
<blockquote>Returns the current colormodifier being used.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Operation imlib_context_get_operation(void);</font></font></tt></b>
<blockquote>Returns the current operation mode.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Font imlib_context_get_font(void);</font></font></tt></b>
<blockquote>Returns the current font.</blockquote>
<b><tt><font color="#660000"><font size=+2>double imlib_context_get_angle(void);</font></font></tt></b>
<blockquote>Returns the current angle used to render text at if the direction
is IMLIB_TEXT_TO_ANGLE.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Text_Direction imlib_context_get_direction(void);</font></font></tt></b>
<blockquote>Returns the current direction to render text in.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_get_color(int *red, int *green, int *blue, int *alpha);</font></font></tt></b>
<blockquote>Returns the current color for rendering text, rectangles and
lines.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_get_color_cmya(int *cyan, int *magenta, int *yellow, int *alpha);</font></font></tt></b>
<blockquote>Returns the current color for rendering text, rectangles and
lines in CMYA space.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_get_color_hsva(float *hue, float *saturation, float *value, int *alpha);</font></font></tt></b>
<blockquote>Returns the current color for rendering text, rectangles and
lines in HSVA space.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_get_color_hlsa(float *hue, float * lightness, float *saturation, int *alpha);</font></font></tt></b>
<blockquote>Returns the current color for rendering text, rectangles and
lines in HLSA space.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Color *imlib_context_get_imlib_color(void);</font></font></tt></b>
<blockquote>Returns the current color as a color struct. Do NOT free this
pointer.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Color_Range imlib_context_get_color_range(void);</font></font></tt></b>
<blockquote>Return the current color range being used for gradients.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Progress_Function imlib_context_get_progress_function(void);</font></font></tt></b>
<blockquote>Return the current progress function being used.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_context_get_progress_granularity(void);</font></font></tt></b>
<blockquote>Get the current progress granularity being used.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_context_get_image(void);</font></font></tt></b>
<blockquote>Return the current context image.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Filter imlib_context_get_filter(void);</font></font></tt></b>
<blockquote>Get the current context image filter.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_cache_size(void);</font></font></tt></b>
<blockquote>Return the current size of the image cache in bytes. The cache
is a unified cache used for image data AND pixmaps.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_set_cache_size(int bytes);</font></font></tt></b>
<blockquote>Set the cache size. The size is in bytes. Setting the cache
size to 0 effectively flushes the cache and keeps the cache size at 0 until
set to another value. Whenever you set the cache size Imlib2 will flush
as many old images and pixmap from the cache as needed until the current
cache usage is less than or equal to the cache size.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_color_usage(void);</font></font></tt></b>
<blockquote>Get the number of colors Imlib2 currently at a maximum is allowed
to allocate for rendering. The default is 256.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_set_color_usage(int max);</font></font></tt></b>
<blockquote>Set the maximum number of colors you would like Imlib2 to allocate
for you when rendering. The default ids 256. This has no effect in depths
greater than 8 bit.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_flush_loaders(void);</font></font></tt></b>
<blockquote>If you want Imlib2 to forcibly flush any cached loaders it
has and re-load them from disk (this is useful if the program just installed
a new loader and does not want to wait till Imlib2 deems it an optimal
time to rescan the loaders)</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_visual_depth(Display *display, Visual *visual);</font></font></tt></b>
<blockquote>Convenience function that returns the depth of a visual for
that display.</blockquote>
<b><tt><font color="#660000"><font size=+2>Visual *imlib_get_best_visual(Display *display, int screen, int *depth_return);</font></font></tt></b>
<blockquote>Returns the visual for that display and screen that Imlib2
thinks will give you the best quality output. depth_return should point
to an int that will be filled with the depth of that visual too.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_load_image(const char *file);</font></font></tt></b>
<blockquote>This function loads an image from disk located at the path
specified by file. Please see the "How image loading works" section for
more detail. Returns an image handle on success or NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_load_image_immediately(const char *file);</font></font></tt></b>
<blockquote>Loads an image from disk located at the path specified by file.
This forces the image data to be decoded at load time too, instead of decoding
being deferred until it is needed. Returns an image handle on success or
NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_load_image_without_cache(const char *file);</font></font></tt></b>
<blockquote>This loads the image without looking in the cache first. Returns
an image handle on success or NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_load_image_immediately_without_cache(const char *file);</font></font></tt></b>
<blockquote>Loads the image without deferred image data decoding (i.e.
it is decoded straight away) and without looking in the cache. Returns
an image handle on success or NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_load_image_with_error_return(const char *file, Imlib_Load_Error *error_return);</font></font></tt></b>
<blockquote>This loads an image at the path file on disk. If it succeeds
it returns a valid image handle, if not NULL is returned and the error_return
pointed to is set to the detail of the error.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_image(void);</font></font></tt></b>
<blockquote>This frees the image that is set as the current image in Imlib2's
context.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_image_and_decache(void);</font></font></tt></b>
<blockquote>Frees the current image in Imlib2's context AND removes it
from the cache.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_image_get_width(void);</font></font></tt></b>
<blockquote>Returns the width in pixels of the current image in Imlib2's
context.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_image_get_height(void);</font></font></tt></b>
<blockquote>Returns the height in pixels of the current image in Imlib2's
context.</blockquote>
<b><tt><font color="#660000"><font size=+2>const char *imlib_image_get_filename(void);</font></font></tt></b>
<blockquote>This returns the filename for the file that is set as the current
context. The pointer returned is only valid as long as no operations cause
the filename of the image to change. Saving the file with a different name
would cause this. It is suggested you duplicate the string if you wish
to continue to use the string for later processing. Do not free the string
pointer returned by this function.</blockquote>
<b><tt><font color="#660000"><font size=+2>DATA32 *imlib_image_get_data(void);</font></font></tt></b>
<blockquote>This returns a pointer to the image data in the image set as
the image for the current context. When you get this pointer it is assumed
you are planning on writing to the data, thus once you do this the image
can no longer be used for caching - in fact all images cached from this
one will also be affected when you put the data back. If this matters it
is suggested you clone the image first before playing with the image data.
The image data is returned in the format of a DATA32 (32 bits) per pixel
in a linear array ordered from the top left of the image to the bottom
right going from left to right each line. Each pixel has the upper 8 bits
as the alpha channel and the lower 8 bits are the blue channel - so a pixel's
bits are ARGB (from most to least significant, 8 bits per channel). You
must put the data back at some point.</blockquote>
<b><tt><font color="#660000"><font size=+2>DATA32 *imlib_image_get_data_for_reading_only(void);</font></font></tt></b>
<blockquote>This functions the same way as imlib_image_get_data(), but
returns a pointer expecting the program to NOT write to the data returned
(it is for inspection purposes only). Writing to this data has undefined
results. The data does not need to be put back.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_put_back_data(DATA32 *data);</font></font></tt></b>
<blockquote>This will put back data when it was obtained by imlib_image_get_data().
The data must be the same pointer returned by imlib_image_get_data(). This
operated on the current context image.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_image_has_alpha(void);</font></font></tt></b>
<blockquote>Returns 1 if the current context image has an alpha channel,
or 0 if it does not (the alpha data space is still there and available
- just "unused").</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_changes_on_disk(void);</font></font></tt></b>
<blockquote>By default Imlib2 will not check the timestamp of an image
on disk and compare it with the image in its cache - this is to minimize
disk activity when using the cache. Call this function and it will flag
the current context image as being liable to change on disk and Imlib2
will check the timestamp of the image file on disk and compare it with
the cached image when it next needs to use this image in the cache.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_get_border(Imlib_Border *border);</font></font></tt></b>
<blockquote>This function fills the Imlib_Border structure to which border
points to with the values of the border of the current context image. The
border is the area at the edge of the image that does not scale with the
rest of the image when resized - the borders remain constant in size. This
is useful for scaling bevels at the edge of images differently to the image
center.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_border(Imlib_Border *border);</font></font></tt></b>
<blockquote>This sets the border of the current context image to the values
contained in the Imlib_Border structure border points to.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_format(const char *format);</font></font></tt></b>
<blockquote>This sets the format of the current image. This is used for
when you wish to save an image in a different format that it was loaded
in, or if the image currently has no file format associated with it.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_irrelevant_format(char irrelevant);</font></font></tt></b>
<blockquote>This sets if the format value of the current image is irrelevant
for caching purposes - by default it is. pass irrelevant as 1 to make it
irrelevant and 0 to make it relevant for caching.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_irrelevant_border(char irrelevant);</font></font></tt></b>
<blockquote>This sets if the border of the current image is irrelevant
for caching purposes. By default it is. Set irrelevant to 1 to make it
irrelevant, and 0 to make it relevant.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_irrelevant_alpha(char irrelevant);</font></font></tt></b>
<blockquote>This sets if the alpha channel status of the current image
(i.e. if there is or is not one) is important for caching purposes. By
default it is not. Set irrelevant to 1 to make it irrelevant and 0 to make
it relevant.</blockquote>
<b><tt><font color="#660000"><font size=+2>char *imlib_image_format(void);</font></font></tt></b>
<blockquote>This returns the current image's format. Do not free this string.
Duplicate it if you need it for later use.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_set_has_alpha(char has_alpha);</font></font></tt></b>
<blockquote>Sets the alpha flag for the current image. Set has_alpha to
1 to enable the alpha channel in the current image, or 0 to disable it.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_pixmaps_for_whole_image(Pixmap *pixmap_return, Pixmap *mask_return);</font></font></tt></b>
<blockquote>This function will create a pixmap of the current image (and
a mask if the image has an alpha value) and return the id's of the pixmap
and mask to the pixmap_return and mask_return pixmap id's. You must free
these pixmaps using Imlib2's free function imlib_free_pixmap_and_mask();.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_pixmaps_for_whole_image_at_size(Pixmap *pixmap_return, Pixmap *mask_return, int width, int height);</font></font></tt></b>
<blockquote>This function works just like imlib_render_pixmaps_for_whole_image(),
but will scale the output result to the width and height specified. Scaling
is done before depth conversion so pixels used for dithering don't grow
large.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_pixmap_and_mask(Pixmap pixmap);</font></font></tt></b>
<blockquote>This will free the pixmap (and any mask generated in association
with that pixmap). The pixmap will remain cached until the image the pixmap
was generated from is dirtied or decached, or the cache is flushed.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_image_on_drawable(int x, int y);</font></font></tt></b>
<blockquote>This renders the current image onto the current drawable at
the x, y pixel location specified without scaling.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_image_on_drawable_at_size(int x, int y, int width, int height);</font></font></tt></b>
<blockquote>This will render the current image onto the current drawable
at the x, y location specified AND scale the image to the width and height
specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_image_part_on_drawable_at_size(int source_x, int source_y, int source_width, int source_height, int x, int y, int width, int height);</font></font></tt></b>
<blockquote>This renders the source x, y, width, height pixel rectangle
from the current image onto the current drawable at the x, y location scaled
to the width and height specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_blend_image_onto_image(Imlib_Image source_image, char merge_alpha, int source_x, int source_y, int source_width, int source_height, int destination_x, int destination_y, int destination_width, int destination_height);</font></font></tt></b>
<blockquote>This will blend the source rectangle x, y, width, height from
the source_image onto the current image at the destination x, y location
scaled to the width and height specified. If merge_alpha is set to 1 it
will also modify the destination image alpha channel, otherwise the destination
alpha channel is left untouched.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_image(int width, int height);</font></font></tt></b>
<blockquote>This creates a new blank image of size width and height. The
contents of this image at creation time are undefined (they could be garbage
memory). You are free to do whatever you like with this image. It is not
cached. On success an image handle is returned - on failure NULL is returned.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_image_using_data(int width, int height, DATA32 *data);</font></font></tt></b>
<blockquote>This creates an image from the image data specified with the
width and height specified. The image data must be in the same format as
imlib_image_get_data() would return. You are responsible for freeing this
image data once the image is freed - Imlib2 will not do that for you. This
is useful for when you already have static buffers of the same format Imlib2
uses (many video grabbing devices use such a format) and wish to use Imlib2
to render the results onto another image, or X drawable. You should free
the image when you are done with it. Imlib2 returns a valid image handle
on success or NULL on failure</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_image_using_copied_data(int width,
int height,
DATA32 *data);</font></font></tt></b>
<blockquote>This works the same way as imlib_create_image_using_data()
but Imlib2 copies the image data to the image structure. You may now do
whatever you wish with the original data as it will not be needed anymore.
Imlib2 returns a valid image handle on success or NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_image_from_drawable(Pixmap mask,
int x,
int y,
int width,
int height,
char need_to_grab_x);</font></font></tt></b>
<blockquote>This will return an image (using the mask to determine the
alpha channel) from the current drawable. If the mask is 0 it will not
create a useful alpha channel in the image. It will create an image from
the x, y, width , height rectangle in the drawable. If need_to_grab_x is
1 it will also grab the X Server to avoid possible race conditions in grabbing.
If you have not already grabbed the server you MUST set this to 1. Imlib2
returns a valid image handle on success or NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_scaled_image_from_drawable(Pixmap mask,
int source_x,
int source_y,
int source_width,
int source_height,
int destination_width,
int destination_height,
char need_to_grab_x,
char get_mask_from_shape);</font></font></tt></b>
<blockquote>This will create an image from the current drawable (optionally
using the mask pixmap specified to determine alpha transparency) and scale
the grabbed data first before converting to an actual image (to minimize
reads from the frame buffer which can be slow). The source x, y, width,
height rectangle will be grabbed, scaled to the destination width and height,
then converted to an image. If need_to_grab_x is set to 1, X is grabbed
(set this to 1 unless you have already grabbed the server) and if get_mask_from_shape
and the current drawable is a window its shape is used for determining
the alpha channel. If successful this function will return a valid image
handle, otherwise NULL is returned.</blockquote>
<b><tt><font color="#660000"><font size=+2>char imlib_copy_drawable_to_image(Pixmap mask,
int x,
int y,
int width,
int height,
int destination_x,
int destination_y,
char need_to_grab_x);</font></font></tt></b>
<blockquote>This routine will grab a section of the current drawable (optionally
using the pixmap provided as a corresponding mask for that drawable - if
mask is 0 this is not used). It grabs the x, y, width, height rectangle
and places it at the destination x, y location in the current image. If
need_to_grab_x is 1 it will grab and ungrab the server whilst doing this
- you need to do this if you have not already grabbed the server.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_clone_image(void);</font></font></tt></b>
<blockquote>This creates an exact duplicate of the current image and returns
a valid image handle on success, or NULL on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_cropped_image(int x,
int y,
int width,
int height);</font></font></tt></b>
<blockquote>This creates a duplicate of a x, y, width, height rectangle
in the current image and returns a valid image handle on success, or NULL
on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_cropped_scaled_image(int source_x,
int source_y,
int source_width,
int source_height,
int destination_width,
int destination_height);</font></font></tt></b>
<blockquote>This function works the same as imlib_create_cropped_image()
but will scale the new image to the new destination width and height whilst
cropping.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_updates_clone(Imlib_Updates updates);</font></font></tt></b>
<blockquote>This function creates a duplicate of the updates list passed
into the function.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_update_append_rect(Imlib_Updates updates,
int x,
int y,
int w,
int h);</font></font></tt></b>
<blockquote>This function appends an update rectangle to the updates list
passed in (if the updates is NULL it will create a new updates list) and
returns a handle to the modified updates list (the handle may be modified
so only use the new updates handle returned)</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_updates_merge(Imlib_Updates updates,
int w,
int h);</font></font></tt></b>
<blockquote>This function takes an updates list, and modifies it by merging
overlapped rectangles and lots of tiny rectangles into larger rectangles
to minimize the number of rectangles in the list for optimized redrawing.
The new updates handle is now valid and the old one passed in is not.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates,
int w,
int h);</font></font></tt></b>
<blockquote>This works almost exactly as imlib_updates_merge() but is more
lenient on the spacing between update rectangles - if they are very close
it amalgamates 2 smaller rectangles into 1 larger one.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_updates_free(Imlib_Updates updates);</font></font></tt></b>
<blockquote>This frees an updates list.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_updates_get_next(Imlib_Updates updates);</font></font></tt></b>
<blockquote>This gets the next update in the updates list relative to the
one passed in.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_updates_get_coordinates(Imlib_Updates updates,
int *x_return,
int *y_return,
int *width_return,
int *height_return);</font></font></tt></b>
<blockquote>This returns the coordinates of an update.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_updates_set_coordinates(Imlib_Updates updates,
int x,
int y,
int width,
int height);</font></font></tt></b>
<blockquote>This modifies the coordinates of an update in an updates list.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_image_updates_on_drawable(Imlib_Updates updates,
int x,
int y);</font></font></tt></b>
<blockquote>Given an updates list (preferable already merged for rendering)
this will render the corresponding parts of the image to the current drawable
at an offset of x, y in the drawable.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_updates_init(void);</font></font></tt></b>
<blockquote>This initializes an updates list before you add any updates
to it or merge it for rendering etc.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_updates_append_updates(Imlib_Updates updates,
Imlib_Updates appended_updates);</font></font></tt></b>
<blockquote>This appends one updates list (appended_updates) to the updates
list (updates) and returns the new list.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_flip_horizontal(void);</font></font></tt></b>
<blockquote>This will flip/mirror the current image horizontally.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_flip_vertical(void);</font></font></tt></b>
<blockquote>This will flip/mirror the current image vertically.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_flip_diagonal(void);</font></font></tt></b>
<blockquote>This will flip/mirror the current image diagonally (good for
quick and dirty 90 degree rotations if used before to after a horizontal
or vertical flip).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_orientate(int orientation);</font></font></tt></b>
<blockquote>This will perform 90 degree rotations on the current image.
Passing in orientation does not rotate, 1 rotates clockwise by 90 degree,
2, rotates clockwise by 180 degrees, 3 rotates clockwise by 270 degrees.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_blur(int radius);</font></font></tt></b>
<blockquote>This will blur the current image. A radius of 0 has no effect,
1 and above determine the blur matrix radius that determine how much to
blur the image.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_sharpen(int radius);</font></font></tt></b>
<blockquote>This sharpens the current image. The radius affects how much
to sharpen by.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_tile_horizontal(void);</font></font></tt></b>
<blockquote>This modifies an image so it will tile seamlessly horizontally
if used as a tile (i.e. drawn multiple times horizontally)</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_tile_vertical(void);</font></font></tt></b>
<blockquote>This modifies an image so it will tile seamlessly vertically
if used as a tile (i.e. drawn multiple times vertically)</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_tile(void);</font></font></tt></b>
<blockquote>This modifies an image so it will tile seamlessly horizontally
and vertically if used as a tile (i.e. drawn multiple times horizontally
and vertically)</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Font imlib_load_font(const char *font_name);</font></font></tt></b>
<blockquote>This function will load a truetype font from the first directory
in the font path that contains that font. The font name format is "font_name/size".
For example. If there is a font file called blum.ttf somewhere in the font
path you might use "blum/20" to load a 20 pixel sized font of blum. If
the font cannot be found NULL is returned.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_font(void);</font></font></tt></b>
<blockquote>This frees the current font.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_text_draw(int x, int y, const char *text);</font></font></tt></b>
<blockquote>Call this function to draw the null-byte terminated string text
using the current font on the current image at the x, y location (x, y
denoting the top left corner of the font string)</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_text_draw_with_return_metrics(int x,
int y,
const char *text,
int *width_return,
int *height_return,
int *horizontal_advance_return,
int *vertical_advance_return);</font></font></tt></b>
<blockquote>This function works just like imlib_text_draw() but also returns
the width and height of the string drawn, and horizontal_advance_return
returns the number of pixels you should advance horizontally to draw another
string (useful if you are drawing a line of text word by word) and vertical_advance_return
does the same for the vertical direction (i.e. drawing text line by line).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_get_text_size(const char *text,
int *width_return,
int *height_return);</font></font></tt></b>
<blockquote>This function returns the width and height in pixels the text
string would use up if drawn with the current font.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_get_text_advance(const char *text,
int *horizontal_advance_return,
int *vertical_advance_return);</font></font></tt></b>
<blockquote>This function returns the advance horizontally and vertically
in pixels the next text string would need to be placed at for the current
font. The advances are not adjusted for rotation so you will have to translate
the advances (which are calculated as if the text was drawn horizontally
from left to right) depending on the text orientation.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_text_inset(const char *text);</font></font></tt></b>
<blockquote>This function returns the inset of the first character of the
text string passed in using the current font and returns that value in pixels.
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_add_path_to_font_path(const char *path);</font></font></tt></b>
<blockquote>This function adds the directory path to the end of the current
list of directories to scan for fonts.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_remove_path_from_font_path(const char *path);</font></font></tt></b>
<blockquote>This function removes all directories in the font path that
match the path specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>char **imlib_list_font_path(int *number_return);</font></font></tt></b>
<blockquote>This returns a list of strings that are the directories in
the font path. Do not free this list or change it in any way. If you add
or delete members of the font path this list will be invalid. If you intend
to use this list later duplicate it for your own use. The number of elements
in the array of strings is put into number_return.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_text_get_index_and_location(const char *text,
int x,
int y,
int *char_x_return,
int *char_y_return,
int *char_width_return,
int *char_height_return);</font></font></tt></b>
<blockquote>This will return the character number in the string text using
the current font at the x, y pixel location which is an offset relative
to the top left of that string. -1 is returned if there is no character
there. If there is a character, character x, y, width and height are also
filled in.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_text_get_location_at_index(const char *text,
int index,
int *char_x_return,
int *char_y_return,
int *char_width_return,
int *char_height_return);</font></font></tt></b>
<blockquote>This will return the geometry of the character at index index
in the text string using the current font.</blockquote>
<b><tt><font color="#660000"><font size=+2>char **imlib_list_fonts(int *number_return);</font></font></tt></b>
<blockquote>This returns a list of fonts imlib2 can find in its font path.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_font_list(char **font_list,
int number);</font></font></tt></b>
<blockquote>This will free the font list returned by imlib_list_fonts().</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_font_cache_size(void);</font></font></tt></b>
<blockquote>This returns the font cache size in bytes.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_set_font_cache_size(int bytes);</font></font></tt></b>
<blockquote>This sets the font cache in bytes. Whenever you set the font
cache size Imlib2 will flush fonts from the cache until the memory used
by fonts is less than or equal to the font cache size. Setting the size
to 0 effectively frees all speculatively cached fonts.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_flush_font_cache(void);</font></font></tt></b>
<blockquote>This will cause a flush of all speculatively cached fonts from
the font cache.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_font_ascent(void);</font></font></tt></b>
<blockquote>Returns the current font's ascent value in pixels.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_font_descent(void);</font></font></tt></b>
<blockquote>Returns the current font's descent value in pixels.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_maximum_font_ascent(void);</font></font></tt></b>
<blockquote>Returns the current font's maximum ascent extent.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_get_maximum_font_descent(void);</font></font></tt></b>
<blockquote>Returns the current font's maximum descent extent.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Color_Modifier imlib_create_color_modifier(void);</font></font></tt></b>
<blockquote>This function creates a new empty color modifier and returns
a valid handle on success. NULL is returned on failure.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_color_modifier(void);</font></font></tt></b>
<blockquote>Calling this function frees the current color modifier.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_modify_color_modifier_gamma(double gamma_value);</font></font></tt></b>
<blockquote>This function modifies the current color modifier by adjusting
the gamma by the value specified. The color modifier is modified not set,
so calling this repeatedly has cumulative effects. A gamma of 1.0 is normal
linear, 2.0 brightens and 0.5 darkens etc. Negative values are not allows.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_modify_color_modifier_brightness(double brightness_value);</font></font></tt></b>
<blockquote>This function modifies the current color modifier by adjusting
the brightness by the value specified. The color modifier is modified not
set, so calling this repeatedly has cumulative effects. brightness values
of 0 do not affect anything. -1.0 will make things completely black and
1.0 will make things all white. Values in-between vary brightness linearly.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_modify_color_modifier_contrast(double contrast_value);</font></font></tt></b>
<blockquote>This function modifies the current color modifier by adjusting
the contrast by the value specified. The color modifier is modified not
set, so calling this repeatedly has cumulative effects. Contrast of 1.0
does nothing. 0.0 will merge to gray, 2.0 will double contrast etc.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_set_color_modifier_tables(DATA8 *red_table,
DATA8 *green_table,
DATA8 *blue_table,
DATA8 *alpha_table);</font></font></tt></b>
<blockquote>This function explicitly copies the mapping tables from the
table pointers passed into this function into those of the current color
modifier. Tables are 256 entry arrays of DATA8 which are a mapping of that
channel value to a new channel value. A normal mapping would be linear
(v[0] = 0, v[10] = 10, v[50] = 50, v[200] = 200, v[255] = 255).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_get_color_modifier_tables(DATA8 *red_table,
DATA8 *green_table,
DATA8 *blue_table,
DATA8 *alpha_table);</font></font></tt></b>
<blockquote>This copies the table values from the current color modifier
into the pointers to mapping tables specified. They must have 256 entries
and be DATA8 format.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_reset_color_modifier(void);</font></font></tt></b>
<blockquote>This function resets the current color modifier to have linear
mapping tables.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_apply_color_modifier(void);</font></font></tt></b>
<blockquote>This uses the current color modifier and modifies the current
image using the mapping tables in the current color modifier.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_apply_color_modifier_to_rectangle(int x,
int y,
int width,
int height);</font></font></tt></b>
<blockquote>This works the same way as imlib_apply_color_modifier() but
only modifies a selected rectangle in the current image.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Updates imlib_image_draw_line(int x1,
int y1,
int x2,
int y2,
char make_updates);</font></font></tt></b>
<blockquote>Draw a line using the current color on the current image from
coordinates x1, y1 to x2, y2. If make_updates is 1 it will also return
an update you can use for an updates list, otherwise it returns NULL.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_draw_rectangle(int x,
int y,
int width,
int height);</font></font></tt></b>
<blockquote>This draws the outline of a rectangle on the current image
at the x, y coordinates with a size of width and height pixels, using the
current color.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_fill_rectangle(int x,
int y,
int width,
int height);</font></font></tt></b>
<blockquote>This draws a filled rectangle on the current image at the x,
y coordinates with a size of width and height pixels, using the current
color.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_copy_alpha_to_image(Imlib_Image image_source,
int x,
int y);</font></font></tt></b>
<blockquote>This copies the alpha channel of the source image to the x,
y coordinates of the current image, replacing the alpha channel there.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source,
int x,
int y,
int width,
int height,
int destination_x,
int destination_y);</font></font></tt></b>
<blockquote>This copies the source x, y, width, height rectangle alpha
channel from the source image and replaces the alpha channel on the destination
image at the x, y, coordinates.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_scroll_rect(int x,
int y,
int width,
int height,
int delta_x,
int delta_y);</font></font></tt></b>
<blockquote>This scrolls a rectangle at x, y, width, height within the
current image by the delta x, y distance (in pixels).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_copy_rect(int x,
int y,
int width,
int height,
int new_x,
int new_y);</font></font></tt></b>
<blockquote>This copies a rectangle of size width, height at the x, y location
specified in the current image to a new location x, y in the same image.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Color_Range imlib_create_color_range(void);</font></font></tt></b>
<blockquote>This creates a new empty color range and returns a valid handle
to that color range.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_color_range(void);</font></font></tt></b>
<blockquote>This frees the current color range.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_add_color_to_color_range(int distance_away);</font></font></tt></b>
<blockquote>This adds the current color to the current color range at a
distance_away distance from the previous color in the range (if it's the
first color in the range this is irrelevant).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_fill_color_range_rectangle(int x,
int y,
int width,
int height,
double angle);</font></font></tt></b>
<blockquote>This fills a rectangle of width and height at the x, y location
specified in the current image with a linear gradient of the current color
range at an angle of angle degrees with 0 degrees being vertical from top
to bottom going clockwise from there.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_fill_hsva_color_range_rectangle(int x,
int y,
int width,
int height,
double angle);</font></font></tt></b>
<blockquote>This fills a rectangle of width and height at the x, y location
specified in the current image with a linear gradient in HSVA color space of
the current color range at an angle of angle degrees with 0 degrees being
vertical from top to bottom going clockwise from there.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_query_pixel(int x,
int y,
Imlib_Color *color_return);</font></font></tt></b>
<blockquote>This fills the color_return color structure with the color
of the pixel in the current image that is at the x, y location specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_query_pixel_cmya(int x,
int y,
int *cyan,
int *magenta,
int *yellow,
int *alpha);</font></font></tt></b>
<blockquote>This returns the CMYA color of the pixel in the current image
that is at the x, y location specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_query_pixel_hsva(int x,
int y,
float *hue,
float *saturation,
float *value,
int *alpha);</font></font></tt></b>
<blockquote>This returns the HSVA color of the pixel in the current image
that is at the x, y location specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_query_pixel_hlsa(int x,
int y,
float *hue,
float *lightness,
float *saturation,
int *alpha);</font></font></tt></b>
<blockquote>This returns the HLSA color of the pixel in the current image
that is at the x, y location specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_attach_data_value(const char *key,
void *data,
int value,
Imlib_Data_Destructor_Function destructor_function);</font></font></tt></b>
<blockquote>This attaches data to the current image with the string key
of key, and the data of data and an integer of value. The destructor function,
if not NULL is called when this image is freed so the destructor can free
the data, if this is needed.</blockquote>
<b><tt><font color="#660000"><font size=+2>void *imlib_image_get_attached_data(const char *key);</font></font></tt></b>
<blockquote>This returns the data attached to the current image with the
key specified. NULL is returned if no data could be found with that key
on the current image.</blockquote>
<b><tt><font color="#660000"><font size=+2>int imlib_image_get_attached_value(const char *key);</font></font></tt></b>
<blockquote>This returns the value attached to the current image with the
specified key. If none could be found 0 is returned.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_remove_attached_data_value(const char *key);</font></font></tt></b>
<blockquote>This detaches the data & value attached with the specified
key from the current image.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_remove_and_free_attached_data_value(const char *key);</font></font></tt></b>
<blockquote>This removes the data and value attached to the current image
with the specified key and also calls the destructor function that was
supplied when attaching it.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_save_image(const char *filename);</font></font></tt></b>
<blockquote>This saves the current image in the format specified by the
current image's format settings to the filename specified.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_save_image_with_error_return(const char *filename,
Imlib_Load_Error *error_return);</font></font></tt></b>
<blockquote>This works the same way imlib_save_image() works, but will
set the error_return to an error value if the save fails.</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Image imlib_create_rotated_image(double angle);</font></font></tt></b>
<blockquote>This creates an new copy of the current image, but rotated
by angle degrees. On success it returns a valid image handle, otherwise
NULL.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_blend_image_onto_image_at_angle(Imlib_Image source_image,
char merge_alpha,
int source_x,
int source_y,
int source_width,
int source_height,
int destination_x,
int destination_y,
int angle_x,
int angle_y);</font></font></tt></b>
<blockquote>This function works just like imlib_blend_image_onto_image_skewed()
except you cannot skew an image (v_angle_x and v_angle_y are 0).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_blend_image_onto_image_skewed(Imlib_Image source_image,
char merge_alpha,
int source_x,
int source_y,
int source_width,
int source_height,
int destination_x,
int destination_y,
int h_angle_x,
int h_angle_y,
int v_angle_x,
int v_angle_y);</font></font></tt></b>
<blockquote>This will blend the source rectangle x, y, width, height from
the source_image onto the current image at the destination x, y location.
<p>It will be rotated and scaled so that the upper right corner will be
positioned h_angle_x pixels to the right (or left, if negative) and h_angle_y
pixels down (from destination_[x|y]).
<p>If v_angle_x and v_angle_y are not 0, the image will also be skewed
so that the lower left corner will be positioned v_angle_x pixels to the
right and v_angle_y pixels down.
<p>The at_angle versions simply have the v_angle_x and v_angle_y set to
0 so the rotation doesn't get skewed, and the render_..._on_drawable ones
seem obvious enough; they do the same on a drawable.
<p>Examples:
<ul>
<li>
imlib_blend_image_onto_image_skewed(..., 0, 0, 100, 0, 0, 100);</li>
<p><br>will simply scale the image to be 100x100.
<br>
<li>
imlib_blend_image_onto_image_skewed(..., 0, 0, 0, 100, 100, 0);</li>
<p><br>will scale the image to be 100x100, and flip it diagonally.
<br>
<li>
imlib_blend_image_onto_image_skewed(..., 100, 0, 0, 100, -100, 0);</li>
<p><br>will scale the image and rotate it 90 degrees clockwise.
<br>
<li>
imlib_blend_image_onto_image_skewed(..., 50, 0, 50, 50, -50, 50);</li>
<p><br>will rotate the image 45 degrees clockwise, and will scale it so
its corners are at (50,0)-(100,50)-(50,100)-(0,50) i.e. it fits into the
100x100 square, so it's scaled down to 70.7% (sqrt(2)/2).
<br>
<li>
imlib_blend_image_onto_image_skewed(..., 50, 50, 100 * cos(a), 100 * sin(a),
0);</li>
<p><br>will rotate the image `a' degrees, with its upper left corner at
(50,50).
<br> </ul>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_image_on_drawable_skewed(int source_x,
int source_y,
int source_width,
int source_height,
int destination_x,
int destination_y,
int h_angle_x,
int h_angle_y,
int v_angle_x,
int v_angle_y);</font></font></tt></b>
<blockquote>This works just like imlib_blend_image_onto_image_skewed(),
except it blends the image onto the current drawable instead of the current
image.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_render_image_on_drawable_at_angle(int source_x,
int source_y,
int source_width,
int source_height,
int destination_x,
int destination_y,
int angle_x,
int angle_y);</font></font></tt></b>
<blockquote>This function works just like imlib_render_image_on_drawable_skewed()
except you cannot skew an image (v_angle_x and v_angle_y are 0).</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_context_set_cliprect(int x, int y, int w, int h);</font></font></tt></b>
<blockquote>Sets the current clipping rectangle to (x,y w*h). The clipping
rectangle effects all image drawing functions and prevents the area outside
the rectangle from being edited. Set w to 0 to disable clipping.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_polygon_new(void);</font></font></tt></b>
<blockquote>Returns a new polygon object with no points set.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_polygon_free(ImlibPolygon poly);</font></font></tt></b>
<blockquote>Frees a polygon object.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_polygon_add_point(ImlibPolygon poly, int x, int y);</font></font></tt></b>
<blockquote>Adds the point (x,y) to a polygon object. The point will be
added to the end of the polygon's internal point list. The points are drawn
in order, from the first to the last.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_draw_polygon(ImlibPolygon poly, unsigned char closed);</font></font></tt></b>
<blockquote>Draws a polygon onto the current context image. Points which
have been added to the polygon are drawn in sequence, first to last. The
final point will be joined with the first point if <b>closed</b> is non-zero.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_fill_polygon(ImlibPolygon poly);</font></font></tt></b>
<blockquote>Fill the area defined by the polygon on the current context
image with the current context colour.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2, int *py2);</font></font></tt></b>
<blockquote>Calculate the bounding area of the polygon. (px1, py1) defines
the upper left corner of the bounding box and (px2, py2) defines it's lower
right corner.</blockquote>
<b><tt><font color="#660000"><font size=+2>unsigned char imlib_polygon_contains_point(ImlibPolygon poly, int x, int y);</font></font></tt></b>
<blockquote>Returns non-zero if the point (x,y) is within the area defined
by the polygon.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_draw_ellipse(int xc, int yc, int a, int b);</font></font></tt></b>
<blockquote>Draw an ellipse on the current context image. The ellipse is
defined as (x-xc)^2/a^2 + (y-yc)^2/b^2 = 1. This means that the point (<b>xc</b>,<b>yc</b>)
marks the center of the ellipse, <b>a</b> defines the horizontal amplitude
of the ellipse, and <b>b</b> defines the vertical amplitude.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_fill_ellipse(int xc, int yc, int a, int b);</font></font></tt></b>
<blockquote>Fills an ellipse on the current context image using the current
context colour. The ellipse is defined as (x-xc)^2/a^2 + (y-yc)^2/b^2 =
1. This means that the point (<b>xc</b>,<b>yc</b>) marks the center of
the ellipse, <b>a</b> defines the horizontal amplitude of the ellipse,
and <b>b</b> defines the vertical amplitude.</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_image_filter(void);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>Imlib_Filter imlib_create_filter(int initsize);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_free_filter(void);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_set(int xoff,
int yoff,
int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_set_alpha(int xoff,
int yoff,
int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_set_red(int xoff,
int yoff,
int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_set_green(int xoff,
int yoff,
int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_set_blue(int xoff,
int yoff,
int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_constants(int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_filter_divisors(int a,
int r,
int g,
int b);</font></font></tt></b>
<blockquote>
</blockquote>
<b><tt><font color="#660000"><font size=+2>void imlib_apply_filter( char *script, ... );</font></font></tt></b>
<blockquote>
</blockquote>
<p>
<b>Imlib 2 Dynamic Filters</b>
<p>
Imlib2 has built in features allowing filters and effects to be applied at
run time through a very small scripting language, this is similar to that
of script-fu found in the GIMP (http://www.gimp.org). There are two parts
to the system, the client library call ``imlib_apply_filter'' and the
library side filters. The library side filters are synonymous with image
loaders.
<p>
To run a script on an image you need to set the context image then call:
<p>
<blockquote>
<pre>
imlib_apply_filter( script_string, ... );
</pre>
</blockquote>
<p>
The script_string variable is made up of the script language, which is
very simple and made up of only function calls. Functions calls look like
this:
<p>
<blockquote>
<pre>
filter name( key=value [, ...] );
</pre>
</blockquote>
<p>
Where,
<p>
<blockquote>
<b>filter name</b> is the name of the filter you wish to apply<br>
<b>key</b> is an expected value<br>
<b>value</b> is a ``string'', a number, or an actual variable in<br>
</blockquote>
<p>
the program, or the result of another filter.
<p>
eg.
<p>
<blockquote>
<pre>
bump_map( map=tint(red=50,tint=200), blue=10 );
</pre>
</blockquote>
<p>
This example would bump map using a a map generated from the tint filter.
<p>
It is also possible to pass application information to the filters via the
usage of the [] operator. When the script is being compiled the script
engine looks on the parameters passed to it and picks up a pointer for
every [] found.
<p>
eg2.
<p>
<blockquote>
<pre>
imlib_apply_filter( "tint( x=[], y=[], red=255, alpha=55 );", &myxint, &myyint );
</pre>
</blockquote>
<p>
This will cause a tint to the current image at (myxint,myyint) to be
done. This is very useful for when you want the filters to dynamically
change according to program variables.
The system is very quick as the code is pseudo-compiled and then run. The
advantage of having the scripting system allows customization of the image
manipulations, this is particularly useful in applications that allow
modifications to be done (eg. image viewers).
<p>
<b>Filter Library</b>
<p>
There are three functions that must be in every filter library
<p>
<blockquote>
<pre>
void init( struct imlib_filter_info *info ); - Called once on loading of the filter
</pre>
</blockquote>
<p>
info - a structure passed to the filter to be filled in with information about the filter
info->name - Name of the filter library<br>
info->author - Name of the library author<br>
info->description - Description of the filter library<br>
info->num_filters - Number of filters the library exports<br>
info->filters - An array of ``char *'' with each filter name in it.<br>
<p>
<blockquote>
<pre>
void deinit(); - Called when the filter is closed
</pre>
</blockquote>
<p>
<blockquote>
<pre>
/* Called every time a filter the library exports is called */
void *exec( char *filter, void *im, pIFunctionParam params );
</pre>
</blockquote>
<p>
filter - The name of the filter being asked for
im - The image that the filter should be applied against
params - A linked list of parameters.
<p>
The best way to get all the values is such:
<blockquote>
Declare all parameters and initialize them to there default values.
<blockquote>
<pre>
for( ptr = params; ptr != NULL; ptr = ptr->next )
{
..MACRO TO GET VALUE..
}
</pre>
</blockquote>
Current Macros are:
<blockquote>
<pre>
ASSIGN_INT( keyname, local variable )
ASSIGN_DATA8( keyname, local variable )
ASSIGN_IMAGE( keyname, local variable )
</pre>
</blockquote>
eg.
<blockquote>
<pre>
int r = 50;
IFunctionParam *ptr;
for( ptr = params; ptr != NULL; ptr = ptr->next )
{
ASSIGN_INT( "red", r );
}
</pre>
</blockquote>
</blockquote>
<p>
If the value "red" is not passed to the filter then it will remain
at 50, but it a value is passed, it will be assign to r.
<p>
return type - Imlib_Image, this is the result of filter.
<p>
</td>
<td><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
<tr>
<td WIDTH="1"><img SRC="img/blank.gif" height=1 width=1></td>
<td><img SRC="img/blank.gif" height=1 width=1></td>
<td WIDTH="1"><img SRC="img/blank.gif" height=1 width=1></td>
</tr>
</table></center>
</body></html>
|