1 1.1 mrg <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2 1.1 mrg <html lang="en"> 3 1.1 mrg <HEAD> 4 1.1 mrg <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> 5 1.1 mrg <TITLE>XPM README</TITLE> 6 1.1 mrg </HEAD> 7 1.1 mrg 8 1.1 mrg <body> 9 1.1 mrg <h1 align="center">XPM README</h1> 10 1.1 mrg 11 1.1 mrg <h2>Contents</h2> 12 1.1 mrg 13 1.1 mrg <ol> 14 1.1 mrg <li><a href="#sec1">What Is XPM?</a> 15 1.1 mrg <li><a href="#sec2">Where to get XPM?</a> 16 1.1 mrg <li><a href="#sec3">Documentation</a> 17 1.1 mrg <li><a href="#sec4">Installation</a> 18 1.1 mrg <ol> 19 1.1 mrg <li><a href="#sec4.1">With imake</a> 20 1.1 mrg <li><a href="#sec4.2">Without imake</a> 21 1.1 mrg </ol> 22 1.1 mrg <li><a href="#sec5">SXPM</a> 23 1.1 mrg <li><a href="#sec6">CXPM</a> 24 1.1 mrg <li><a href="#sec7">Other Tools</a> 25 1.1 mrg <li><a href="#sec8">Discussion</a> 26 1.1 mrg <li><a href="#copy">Copyright</a> 27 1.1 mrg </ol> 28 1.1 mrg 29 1.1 mrg 30 1.1 mrg <h2><a name="sec1">1. What Is XPM?</a></h2> 31 1.1 mrg <p> 32 1.1 mrg XPM (X PixMap) is a format for storing/retrieving X pixmaps to/from files. 33 1.1 mrg <p> 34 1.1 mrg Here is provided a library containing a set of four functions, similar to the 35 1.1 mrg X bitmap functions as defined in the Xlib: <code>XpmCreatePixmapFromData</code>, 36 1.1 mrg <code>XpmCreateDataFromPixmap</code>, <code>XpmReadFileToPixmap</code> and <code>XpmWriteFileFromPixmap</code> for 37 1.1 mrg respectively including, storing, reading and writing this format, plus four 38 1.1 mrg other: <code>XpmCreateImageFromData</code>, <code>XpmCreateDataFromImage</code>, <code>XpmReadFileToImage</code> and 39 1.1 mrg <code>XpmWriteFileFromImage</code> for working with images instead of pixmaps. 40 1.1 mrg <p> 41 1.1 mrg This new version provides a C includable format, defaults for different types 42 1.1 mrg of display: monochrome/color/grayscale, hotspot coordinates and symbol names 43 1.1 mrg for colors for overriding default colors when creating the pixmap. It provides 44 1.1 mrg a mechanism for storing information while reading a file which is re-used 45 1.1 mrg while writing. This way comments, default colors and symbol names aren't lost. 46 1.1 mrg It also handles "transparent pixels" by returning a shape mask in addition to 47 1.1 mrg the created pixmap. 48 1.1 mrg <p> 49 1.1 mrg See the XPM Manual for details. 50 1.1 mrg 51 1.1 mrg 52 1.1 mrg <h2><a name="sec2">2. Where to get XPM?</a></h2> 53 1.1 mrg <p> 54 1.1 mrg New XPM updates are announced on the comp.windows.x newsgroup, and on the 55 1.1 mrg "xpm-talk" list and you can always consult the XPM Home page at <a 56 1.1 mrg href="http://www.inria.fr/koala/lehors/xpm.html">http://www.inria.fr/koala/lehors/xpm.html</a> 57 1.1 mrg <p>The latest "official" XPM release can always be found at: 58 1.1 mrg <br>Boston, USA: <a 59 1.1 mrg href="ftp://ftp.x.org/contrib">ftp://ftp.x.org/contrib</a> 60 1.1 mrg <br>Sophia Antipolis, France: <a 61 1.1 mrg href="ftp://koala.inria.fr/pub/xpm">ftp://koala.inria.fr/pub/xpm</a> 62 1.1 mrg 63 1.1 mrg 64 1.1 mrg <h2><a name="sec3">3. Documentation</a></h2> 65 1.1 mrg <p> 66 1.1 mrg Old users might read the <a href="CHANGES">CHANGES</a> file for a history 67 1.1 mrg of changes interesting the user. 68 1.1 mrg <p> 69 1.1 mrg Read the doc. The documentation is in PostScript format (<a 70 1.1 mrg href="doc/xpm.PS">doc/xpm.PS</a>) and has been produced with 71 1.1 mrg FrameMaker. The source files are available on request. 72 1.1 mrg <p> 73 1.1 mrg A <a href="FAQ.html">FAQ</a> (Frequently Asked Questions) is also provided, 74 1.1 mrg so if you experience any problem you should have a look at this file. 75 1.1 mrg 76 1.1 mrg 77 1.1 mrg <h2><a name="sec4">4. Installation</a></h2> 78 1.1 mrg <p> 79 1.1 mrg To obtain the XPM library, first uncompress and untar the compressed tar file 80 1.1 mrg in an appropriate directory. 81 1.1 mrg <p> 82 1.1 mrg Then you can either compile XPM via "imake" or in a stand-alone way. 83 1.1 mrg 84 1.1 mrg <h3><a name="sec4.1">4.1. With imake</a></h3> 85 1.1 mrg <p> 86 1.1 mrg Imakefiles are provided to build both shared and unshared libraries. 87 1.1 mrg However, building a shared lib is very OS dependent and often requires 88 1.1 mrg specific files which are not available. Also config files are often not 89 1.1 mrg set correctly for this task. So if it fails you can avoid trying to 90 1.1 mrg build one and simply build the static library instead. In order to do 91 1.1 mrg so you should edit the top Imakefile to add -DSharedLibXpm=NO to the 92 1.1 mrg definition of IMAKE_DEFINES as described. 93 1.1 mrg <p> 94 1.1 mrg The compilation and installation of the library and the sxpm program 95 1.1 mrg should only require you to edit the top Imakefile. But you should do so 96 1.1 mrg in order to specify the locations where the various files should be 97 1.1 mrg installed and to set the DEFINES variable accordingly to your system. 98 1.1 mrg <p> 99 1.1 mrg On Solaris 2.* the compilation works only in the native svr4 100 1.1 mrg environment, avoid the bsd one or it won't compile. Especially you 101 1.1 mrg should be using /opt/SUNWspro/bin/cc and not /usr/ucb/cc. 102 1.1 mrg Also since the compiler is no longer part of the OS distribution a lot 103 1.1 mrg of people use gcc instead. This is fine, but be aware that the imake 104 1.1 mrg tool you get as part of the X Window System on a solaris box is 105 1.1 mrg configured for cc. Therefore the compilation using the generated 106 1.1 mrg Makefiles will not succeed unless you have changed the default 107 1.1 mrg configuration. An easy work around is to directly edit the generated 108 1.1 mrg lib/Makefile to change '-K pic' to '-fpic'. Fixing your imake 109 1.1 mrg configuration would be better though. 110 1.1 mrg <p> 111 1.1 mrg On Linux, if you do not use ELF yet you'd better get the binary 112 1.1 mrg distribution available from sunsite. Because it's really a pain to 113 1.1 mrg build a shared lib and the current XPM distribution doesn't contain 114 1.1 mrg the jump files you would need to do so. On the other hand people have 115 1.1 mrg had no problems building it using ELF. 116 1.1 mrg <p> 117 1.1 mrg Then execute the following command: 118 1.1 mrg <pre> 119 1.1 mrg xmkmf -a 120 1.1 mrg </pre> 121 1.1 mrg <p> 122 1.1 mrg or if this option is not supported by your version of xmkmf: 123 1.1 mrg <pre> 124 1.1 mrg xmkmf 125 1.1 mrg make Makefiles 126 1.1 mrg make includes 127 1.1 mrg make depend (optional) 128 1.1 mrg </pre> 129 1.1 mrg <p> 130 1.1.1.2 mrg Then simply execute: 131 1.1 mrg <pre> 132 1.1 mrg make 133 1.1 mrg </pre> 134 1.1 mrg <p> 135 1.1.1.2 mrg which will build the XPM library and the sxpm application. 136 1.1 mrg Then do: 137 1.1 mrg <pre> 138 1.1 mrg make install 139 1.1 mrg make install.man 140 1.1 mrg </pre> 141 1.1 mrg <p> 142 1.1 mrg which will install the library and the sxpm program and man page. 143 1.1 mrg <p> 144 1.1 mrg If it fails, be sure you have set the DEFINES correctly in the top 145 1.1 mrg Imakefile to suit your machine. 146 1.1 mrg 147 1.1 mrg <h4>NOTE ON USING IMAKE:</h4> 148 1.1 mrg <p> 149 1.1 mrg Building the XPM distribution with imake requires to have imake 150 1.1 mrg <strong>correctly installed and configured</strong> on your 151 1.1 mrg system. I do my best at tweaking the Imakefiles so they work with 152 1.1 mrg as many imake flavors people might have as possible but there is 153 1.1 mrg nothing I can do against wrong imake configurations. So if your 154 1.1 mrg build fails using imake, don't send me email for advice. Get your 155 1.1 mrg imake configuration fixed or forget about it! 156 1.1 mrg 157 1.1 mrg 158 1.1 mrg <h3><a name="sec4.2">4.2. Without imake</a></h3> 159 1.1 mrg <p> 160 1.1 mrg A set of makefiles is provided for those who do not have imake 161 1.1 mrg available on their system. However, this is only provided as a 162 1.1 mrg convenience and you should be considered as a starting point and not as 163 1.1 mrg something ready to use. These makefiles, called Makefile.noX, will most 164 1.1 mrg likely require some editing in order be set accordingly to your system. 165 1.1 mrg <p> 166 1.1 mrg Once this setting is done, you should be able to compile XPM, by 167 1.1 mrg executing the following command: 168 1.1 mrg <pre> 169 1.1 mrg make -f Makefile.noX 170 1.1 mrg </pre> 171 1.1 mrg <p> 172 1.1 mrg Then to install it, do: 173 1.1 mrg <pre> 174 1.1 mrg make -f Makefile.noX install 175 1.1 mrg </pre> 176 1.1 mrg 177 1.1 mrg 178 1.1 mrg <h2><a name="sec5">5. SXPM</a></h2> 179 1.1 mrg <p> 180 1.1 mrg In addition to the library the sxpm tool is provided to show XPM file and 181 1.1 mrg convert them from XPM1 or XPM2 to XPM version 3. If you have previously done 182 1.1 mrg 'make' or 'make all' you should already have it, otherwise just do: 183 1.1 mrg <pre> 184 1.1 mrg cd sxpm; make 185 1.1 mrg </pre> 186 1.1 mrg <p> 187 1.1 mrg This application shows you most of the features of XPM and its source can be 188 1.1 mrg used to quickly see how to use the provided functions. 189 1.1 mrg <p> 190 1.1 mrg By executing 'sxpm -help' you will get the usage. 191 1.1 mrg <p> 192 1.1 mrg Executing 'sxpm -plaid' will show a demo of the XpmCreatePixmapFromData 193 1.1 mrg function. The pixmap is created from the static variable plaid defined in the 194 1.1 mrg sxpm.c file. sxpm will end when you press the key 'q' in the created window. 195 1.1 mrg <p> 196 1.1 mrg Executing 'sxpm -plaid -sc lines_in_mix blue' will show the feature of 197 1.1 mrg overriding color symbols giving a colorname, executing 'sxpm -plaid -sp 198 1.1 mrg lines_in_mix 1' will show overriding giving a pixel value, and executing 'sxpm 199 1.1 mrg -plaid -cp red 0' will show overriding giving a color value. 200 1.1 mrg <p> 201 1.1 mrg Then you should try 'sxpm -plaid -o output' to get an output file using the 202 1.1 mrg XpmWriteFileFromPixmap function. 203 1.1 mrg <p> 204 1.1 mrg You can now try 'sxpm -plaid -o - -nod -rgb /usr/lib/X11/rgb.txt' to directly 205 1.1 mrg get the pixmap printed out on the standard output with colornames instead of 206 1.1 mrg rgb values. 207 1.1 mrg <p> 208 1.1 mrg Then you should try 'sxpm plaid.xpm' to use the XpmReadFileToPixmap function, 209 1.1 mrg and 'cat plaid_mask.xpm|sxpm' to see how "transparent pixels" are handled. 210 1.1 mrg <p> 211 1.1 mrg The XpmCreatePixmapFromData function is on purpose called without any XpmInfos 212 1.1 mrg flag to show the utility of this one. Indeed, compare the color section of the 213 1.1 mrg two files foo and bar obtained from 'sxpm -nod -plaid -o foo' and 'sxpm -nod 214 1.1 mrg plaid.xpm -o bar'. All the default colors and also the comments have been 215 1.1 mrg restored. 216 1.1 mrg <p> 217 1.1 mrg To end look at plaid_ext.xpm and try "sxpm -nod plaid_ext.xpm -v" to see how 218 1.1 mrg extensions are handled. 219 1.1 mrg <p> 220 1.1 mrg Of course, other combinations are allowed and should be tried. Thus, 'sxpm 221 1.1 mrg plaid.xpm -o output -nod' will show you how to convert a file from XPM1 or XPM2 222 1.1 mrg to a XPM version 3 using sxpm. 223 1.1 mrg <p> 224 1.1 mrg See the manual page for more detail. 225 1.1 mrg 226 1.1 mrg 227 1.1 mrg <h2><a name="sec6">6. CXPM</a></h2> 228 1.1 mrg <p> 229 1.1 mrg The cxpm tool is provided to help you figure out whether an XPM file is correct 230 1.1 mrg or not with regard to its format. If you have previously done 'make' or 231 1.1 mrg 'make all' you should already have it, otherwise just do: 232 1.1 mrg <pre> 233 1.1 mrg cd cxpm; make 234 1.1 mrg </pre> 235 1.1 mrg <p> 236 1.1 mrg The related man page will tell you everything about it but here is a simple 237 1.1 mrg example of what it does: 238 1.1 mrg <pre> 239 1.1 mrg $ ./cxpm bogus_pixmap 240 1.1 mrg Xpm Error: Invalid XPM file. 241 1.1 mrg Error found line 3 near character 5 242 1.1 mrg </pre> 243 1.1 mrg <p> 244 1.1 mrg It is pretty limited but at least, unlike sxpm, it gives you some hint on where 245 1.1.1.3 mrg the error occurred within the file. 246 1.1 mrg 247 1.1 mrg 248 1.1 mrg <h2><a name="sec7">7. Other Tools</a></h2> 249 1.1 mrg <p> 250 1.1 mrg Several converters dealing with XPM and a pixmap editor can be found in the 251 1.1 mrg xpm-contrib distribution. Also I recommend the use of netpbm to do any kind of 252 1.1 mrg general image operations such as scaling, resizing, dithering, and to convert 253 1.1 mrg from and to any other image format. 254 1.1 mrg 255 1.1 mrg <h2><a name="sec8">8. Discussion</a></h2> 256 1.1 mrg <p> 257 1.1 mrg There is a mailing list to discuss about XPM which is <a 258 1.1 mrg href="mailto:xpm-talk (a] sophia.inria.fr">xpm-talk (a] sophia.inria.fr</a>. 259 1.1 mrg Any request to subscribe should be sent to <a 260 1.1 mrg href="mailto:xpm-talk-request (a] sophia.inria.fr">xpm-talk-request (a] sophia.inria.fr</a>. 261 1.1 mrg The archive of the xpm-talk list is available through the web at 262 1.1 mrg <a 263 1.1 mrg href="http://zenon.inria.fr/koala/xpm-talk-hypermail">http://zenon.inria.fr/koala/xpm-talk-hypermail</a> 264 1.1 mrg and through ftp at <a 265 1.1 mrg href="ftp://koala.inria.fr/pub/xpm/xpm-talk-archive">ftp://koala.inria.fr/pub/xpm/xpm-talk-archive</a> 266 1.1 mrg <p> 267 1.1 mrg Please mail any bug reports or modifications done, comments, suggestions, 268 1.1 mrg requests for updates or patches to port on another machine to: 269 1.1 mrg 270 1.1 mrg <p>Email: <a href="lehors (a] sophia.inria.fr">lehors (a] sophia.inria.fr</a> 271 1.1 mrg <br>Phone: +33 (0)4 93 65 78 89 272 1.1 mrg <br>Surface Mail:<br> 273 1.1 mrg Arnaud Le Hors<br> 274 1.1 mrg Inria BP.93<br> 275 1.1 mrg 2004, Route des lucioles<br> 276 1.1 mrg 06902 Sophia Antipolis Cedex<br> 277 1.1 mrg FRANCE 278 1.1 mrg 279 1.1 mrg 280 1.1 mrg <hr> 281 1.1 mrg <h2><a name="copy">Copyright (C) 1989-95 GROUPE BULL</a></h2> 282 1.1 mrg <p> 283 1.1 mrg Permission is hereby granted, free of charge, to any person obtaining a copy 284 1.1 mrg of this software and associated documentation files (the "Software"), to 285 1.1 mrg deal in the Software without restriction, including without limitation the 286 1.1 mrg rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 287 1.1 mrg sell copies of the Software, and to permit persons to whom the Software is 288 1.1 mrg furnished to do so, subject to the following conditions: 289 1.1 mrg <p> 290 1.1 mrg The above copyright notice and this permission notice shall be included in 291 1.1 mrg all copies or substantial portions of the Software. 292 1.1 mrg <p> 293 1.1 mrg THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 294 1.1 mrg IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 295 1.1 mrg FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 296 1.1 mrg GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 297 1.1 mrg AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 298 1.1 mrg CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 299 1.1 mrg <p> 300 1.1 mrg Except as contained in this notice, the name of GROUPE BULL shall not be 301 1.1 mrg used in advertising or otherwise to promote the sale, use or other dealings 302 1.1 mrg in this Software without prior written authorization from GROUPE BULL. 303 1.1 mrg </body> 304