| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 |
<html lang="en"> |
| 3 |
<HEAD> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| 5 |
<TITLE>FAQ XPM</TITLE> |
| 6 |
</HEAD> |
| 7 |
|
| 8 |
<body> |
| 9 |
<h1 align="center">The XPM<br> |
| 10 |
Frequently Asked Questions</h1> |
| 11 |
<p> |
| 12 |
This article contains the answers to some Frequently Asked Questions about the |
| 13 |
XPM format and/or library. If you don't find the answer to your problem here, |
| 14 |
then you can mail either to [email protected] or to the mailing list |
| 15 |
[email protected]. |
| 16 |
|
| 17 |
|
| 18 |
<h2>Contents</h2> |
| 19 |
|
| 20 |
<ol> |
| 21 |
<li><a href="#Q1">How do I convert my images to or from XPM ?</a> |
| 22 |
<li><a href="#Q2">Why are my XPM files said to be invalid ?</a> |
| 23 |
<li><a href="#Q3">Why does my program core dumps using XPM ?</a> |
| 24 |
<li><a href="#Q4">Why does my program core dumps using XPM with a widget ?</a> |
| 25 |
<li><a href="#Q5">How can I get a non rectangular icon using XPM ?</a> |
| 26 |
<li><a href="#Q6">What exactly triggers the creation of a mask when using XPM ?</a> |
| 27 |
<li><a href="#Q7">How should I use the mask ?</a> |
| 28 |
<li><a href="#Q8">Is there a string to pixmap converter somewhere ?</a> |
| 29 |
<li><a href="#Q9">How can I edit XPM icons ?</a> |
| 30 |
<li><a href="#Q10">Is there a collection of icons somewhere ?</a> |
| 31 |
<li><a href="#Q11">The documentation fails to print out. Why ?</a> |
| 32 |
<li><a href="#copy">Copyright</a> |
| 33 |
</ol> |
| 34 |
|
| 35 |
|
| 36 |
<h2><a name="Q1">1. How do I convert my images to or from XPM ?</a></h2> |
| 37 |
<p> |
| 38 |
Netpbm is surely the best image conversion package that I know of. It defines |
| 39 |
formats for color, gray and monochrome images and provides a set of filters. |
| 40 |
Thus a GIF image can be converted to XPM with something like: |
| 41 |
<p> |
| 42 |
$ giftoppm youricon.gif | ppmtoxpm > youricon.xpm |
| 43 |
<p> |
| 44 |
The latest release can be found at least from wuarchive.wustl.edu |
| 45 |
(128.252.135.4), directory /graphics/graphics/packages/NetPBM |
| 46 |
|
| 47 |
|
| 48 |
<h2><a name="Q2">2. Why are my XPM files said to be invalid ?</a></h2> |
| 49 |
<p> |
| 50 |
There are three official versions of the XPM format. The XPM library since |
| 51 |
version 3.3 can read all them but writes out only XPM 3. Also the small |
| 52 |
program called sxpm which is part of the XPM library package can be used to |
| 53 |
automatically translate XPM 1 and 2 files to XPM 3 with a command such as: |
| 54 |
<p> |
| 55 |
$ sxpm -nod yourxpm1or2file -o yourxpm3file |
| 56 |
<p> |
| 57 |
Also, the XPM format defines "None" to be the color name meaning |
| 58 |
"transparent", but IXI used to hack the XPM library in its early days to |
| 59 |
handle transparency as "#Transparent". This makes IXI format not compatible |
| 60 |
with the official XPM format, and so not readable neither by the official XPM |
| 61 |
library nor any of the programs built on top of it. |
| 62 |
<p> |
| 63 |
The only solutions are either to stick on IXI programs which can deal with |
| 64 |
their format or convert your files to the standard XPM format. This can be |
| 65 |
done simply by changing "#Transparent" to "None". |
| 66 |
|
| 67 |
|
| 68 |
<h2><a name="Q3">3. Why does my program core dumps using XPM ?</a></h2> |
| 69 |
<p> |
| 70 |
Be sure the XpmAttributes structure you pass by reference has a valid |
| 71 |
valuemask. You can give NULL instead if you don't want to use an |
| 72 |
XpmAttributes but if you do, you MUST initialize its valuemask component to |
| 73 |
some valid value, at least 0, otherwise unpredictable errors can occur. |
| 74 |
<p> |
| 75 |
So instead of doing something like: |
| 76 |
<pre> |
| 77 |
XpmAttributes attrib; |
| 78 |
|
| 79 |
XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib); |
| 80 |
</pre> |
| 81 |
<p> |
| 82 |
you should do: |
| 83 |
<pre> |
| 84 |
XpmAttributes attrib; |
| 85 |
|
| 86 |
attrib.valuemask = 0; |
| 87 |
XpmReadFileToPixmap(dpy, d, filename, &pixmap, &mask, &attrib); |
| 88 |
</pre> |
| 89 |
|
| 90 |
|
| 91 |
<h2><a name="Q4">4. Why does my program core dumps using XPM with a widget ?</a></h2> |
| 92 |
<ul> |
| 93 |
<li>First the XPM library is Xlib level, so don't pass your widget as a |
| 94 |
Drawable parameter. A Drawable is either a Window or a Pixmap. The widget's |
| 95 |
window can do the job but: |
| 96 |
|
| 97 |
<li>Then a widget only gets a Window when realized, so passing XtWindow(widget) |
| 98 |
with a not yet realized widget is wrong. Either realize you widget first or |
| 99 |
use another window. Since the Drawable parameter is only used to specify |
| 100 |
the screen to which the pixmap must be created on, most of the time the |
| 101 |
default root window is just fine. |
| 102 |
</ul> |
| 103 |
|
| 104 |
|
| 105 |
<h2><a name="Q5">5. How can I get a non rectangular icon using XPM ?</a></h2> |
| 106 |
<p> |
| 107 |
The X Window System does not support transparent color. However there are |
| 108 |
several ways you can use to get the same visual effect using XPM: |
| 109 |
<ul> |
| 110 |
<li>First you can use the None color to get a shape mask and use it as |
| 111 |
explained below (question 7). |
| 112 |
|
| 113 |
<li>Second you can define a symbolic color name such as "mask" in the XPM |
| 114 |
format file, then use the color overriding mechanism to set this symbolic |
| 115 |
color to the color of the underlying object. Note that in this case the XPM |
| 116 |
library won't create a shape mask, and that if the color of the underlying |
| 117 |
object is changed then you'll have to create a new pixmap. |
| 118 |
</ul> |
| 119 |
|
| 120 |
|
| 121 |
<h2><a name="Q6">6. What exactly triggers the creation of a mask when using XPM ?</a></h2> |
| 122 |
<p> |
| 123 |
Basically a mask is created if "None" is used as one of the color of the |
| 124 |
pixmap. Be aware that this is not only true if it is used in the XPM of the |
| 125 |
pixmap since the colors can be overridden at load time. So a mask is created |
| 126 |
if the "None" color is used at load time, coming either from the XPM |
| 127 |
definition or the color overriding. |
| 128 |
|
| 129 |
|
| 130 |
<h2><a name="Q7">7. How should I use the mask ?</a></h2> |
| 131 |
<p> |
| 132 |
There are basically two ways of using the mask: |
| 133 |
<ul> |
| 134 |
<li>Use the mask as a shapemask with the X11 Nonrectangular Saphe Window |
| 135 |
Extension. Typically this is what should be done when the icon is used in a |
| 136 |
desktop. |
| 137 |
|
| 138 |
<li>Use the mask as a clipmask in the GC you pass to XCopyArea when drawing the |
| 139 |
pixmap. So the "transparent" pixels being not actually drawn will get the |
| 140 |
underlying pixels colors. |
| 141 |
</ul> |
| 142 |
|
| 143 |
|
| 144 |
<h2><a name="Q8">8. Is there a string to pixmap converter for Motif ?</a></h2> |
| 145 |
<p> |
| 146 |
Yes, Motif 2.0 or later does support XPM pixmaps as well as XBM bitmaps. |
| 147 |
|
| 148 |
|
| 149 |
<h2><a name="Q9">9. How can I edit XPM icons ?</a></h2> |
| 150 |
<p> |
| 151 |
As listed below several editors either commercial or not are supporting the |
| 152 |
XPM format. However, pixmap is the one I would recommend since it is freely |
| 153 |
available and, being fully dedicated to XPM, it allows to edit all the |
| 154 |
special things, such as the symbolic color names, which makes XPM different |
| 155 |
from all the other image formats. Pixmap can always be found by ftp from |
| 156 |
ftp.x.org (contrib) and avahi.inria.fr (pub/pixmap). |
| 157 |
<p> |
| 158 |
Last Update: 3 August 1994 |
| 159 |
<table border=1> |
| 160 |
<caption>XPM Icon Editors</caption> |
| 161 |
<tr><th>Program<th>Infos<th>Source/Author<th>Platforms<th>SA<th>XPM<th>cost |
| 162 |
<tr><td>pixmap<td><ul> |
| 163 |
<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> |
| 164 |
<li>requires 3.4 or higher revision of Xpm lib. |
| 165 |
<li>supports all XPM format features |
| 166 |
<li>current version doesn't work on 24-plane displays |
| 167 |
</ul> |
| 168 |
<td>Lionel Mallet<td>source<td>yes<td>3<td>NC |
| 169 |
|
| 170 |
<tr><td>pixt<td><ul> |
| 171 |
<li><a href="ftp://ftp.x.org/contrib/pixt.tar.Z">ftp://ftp.x.org/contrib/pixt.tar.Z</a> |
| 172 |
<li>doesn't work on 24-plane displays |
| 173 |
<li>last updated November 1991 |
| 174 |
</ul> |
| 175 |
<td>J. Michael Flanery<td>source<td>yes<td>1<td>NC |
| 176 |
|
| 177 |
<tr><td>pixed<td><ul> |
| 178 |
<li>part of X.desktop |
| 179 |
<li>current version doesn't work on 24-plane displays |
| 180 |
</ul> |
| 181 |
<td>IXI<td>Many UNIX<td>no<td>3<td>N/A |
| 182 |
|
| 183 |
<tr><td>olpixmap<td><ul> |
| 184 |
<li>packaged with the OLIT (OpenLook) toolkit |
| 185 |
</ul> |
| 186 |
<td>USL<td>Sun, SVR4.2, UnixWare<td>no<td>1<td>N/A |
| 187 |
|
| 188 |
<tr><td>xfedor<td><ul> |
| 189 |
<li>only uses XLIB |
| 190 |
<li>doesn't work on 24-plane displays |
| 191 |
</ul> |
| 192 |
<td>Daniel Dardailler<td>source<td>yes<td>3<td>NC |
| 193 |
|
| 194 |
<tr><td>SCOpaint<td><ul> |
| 195 |
<li>included with the ODT package |
| 196 |
</ul> |
| 197 |
<td>SCO/Wing Eng<td>ODT<td>yes<td>2.8<td>N/A |
| 198 |
|
| 199 |
<tr><td>pme.icn<td><ul> |
| 200 |
<li>written in the Icon language |
| 201 |
</ul> |
| 202 |
<td>Icon Project<td>source<td>yes<td>3<td>NC |
| 203 |
|
| 204 |
<tr><td>PixEditT<td><ul> |
| 205 |
<li>there is currently no support for editing the colormap |
| 206 |
</ul> |
| 207 |
<td>Free Widget Foundation<td>source<td>yes<td>3<td>NC |
| 208 |
|
| 209 |
<tr><td>xscribble<td><ul> |
| 210 |
<li>requires the FWF, 8-bit pseudocolor |
| 211 |
<li><a href="ftp://ftp.cis.ufl.edu/pub/thoth">ftp://ftp.cis.ufl.edu/pub/thoth</a> |
| 212 |
<li>Alpha version (last updated April 1993) |
| 213 |
</ul> |
| 214 |
<td>Robert Forsman<td>source<td>yes<td>?<td>NC |
| 215 |
|
| 216 |
<tr><td>vueicon<td><ul> |
| 217 |
<li>included with Vue3.0 |
| 218 |
</ul> |
| 219 |
<td>Hewlett-Packard<td>HP<td>yes<td>3<td>N/A |
| 220 |
|
| 221 |
<tr><td>iconedit V3<td> <td>SunSoft<td>Sparc/Sun3<td>yes<td>2<td>N/A |
| 222 |
|
| 223 |
<tr><td>Pixmap Editor<td><ul> |
| 224 |
<li>this is a Widget, not a complete program |
| 225 |
</ul> |
| 226 |
<td>ICS<td>?<td>yes<td>?<td>? |
| 227 |
|
| 228 |
<tr><td>ezX<td> <td>Sunrise Softwarey<td>?<td>?<td>?<td>N/A |
| 229 |
|
| 230 |
<tr><td>XPaint<td><ul> |
| 231 |
<li>full featured, works on all displays |
| 232 |
<li>current release is 2.1.1 (last update January 1994) |
| 233 |
</ul> |
| 234 |
<td>David Koblas<td>source<td>yes<td>3<td>NC |
| 235 |
|
| 236 |
<tr><td>Phoenix<td><ul> |
| 237 |
<li>full featured, 24-bit painting program, requires Motif. |
| 238 |
<li><a href="ftp://nic.funet.fi/pub/graphics/packages/phoenix">ftp://nic.funet.fi/pub/graphics/packages/phoenix</a> |
| 239 |
<li>Beta version (last updated September 1993) |
| 240 |
</ul> |
| 241 |
<td>[email protected]<td>source<td>yes<td>3<td>NC |
| 242 |
|
| 243 |
<tr><td>pixed<td><ul> |
| 244 |
<li>pixed is part of the TeleUSE UIMS |
| 245 |
<li>More info is available from [email protected] |
| 246 |
</ul> |
| 247 |
<td>Alsys<td>Many UNIX<td>yes<td>3<td>N/A |
| 248 |
|
| 249 |
<tr><td>display<td><ul> |
| 250 |
<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> |
| 251 |
<li>lots of image conversion and manipulation features |
| 252 |
</ul> |
| 253 |
<td>John Cristy<td>source<td>yes<td>3<td>NC |
| 254 |
</table> |
| 255 |
|
| 256 |
<p> |
| 257 |
SA - Stand Alone program<br> |
| 258 |
NC - No Charge (i.e. free); most programs are copyrighted.<br> |
| 259 |
XPM - XPM format supported<br> |
| 260 |
source - built from source code; likely works on all standard X platforms<br> |
| 261 |
N/A - icon editor is normally distributed with other software |
| 262 |
|
| 263 |
<p> |
| 264 |
Send updates, additions, corrections, etc. to <a |
| 265 |
href="mailto:[email protected]">[email protected]</a> |
| 266 |
|
| 267 |
|
| 268 |
<h2><a name="Q10">10. Is there a collection of icons somewhere ?</a></h2> |
| 269 |
<p> |
| 270 |
At least there is one freely available: Anthony's X Icon Library. You can |
| 271 |
found it on several ftp servers, such as <a href="ftp://server.berkeley.edu/pub/AIcons">server.berkeley.edu/pub/AIcons</a>. It |
| 272 |
contains only small icons (less than about 100x100 pixels in size) which are |
| 273 |
stored in groups in a logical way. Color icons are stored in XPM format and |
| 274 |
Black & White icons in XBM. |
| 275 |
|
| 276 |
|
| 277 |
<h2><a name="Q11">11. The documentation fails to print out. Why ?</a></h2> |
| 278 |
<p> |
| 279 |
The PostScript documentation file is formatted for US letter paper. Frame |
| 280 |
Maker tries very hard to ensure that you have the right paper and punts if |
| 281 |
you don't. However, you can easily work around this problem by applying the |
| 282 |
following patch. If for some reason applying the patch fails, you can still |
| 283 |
do it by hand. Just locate the corresponding block in the PS file and remove |
| 284 |
the lines with a leading '-' character. |
| 285 |
By the way, this applies to any doc generated by Frame Maker. The |
| 286 |
corresponding block might be slightly different depending on which version of |
| 287 |
Frame Maker was used, but it is still easy to locate. |
| 288 |
|
| 289 |
<pre> |
| 290 |
*** xpm.PS Wed Sep 11 15:47:43 1996 |
| 291 |
--- xpm-A4.PS Thu Nov 21 09:27:28 1996 |
| 292 |
*************** |
| 293 |
*** 647,668 **** |
| 294 |
0 ne /edown exch def |
| 295 |
/yscale exch def |
| 296 |
/xscale exch def |
| 297 |
- FMLevel1 { |
| 298 |
- manualfeed {setmanualfeed} if |
| 299 |
- /FMdicttop countdictstack 1 add def |
| 300 |
- /FMoptop count def |
| 301 |
- setpapername |
| 302 |
- manualfeed {true} {papersize} ifelse |
| 303 |
- {manualpapersize} {false} ifelse |
| 304 |
- {desperatepapersize} {false} ifelse |
| 305 |
- { (Can't select requested paper size for Frame print job!) FMFAILURE } if |
| 306 |
- count -1 FMoptop {pop pop} for |
| 307 |
- countdictstack -1 FMdicttop {pop end} for |
| 308 |
- } |
| 309 |
- {{1 dict dup /PageSize [paperwidth paperheight]put setpagedevice}stopped |
| 310 |
- { (Can't select requested paper size for Frame print job!) FMFAILURE } if |
| 311 |
- {1 dict dup /ManualFeed manualfeed put setpagedevice } stopped pop } |
| 312 |
- ifelse |
| 313 |
|
| 314 |
FMPColor { |
| 315 |
currentcolorscreen |
| 316 |
--- 647,652 ---- |
| 317 |
</pre> |
| 318 |
|
| 319 |
|
| 320 |
<hr> |
| 321 |
<h2><a name="copy">Copyright (C) 1989-95 GROUPE BULL</a></h2> |
| 322 |
<p> |
| 323 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 324 |
of this software and associated documentation files (the "Software"), to |
| 325 |
deal in the Software without restriction, including without limitation the |
| 326 |
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 327 |
sell copies of the Software, and to permit persons to whom the Software is |
| 328 |
furnished to do so, subject to the following conditions: |
| 329 |
<p> |
| 330 |
The above copyright notice and this permission notice shall be included in |
| 331 |
all copies or substantial portions of the Software. |
| 332 |
<p> |
| 333 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 334 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 335 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 336 |
GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 337 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 338 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 339 |
<p> |
| 340 |
Except as contained in this notice, the name of GROUPE BULL shall not be |
| 341 |
used in advertising or otherwise to promote the sale, use or other dealings |
| 342 |
in this Software without prior written authorization from GROUPE BULL. |
| 343 |
</body> |
| 344 |
</html> |