16e7d3316Smrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 26e7d3316Smrg<html lang="en"> 36e7d3316Smrg<HEAD> 46e7d3316Smrg<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 56e7d3316Smrg<TITLE>FAQ XPM</TITLE> 66e7d3316Smrg</HEAD> 76e7d3316Smrg 86e7d3316Smrg<body> 96e7d3316Smrg<h1 align="center">The XPM<br> 106e7d3316SmrgFrequently Asked Questions</h1> 116e7d3316Smrg<p> 126e7d3316SmrgThis article contains the answers to some Frequently Asked Questions about the 136e7d3316SmrgXPM format and/or library. If you don't find the answer to your problem here, 146e7d3316Smrgthen you can mail either to lehors@sophia.inria.fr or to the mailing list 156e7d3316Smrgxpm-talk@sophia.inria.fr. 166e7d3316Smrg 176e7d3316Smrg 186e7d3316Smrg<h2>Contents</h2> 196e7d3316Smrg 206e7d3316Smrg<ol> 216e7d3316Smrg<li><a href="#Q1">How do I convert my images to or from XPM ?</a> 226e7d3316Smrg<li><a href="#Q2">Why are my XPM files said to be invalid ?</a> 236e7d3316Smrg<li><a href="#Q3">Why does my program core dumps using XPM ?</a> 246e7d3316Smrg<li><a href="#Q4">Why does my program core dumps using XPM with a widget ?</a> 256e7d3316Smrg<li><a href="#Q5">How can I get a non rectangular icon using XPM ?</a> 266e7d3316Smrg<li><a href="#Q6">What exactly triggers the creation of a mask when using XPM ?</a> 276e7d3316Smrg<li><a href="#Q7">How should I use the mask ?</a> 286e7d3316Smrg<li><a href="#Q8">Is there a string to pixmap converter somewhere ?</a> 296e7d3316Smrg<li><a href="#Q9">How can I edit XPM icons ?</a> 306e7d3316Smrg<li><a href="#Q10">Is there a collection of icons somewhere ?</a> 316e7d3316Smrg<li><a href="#Q11">The documentation fails to print out. Why ?</a> 326e7d3316Smrg<li><a href="#copy">Copyright</a> 336e7d3316Smrg</ol> 346e7d3316Smrg 356e7d3316Smrg 366e7d3316Smrg<h2><a name="Q1">1. How do I convert my images to or from XPM ?</a></h2> 376e7d3316Smrg<p> 386e7d3316Smrg Netpbm is surely the best image conversion package that I know of. It defines 396e7d3316Smrg formats for color, gray and monochrome images and provides a set of filters. 406e7d3316Smrg Thus a GIF image can be converted to XPM with something like: 416e7d3316Smrg<p> 426e7d3316Smrg $ giftoppm youricon.gif | ppmtoxpm > youricon.xpm 436e7d3316Smrg<p> 446e7d3316Smrg The latest release can be found at least from wuarchive.wustl.edu 456e7d3316Smrg (128.252.135.4), directory /graphics/graphics/packages/NetPBM 466e7d3316Smrg 476e7d3316Smrg 486e7d3316Smrg<h2><a name="Q2">2. Why are my XPM files said to be invalid ?</a></h2> 496e7d3316Smrg<p> 506e7d3316Smrg There are three official versions of the XPM format. The XPM library since 516e7d3316Smrg version 3.3 can read all them but writes out only XPM 3. Also the small 526e7d3316Smrg program called sxpm which is part of the XPM library package can be used to 536e7d3316Smrg automatically translate XPM 1 and 2 files to XPM 3 with a command such as: 546e7d3316Smrg<p> 556e7d3316Smrg $ sxpm -nod yourxpm1or2file -o yourxpm3file 566e7d3316Smrg<p> 576e7d3316Smrg Also, the XPM format defines "None" to be the color name meaning 586e7d3316Smrg "transparent", but IXI used to hack the XPM library in its early days to 596e7d3316Smrg handle transparency as "#Transparent". This makes IXI format not compatible 606e7d3316Smrg with the official XPM format, and so not readable neither by the official XPM 616e7d3316Smrg library nor any of the programs built on top of it. 626e7d3316Smrg<p> 636e7d3316Smrg The only solutions are either to stick on IXI programs which can deal with 646e7d3316Smrg their format or convert your files to the standard XPM format. This can be 656e7d3316Smrg done simply by changing "#Transparent" to "None". 666e7d3316Smrg 676e7d3316Smrg 686e7d3316Smrg<h2><a name="Q3">3. Why does my program core dumps using XPM ?</a></h2> 696e7d3316Smrg<p> 706e7d3316Smrg Be sure the XpmAttributes structure you pass by reference has a valid 716e7d3316Smrg valuemask. You can give NULL instead if you don't want to use an 726e7d3316Smrg XpmAttributes but if you do, you MUST initialize its valuemask component to 736e7d3316Smrg some valid value, at least 0, otherwise unpredictable errors can occur. 746e7d3316Smrg<p> 756e7d3316Smrg So instead of doing something like: 766e7d3316Smrg<pre> 776e7d3316Smrg XpmAttributes attrib; 786e7d3316Smrg 796e7d3316Smrg XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib); 806e7d3316Smrg</pre> 816e7d3316Smrg<p> 826e7d3316Smrg you should do: 836e7d3316Smrg<pre> 846e7d3316Smrg XpmAttributes attrib; 856e7d3316Smrg 866e7d3316Smrg attrib.valuemask = 0; 876e7d3316Smrg XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib); 886e7d3316Smrg</pre> 896e7d3316Smrg 906e7d3316Smrg 916e7d3316Smrg<h2><a name="Q4">4. Why does my program core dumps using XPM with a widget ?</a></h2> 926e7d3316Smrg<ul> 936e7d3316Smrg<li>First the XPM library is Xlib level, so don't pass your widget as a 946e7d3316Smrg Drawable parameter. A Drawable is either a Window or a Pixmap. The widget's 956e7d3316Smrg window can do the job but: 966e7d3316Smrg 976e7d3316Smrg<li>Then a widget only gets a Window when realized, so passing XtWindow(widget) 986e7d3316Smrg with a not yet realized widget is wrong. Either realize you widget first or 996e7d3316Smrg use another window. Since the Drawable parameter is only used to specify 1006e7d3316Smrg the screen to which the pixmap must be created on, most of the time the 1016e7d3316Smrg default root window is just fine. 1026e7d3316Smrg</ul> 1036e7d3316Smrg 1046e7d3316Smrg 1056e7d3316Smrg<h2><a name="Q5">5. How can I get a non rectangular icon using XPM ?</a></h2> 1066e7d3316Smrg<p> 1076e7d3316Smrg The X Window System does not support transparent color. However there are 1086e7d3316Smrg several ways you can use to get the same visual effect using XPM: 1096e7d3316Smrg<ul> 1106e7d3316Smrg<li>First you can use the None color to get a shape mask and use it as 1116e7d3316Smrg explained below (question 7). 1126e7d3316Smrg 1136e7d3316Smrg<li>Second you can define a symbolic color name such as "mask" in the XPM 1146e7d3316Smrg format file, then use the color overriding mechanism to set this symbolic 1156e7d3316Smrg color to the color of the underlying object. Note that in this case the XPM 1166e7d3316Smrg library won't create a shape mask, and that if the color of the underlying 1176e7d3316Smrg object is changed then you'll have to create a new pixmap. 1186e7d3316Smrg</ul> 1196e7d3316Smrg 1206e7d3316Smrg 1216e7d3316Smrg<h2><a name="Q6">6. What exactly triggers the creation of a mask when using XPM ?</a></h2> 1226e7d3316Smrg<p> 1236e7d3316Smrg Basically a mask is created if "None" is used as one of the color of the 1246e7d3316Smrg pixmap. Be aware that this is not only true if it is used in the XPM of the 1256e7d3316Smrg pixmap since the colors can be overridden at load time. So a mask is created 1266e7d3316Smrg if the "None" color is used at load time, coming either from the XPM 1276e7d3316Smrg definition or the color overriding. 1286e7d3316Smrg 1296e7d3316Smrg 1306e7d3316Smrg<h2><a name="Q7">7. How should I use the mask ?</a></h2> 1316e7d3316Smrg<p> 1326e7d3316Smrg There are basically two ways of using the mask: 1336e7d3316Smrg<ul> 1346e7d3316Smrg<li>Use the mask as a shapemask with the X11 Nonrectangular Saphe Window 1356e7d3316Smrg Extension. Typically this is what should be done when the icon is used in a 1366e7d3316Smrg desktop. 1376e7d3316Smrg 1386e7d3316Smrg<li>Use the mask as a clipmask in the GC you pass to XCopyArea when drawing the 1396e7d3316Smrg pixmap. So the "transparent" pixels being not actually drawn will get the 1406e7d3316Smrg underlying pixels colors. 1416e7d3316Smrg</ul> 1426e7d3316Smrg 1436e7d3316Smrg 1446e7d3316Smrg<h2><a name="Q8">8. Is there a string to pixmap converter for Motif ?</a></h2> 1456e7d3316Smrg<p> 1466e7d3316Smrg Yes, Motif 2.0 or later does support XPM pixmaps as well as XBM bitmaps. 1476e7d3316Smrg 1486e7d3316Smrg 1496e7d3316Smrg<h2><a name="Q9">9. How can I edit XPM icons ?</a></h2> 1506e7d3316Smrg<p> 1516e7d3316Smrg As listed below several editors either commercial or not are supporting the 1526e7d3316Smrg XPM format. However, pixmap is the one I would recommend since it is freely 1536e7d3316Smrg available and, being fully dedicated to XPM, it allows to edit all the 1546e7d3316Smrg special things, such as the symbolic color names, which makes XPM different 1556e7d3316Smrg from all the other image formats. Pixmap can always be found by ftp from 1566e7d3316Smrg ftp.x.org (contrib) and avahi.inria.fr (pub/pixmap). 1576e7d3316Smrg<p> 1586e7d3316SmrgLast Update: 3 August 1994 1596e7d3316Smrg<table border=1> 1606e7d3316Smrg<caption>XPM Icon Editors</caption> 1616e7d3316Smrg<tr><th>Program<th>Infos<th>Source/Author<th>Platforms<th>SA<th>XPM<th>cost 1626e7d3316Smrg<tr><td>pixmap<td><ul> 1636e7d3316Smrg <li><a href="ftp://ftp.x.org/contrib/application/pixmap/pixmap2.6.tar.gz">ftp://ftp.x.org/contrib/application/pixmap/pixmap2.6.tar.gz</a> 1646e7d3316Smrg <li>requires 3.4 or higher revision of Xpm lib. 1656e7d3316Smrg <li>supports all XPM format features 1666e7d3316Smrg <li>current version doesn't work on 24-plane displays 1676e7d3316Smrg</ul> 1686e7d3316Smrg<td>Lionel Mallet<td>source<td>yes<td>3<td>NC 1696e7d3316Smrg 1706e7d3316Smrg<tr><td>pixt<td><ul> 1716e7d3316Smrg <li><a href="ftp://ftp.x.org/contrib/pixt.tar.Z">ftp://ftp.x.org/contrib/pixt.tar.Z</a> 1726e7d3316Smrg <li>doesn't work on 24-plane displays 1736e7d3316Smrg <li>last updated November 1991 1746e7d3316Smrg</ul> 1756e7d3316Smrg<td>J. Michael Flanery<td>source<td>yes<td>1<td>NC 1766e7d3316Smrg 1776e7d3316Smrg<tr><td>pixed<td><ul> 1786e7d3316Smrg <li>part of X.desktop 1796e7d3316Smrg <li>current version doesn't work on 24-plane displays 1806e7d3316Smrg</ul> 1816e7d3316Smrg<td>IXI<td>Many UNIX<td>no<td>3<td>N/A 1826e7d3316Smrg 1836e7d3316Smrg<tr><td>olpixmap<td><ul> 1846e7d3316Smrg <li>packaged with the OLIT (OpenLook) toolkit 1856e7d3316Smrg</ul> 1866e7d3316Smrg<td>USL<td>Sun, SVR4.2, UnixWare<td>no<td>1<td>N/A 1876e7d3316Smrg 1886e7d3316Smrg<tr><td>xfedor<td><ul> 1896e7d3316Smrg <li>only uses XLIB 1906e7d3316Smrg <li>doesn't work on 24-plane displays 1916e7d3316Smrg</ul> 1926e7d3316Smrg<td>Daniel Dardailler<td>source<td>yes<td>3<td>NC 1936e7d3316Smrg 1946e7d3316Smrg<tr><td>SCOpaint<td><ul> 1956e7d3316Smrg <li>included with the ODT package 1966e7d3316Smrg</ul> 1976e7d3316Smrg<td>SCO/Wing Eng<td>ODT<td>yes<td>2.8<td>N/A 1986e7d3316Smrg 1996e7d3316Smrg<tr><td>pme.icn<td><ul> 2006e7d3316Smrg <li>written in the Icon language 2016e7d3316Smrg</ul> 2026e7d3316Smrg<td>Icon Project<td>source<td>yes<td>3<td>NC 2036e7d3316Smrg 2046e7d3316Smrg<tr><td>PixEditT<td><ul> 2056e7d3316Smrg <li>there is currently no support for editing the colormap 2066e7d3316Smrg</ul> 2076e7d3316Smrg<td>Free Widget Foundation<td>source<td>yes<td>3<td>NC 2086e7d3316Smrg 2096e7d3316Smrg<tr><td>xscribble<td><ul> 2106e7d3316Smrg <li>requires the FWF, 8-bit pseudocolor 2116e7d3316Smrg <li><a href="ftp://ftp.cis.ufl.edu/pub/thoth">ftp://ftp.cis.ufl.edu/pub/thoth</a> 2126e7d3316Smrg <li>Alpha version (last updated April 1993) 2136e7d3316Smrg</ul> 2146e7d3316Smrg<td>Robert Forsman<td>source<td>yes<td>?<td>NC 2156e7d3316Smrg 2166e7d3316Smrg<tr><td>vueicon<td><ul> 2176e7d3316Smrg <li>included with Vue3.0 2186e7d3316Smrg</ul> 2196e7d3316Smrg<td>Hewlett-Packard<td>HP<td>yes<td>3<td>N/A 2206e7d3316Smrg 2216e7d3316Smrg<tr><td>iconedit V3<td> <td>SunSoft<td>Sparc/Sun3<td>yes<td>2<td>N/A 2226e7d3316Smrg 2236e7d3316Smrg<tr><td>Pixmap Editor<td><ul> 2246e7d3316Smrg <li>this is a Widget, not a complete program 2256e7d3316Smrg</ul> 2266e7d3316Smrg<td>ICS<td>?<td>yes<td>?<td>? 2276e7d3316Smrg 2286e7d3316Smrg<tr><td>ezX<td> <td>Sunrise Softwarey<td>?<td>?<td>?<td>N/A 2296e7d3316Smrg 2306e7d3316Smrg<tr><td>XPaint<td><ul> 2316e7d3316Smrg <li>full featured, works on all displays 2326e7d3316Smrg <li>current release is 2.1.1 (last update January 1994) 2336e7d3316Smrg</ul> 2346e7d3316Smrg<td>David Koblas<td>source<td>yes<td>3<td>NC 2356e7d3316Smrg 2366e7d3316Smrg<tr><td>Phoenix<td><ul> 2376e7d3316Smrg <li>full featured, 24-bit painting program, requires Motif. 2386e7d3316Smrg <li><a href="ftp://nic.funet.fi/pub/graphics/packages/phoenix">ftp://nic.funet.fi/pub/graphics/packages/phoenix</a> 2396e7d3316Smrg <li>Beta version (last updated September 1993) 2406e7d3316Smrg</ul> 2416e7d3316Smrg<td>ohtcolor@niksula.hut.fi<td>source<td>yes<td>3<td>NC 2426e7d3316Smrg 2436e7d3316Smrg<tr><td>pixed<td><ul> 2446e7d3316Smrg <li>pixed is part of the TeleUSE UIMS 2456e7d3316Smrg <li>More info is available from service@ignite.alsys.com 2466e7d3316Smrg</ul> 2476e7d3316Smrg<td>Alsys<td>Many UNIX<td>yes<td>3<td>N/A 2486e7d3316Smrg 2496e7d3316Smrg<tr><td>display<td><ul> 2506e7d3316Smrg <li><a href="ftp://ftp.x.org/contrib/application/ImageMagick/ImageMagick-3.2.tar.gz">ftp://ftp.x.org/contrib/application/ImageMagick/ImageMagick-3.2.tar.gz</a> 2516e7d3316Smrg <li>lots of image conversion and manipulation features 2526e7d3316Smrg</ul> 2536e7d3316Smrg<td>John Cristy<td>source<td>yes<td>3<td>NC 2546e7d3316Smrg</table> 2556e7d3316Smrg 2566e7d3316Smrg<p> 2576e7d3316SmrgSA - Stand Alone program<br> 2586e7d3316SmrgNC - No Charge (i.e. free); most programs are copyrighted.<br> 2596e7d3316SmrgXPM - XPM format supported<br> 2606e7d3316Smrgsource - built from source code; likely works on all standard X platforms<br> 2616e7d3316SmrgN/A - icon editor is normally distributed with other software 2626e7d3316Smrg 2636e7d3316Smrg<p> 2646e7d3316SmrgSend updates, additions, corrections, etc. to <a 2656e7d3316Smrghref="mailto:dan@bristol.com">dan@bristol.com</a> 2666e7d3316Smrg 2676e7d3316Smrg 2686e7d3316Smrg<h2><a name="Q10">10. Is there a collection of icons somewhere ?</a></h2> 2696e7d3316Smrg<p> 2706e7d3316Smrg At least there is one freely available: Anthony's X Icon Library. You can 2716e7d3316Smrg found it on several ftp servers, such as <a href="ftp://server.berkeley.edu/pub/AIcons">server.berkeley.edu/pub/AIcons</a>. It 2726e7d3316Smrg contains only small icons (less than about 100x100 pixels in size) which are 2736e7d3316Smrg stored in groups in a logical way. Color icons are stored in XPM format and 2746e7d3316Smrg Black & White icons in XBM. 2756e7d3316Smrg 2766e7d3316Smrg 2776e7d3316Smrg<h2><a name="Q11">11. The documentation fails to print out. Why ?</a></h2> 2786e7d3316Smrg<p> 2796e7d3316Smrg The PostScript documentation file is formatted for US letter paper. Frame 2806e7d3316Smrg Maker tries very hard to ensure that you have the right paper and punts if 2816e7d3316Smrg you don't. However, you can easily work around this problem by applying the 2826e7d3316Smrg following patch. If for some reason applying the patch fails, you can still 2836e7d3316Smrg do it by hand. Just locate the corresponding block in the PS file and remove 2846e7d3316Smrg the lines with a leading '-' character. 2856e7d3316Smrg By the way, this applies to any doc generated by Frame Maker. The 2866e7d3316Smrg corresponding block might be slightly different depending on which version of 2876e7d3316Smrg Frame Maker was used, but it is still easy to locate. 2886e7d3316Smrg 2896e7d3316Smrg<pre> 2906e7d3316Smrg*** xpm.PS Wed Sep 11 15:47:43 1996 2916e7d3316Smrg--- xpm-A4.PS Thu Nov 21 09:27:28 1996 2926e7d3316Smrg*************** 2936e7d3316Smrg*** 647,668 **** 29497cf2ee2Smrg 0 ne /edown exch def 2956e7d3316Smrg /yscale exch def 2966e7d3316Smrg /xscale exch def 2976e7d3316Smrg- FMLevel1 { 2986e7d3316Smrg- manualfeed {setmanualfeed} if 29997cf2ee2Smrg- /FMdicttop countdictstack 1 add def 30097cf2ee2Smrg- /FMoptop count def 30197cf2ee2Smrg- setpapername 30297cf2ee2Smrg- manualfeed {true} {papersize} ifelse 30397cf2ee2Smrg- {manualpapersize} {false} ifelse 30497cf2ee2Smrg- {desperatepapersize} {false} ifelse 3056e7d3316Smrg- { (Can't select requested paper size for Frame print job!) FMFAILURE } if 3066e7d3316Smrg- count -1 FMoptop {pop pop} for 30797cf2ee2Smrg- countdictstack -1 FMdicttop {pop end} for 3086e7d3316Smrg- } 3096e7d3316Smrg- {{1 dict dup /PageSize [paperwidth paperheight]put setpagedevice}stopped 3106e7d3316Smrg- { (Can't select requested paper size for Frame print job!) FMFAILURE } if 3116e7d3316Smrg- {1 dict dup /ManualFeed manualfeed put setpagedevice } stopped pop } 31297cf2ee2Smrg- ifelse 31397cf2ee2Smrg 3146e7d3316Smrg FMPColor { 3156e7d3316Smrg currentcolorscreen 3166e7d3316Smrg--- 647,652 ---- 3176e7d3316Smrg</pre> 3186e7d3316Smrg 3196e7d3316Smrg 3206e7d3316Smrg<hr> 3216e7d3316Smrg<h2><a name="copy">Copyright (C) 1989-95 GROUPE BULL</a></h2> 3226e7d3316Smrg<p> 3236e7d3316SmrgPermission is hereby granted, free of charge, to any person obtaining a copy 3246e7d3316Smrgof this software and associated documentation files (the "Software"), to 3256e7d3316Smrgdeal in the Software without restriction, including without limitation the 3266e7d3316Smrgrights to use, copy, modify, merge, publish, distribute, sublicense, and/or 3276e7d3316Smrgsell copies of the Software, and to permit persons to whom the Software is 3286e7d3316Smrgfurnished to do so, subject to the following conditions: 3296e7d3316Smrg<p> 3306e7d3316SmrgThe above copyright notice and this permission notice shall be included in 3316e7d3316Smrgall copies or substantial portions of the Software. 3326e7d3316Smrg<p> 3336e7d3316SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 3346e7d3316SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 3356e7d3316SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 3366e7d3316SmrgGROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 3376e7d3316SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 3386e7d3316SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 3396e7d3316Smrg<p> 3406e7d3316SmrgExcept as contained in this notice, the name of GROUPE BULL shall not be 3416e7d3316Smrgused in advertising or otherwise to promote the sale, use or other dealings 3426e7d3316Smrgin this Software without prior written authorization from GROUPE BULL. 3436e7d3316Smrg</body> 3446e7d3316Smrg</html> 345