summaryrefslogtreecommitdiff
path: root/lib/libXpm/README.html
blob: 6711f23b32504ab817aebe126017ea4fd49fe61e (plain)
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>XPM README</TITLE>
</HEAD>

<body>
<h1 align="center">XPM README</h1>

<h2>Contents</h2>

<ol>
<li><a href="#sec1">What Is XPM?</a>
<li><a href="#sec2">Where to get XPM?</a>
<li><a href="#sec3">Documentation</a>
<li><a href="#sec4">Installation</a>
<ol>
<li><a href="#sec4.1">With imake</a>
<li><a href="#sec4.2">Without imake</a>
</ol>
<li><a href="#sec5">SXPM</a>
<li><a href="#sec6">CXPM</a>
<li><a href="#sec7">Other Tools</a>
<li><a href="#sec8">Discussion</a>
<li><a href="#copy">Copyright</a>
</ol>


<h2><a name="sec1">1. What Is XPM?</a></h2>
<p>
XPM (X PixMap) is a format for storing/retrieving X pixmaps to/from files.
<p>
Here is provided a library containing a set of four functions, similar to the
X bitmap functions as defined in the Xlib: <code>XpmCreatePixmapFromData</code>,
<code>XpmCreateDataFromPixmap</code>, <code>XpmReadFileToPixmap</code> and <code>XpmWriteFileFromPixmap</code> for
respectively including, storing, reading and writing this format, plus four
other: <code>XpmCreateImageFromData</code>, <code>XpmCreateDataFromImage</code>, <code>XpmReadFileToImage</code> and
<code>XpmWriteFileFromImage</code> for working with images instead of pixmaps.
<p>
This new version provides a C includable format, defaults for different types
of display: monochrome/color/grayscale, hotspot coordinates and symbol names
for colors for overriding default colors when creating the pixmap. It provides
a mechanism for storing information while reading a file which is re-used
while writing. This way comments, default colors and symbol names aren't lost.
It also handles "transparent pixels" by returning a shape mask in addition to
the created pixmap.
<p>
See the XPM Manual for details.


<h2><a name="sec2">2. Where to get XPM?</a></h2>
<p>
New XPM updates are announced on the comp.windows.x newsgroup, and on the
"xpm-talk" list and you can always consult the XPM Home page at <a
href="http://www.inria.fr/koala/lehors/xpm.html">http://www.inria.fr/koala/lehors/xpm.html</a>
<p>The latest "official" XPM release can always be found at:
<br>Boston, USA: <a
href="ftp://ftp.x.org/contrib">ftp://ftp.x.org/contrib</a>
<br>Sophia Antipolis, France: <a
href="ftp://koala.inria.fr/pub/xpm">ftp://koala.inria.fr/pub/xpm</a>


<h2><a name="sec3">3. Documentation</a></h2>
<p>
Old users might read the <a href="CHANGES">CHANGES</a> file for a history
of changes interesting the user.
<p>
Read the doc. The documentation is in PostScript format (<a
href="doc/xpm.PS">doc/xpm.PS</a>) and has been produced with
FrameMaker. The source files are available on request.
<p>
A <a href="FAQ.html">FAQ</a> (Frequently Asked Questions) is also provided,
so if you experience any problem you should have a look at this file.


<h2><a name="sec4">4. Installation</a></h2>
<p>
To obtain the XPM library, first uncompress and untar the compressed tar file
in an appropriate directory.
<p>
Then you can either compile XPM via "imake" or in a stand-alone way.

<h3><a name="sec4.1">4.1. With imake</a></h3>
<p>
	Imakefiles are provided to build both shared and unshared libraries.
	However, building a shared lib is very OS dependent and often requires
	specific files which are not available. Also config files are often not
	set correctly for this task. So if it fails you can avoid trying to
	build one and simply build the static library instead. In order to do
	so you should edit the top Imakefile to add -DSharedLibXpm=NO to the
	definition of IMAKE_DEFINES as described.
<p>
	The compilation and installation of the library and the sxpm program
	should only require you to edit the top Imakefile. But you should do so
	in order to specify the locations where the various files should be
	installed and to set the DEFINES variable accordingly to your system.
<p>
	On Solaris 2.* the compilation works only in the native svr4
	environment, avoid the bsd one or it won't compile. Especially you
	should be using /opt/SUNWspro/bin/cc and not /usr/ucb/cc.
	Also since the compiler is no longer part of the OS distribution a lot
	of people use gcc instead. This is fine, but be aware that the imake
	tool you get as part of the X Window System on a solaris box is
	configured for cc. Therefore the compilation using the generated
	Makefiles will not succeed unless you have changed the default
	configuration. An easy work around is to directly edit the generated
	lib/Makefile to change '-K pic' to '-fpic'. Fixing your imake
	configuration would be better though.
<p>
	On Linux, if you do not use ELF yet you'd better get the binary
	distribution available from sunsite. Because it's really a pain to
	build a shared lib and the current XPM distribution doesn't contain
	the jump files you would need to do so. On the other hand people have
	had no problems building it using ELF.
<p>
	Then execute the following command:
<pre>
		xmkmf -a
</pre>
<p>
	or if this option is not supported by your version of xmkmf:
<pre>
		xmkmf
		make Makefiles
		make includes
		make depend		(optional)
</pre>
<p>
	Then simply execute: 
<pre>
		make
</pre>
<p>
	which will build the XPM library and the sxpm application. 
	Then do:
<pre>
	     	make install
		make install.man
</pre>
<p>
	which will install the library and the sxpm program and man page.
<p>
	If it fails, be sure you have set the DEFINES correctly in the top
	Imakefile to suit your machine.

<h4>NOTE ON USING IMAKE:</h4>
<p>
	Building the XPM distribution with imake requires to have imake
	<strong>correctly installed and configured</strong> on your
	system. I do my best at tweaking the Imakefiles so they work with
	as many imake flavors people might have as possible but there is
	nothing I can do against wrong imake configurations. So if your
	build fails using imake, don't send me email for advice. Get your
	imake configuration fixed or forget about it!


<h3><a name="sec4.2">4.2. Without imake</a></h3>
<p>
	A set of makefiles is provided for those who do not have imake
	available on their system. However, this is only provided as a
	convenience and you should be considered as a starting point and not as
	something ready to use. These makefiles, called Makefile.noX, will most
	likely require some editing in order be set accordingly to your system.
<p>
	Once this setting is done, you should be able to compile XPM, by
	executing the following command:
<pre>
	        make -f Makefile.noX
</pre>
<p>
	Then to install it, do:
<pre>
		make -f Makefile.noX install
</pre>


<h2><a name="sec5">5. SXPM</a></h2>
<p>
In addition to the library the sxpm tool is provided to show XPM file and
convert them from XPM1 or XPM2 to XPM version 3. If you have previously done
'make' or 'make all' you should already have it, otherwise just do:
<pre>
		      cd sxpm; make
</pre>
<p>
This application shows you most of the features of XPM and its source can be
used to quickly see how to use the provided functions.
<p>
By executing 'sxpm -help' you will get the usage.
<p>
Executing 'sxpm -plaid' will show a demo of the XpmCreatePixmapFromData
function. The pixmap is created from the static variable plaid defined in the
sxpm.c file. sxpm will end when you press the key 'q' in the created window.
<p>
Executing 'sxpm -plaid -sc lines_in_mix blue' will show the feature of
overriding color symbols giving a colorname, executing 'sxpm -plaid -sp
lines_in_mix 1' will show overriding giving a pixel value, and executing 'sxpm
-plaid -cp red 0' will show overriding giving a color value.
<p>
Then you should try 'sxpm -plaid -o output' to get an output file using the
XpmWriteFileFromPixmap function.
<p>
You can now try 'sxpm -plaid -o - -nod -rgb /usr/lib/X11/rgb.txt' to directly
get the pixmap printed out on the standard output with colornames instead of
rgb values.
<p>
Then you should try 'sxpm plaid.xpm' to use the XpmReadFileToPixmap function,
and 'cat plaid_mask.xpm|sxpm' to see how "transparent pixels" are handled.
<p>
The XpmCreatePixmapFromData function is on purpose called without any XpmInfos
flag to show the utility of this one. Indeed, compare the color section of the
two files foo and bar obtained from 'sxpm -nod -plaid -o foo' and 'sxpm -nod
plaid.xpm -o bar'. All the default colors and also the comments have been
restored.
<p>
To end look at plaid_ext.xpm and try "sxpm -nod plaid_ext.xpm -v" to see how
extensions are handled.
<p>
Of course, other combinations are allowed and should be tried. Thus, 'sxpm
plaid.xpm -o output -nod' will show you how to convert a file from XPM1 or XPM2
to a XPM version 3 using sxpm.
<p>
See the manual page for more detail.


<h2><a name="sec6">6. CXPM</a></h2>
<p>
The cxpm tool is provided to help you figure out whether an XPM file is correct
or not with regard to its format. If you have previously done 'make' or
'make all' you should already have it, otherwise just do:
<pre>
		      cd cxpm; make
</pre>
<p>
The related man page will tell you everything about it but here is a simple
example of what it does:
<pre>
$ ./cxpm bogus_pixmap
Xpm Error: Invalid XPM file.
Error found line 3 near character 5
</pre>
<p>
It is pretty limited but at least, unlike sxpm, it gives you some hint on where
the error occured within the file.


<h2><a name="sec7">7. Other Tools</a></h2>
<p>
Several converters dealing with XPM and a pixmap editor can be found in the
xpm-contrib distribution. Also I recommend the use of netpbm to do any kind of
general image operations such as scaling, resizing, dithering, and to convert
from and to any other image format.

<h2><a name="sec8">8. Discussion</a></h2>
<p>
There is a mailing list to discuss about XPM which is <a
href="mailto:xpm-talk@sophia.inria.fr">xpm-talk@sophia.inria.fr</a>.
Any request to subscribe should be sent to <a
href="mailto:xpm-talk-request@sophia.inria.fr">xpm-talk-request@sophia.inria.fr</a>.
The archive of the xpm-talk list is available through the web at
<a
href="http://zenon.inria.fr/koala/xpm-talk-hypermail">http://zenon.inria.fr/koala/xpm-talk-hypermail</a>
and through ftp at <a
href="ftp://koala.inria.fr/pub/xpm/xpm-talk-archive">ftp://koala.inria.fr/pub/xpm/xpm-talk-archive</a>
<p>
Please mail any bug reports or modifications done, comments, suggestions,
requests for updates or patches to port on another machine to:

<p>Email: <a href="lehors@sophia.inria.fr">lehors@sophia.inria.fr</a>
<br>Phone: +33 (0)4 93 65 78 89
<br>Surface Mail:<br>
Arnaud Le Hors<br>
Inria BP.93<br>
2004, Route des lucioles<br>
06902 Sophia Antipolis Cedex<br>
FRANCE


<hr>
<h2><a name="copy">Copyright (C) 1989-95 GROUPE BULL</a></h2>
<p>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
<p>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<p>
Except as contained in this notice, the name of GROUPE BULL shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from GROUPE BULL.
</body>