1
/* @(#)xpm.h 17.1 (ESO-IPG) 01/25/02 17:26:07 */
2
/*---------------------------------------------------------------------
3
* $Date: 2003-06-04 14:49:18 $ $Revision: 1.1.1.1 $
4
*---------------------------------------------------------------------
7
* Copyright (c) 1992, Visual Edge Software Ltd.
9
* ALL RIGHTS RESERVED. Permission to use, copy, modify, and
10
* distribute this software and its documentation for any purpose
11
* and without fee is hereby granted, provided that the above
12
* copyright notice appear in all copies and that both that
13
* copyright notice and this permission notice appear in supporting
14
* documentation, and that the name of Visual Edge Software not be
15
* used in advertising or publicity pertaining to distribution of
16
* the software without specific, written prior permission. The year
17
* included in the notice is the year of the creation of the work.
18
*-------------------------------------------------------------------*/
21
* Copyright 1990, 1991 GROUPE BULL
23
* Permission to use, copy, modify, and distribute this software and its
24
* documentation for any purpose and without fee is hereby granted, provided
25
* that the above copyright notice appear in all copies and that both that
26
* copyright notice and this permission notice appear in supporting
27
* documentation, and that the name of GROUPE BULL not be used in advertising
28
* or publicity pertaining to distribution of the software without specific,
29
* written prior permission. GROUPE BULL makes no representations about the
30
* suitability of this software for any purpose. It is provided "as is"
31
* without express or implied warranty.
33
* GROUPE BULL disclaims all warranties with regard to this software,
34
* including all implied warranties of merchantability and fitness,
35
* in no event shall GROUPE BULL be liable for any special,
36
* indirect or consequential damages or any damages
37
* whatsoever resulting from loss of use, data or profits,
38
* whether in an action of contract, negligence or other tortious
39
* action, arising out of or in connection with the use
40
* or performance of this software.
44
/*****************************************************************************\
50
* Developed by Arnaud Le Hors *
51
\*****************************************************************************/
57
#include "decw$include:Xlib.h"
58
#include "decw$include:Intrinsic.h"
59
#include "sys$library:stdio.h"
62
#include <X11/Intrinsic.h>
66
/* we keep the same codes as for Bitmap management */
69
#include "decw$include:Xutil.h"
71
#include <X11/Xutil.h>
75
/* Return ErrorStatus codes:
76
* null if full success
77
* positive if partial success
81
#define XpmColorError 1
83
#define XpmOpenFailed -1
84
#define XpmFileInvalid -2
85
#define XpmNoMemory -3
86
#define XpmColorFailed -4
90
char *name; /* Symbolic color name */
91
char *value; /* Color value */
92
Pixel pixel; /* Color pixel */
96
char *name; /* name of the extension */
97
unsigned int nlines; /* number of lines in this extension */
98
char **lines; /* pointer to the extension array of
103
unsigned long valuemask; /* Specifies which attributes are
106
Visual *visual; /* Specifies the visual to use */
107
Colormap colormap; /* Specifies the colormap to use */
108
unsigned int depth; /* Specifies the depth */
109
unsigned int width; /* Returns the width of the created
111
unsigned int height; /* Returns the height of the created
113
unsigned int x_hotspot; /* Returns the x hotspot's
115
unsigned int y_hotspot; /* Returns the y hotspot's
117
unsigned int cpp; /* Specifies the number of char per
119
Pixel *pixels; /* List of used color pixels */
120
unsigned int npixels; /* Number of pixels */
121
XpmColorSymbol *colorsymbols; /* Array of color symbols to
123
unsigned int numsymbols; /* Number of symbols */
124
char *rgb_fname; /* RGB text file name */
125
unsigned int nextensions; /* number of extensions */
126
XpmExtension *extensions; /* pointer to array of extensions */
129
unsigned int ncolors; /* Number of colors */
130
char ***colorTable; /* Color table pointer */
131
char *hints_cmt; /* Comment of the hints section */
132
char *colors_cmt; /* Comment of the colors section */
133
char *pixels_cmt; /* Comment of the pixels section */
134
unsigned int mask_pixel; /* Transparent pixel's color table
138
/* Xpm attribute value masks bits */
139
#define XpmVisual (1L<<0)
140
#define XpmColormap (1L<<1)
141
#define XpmDepth (1L<<2)
142
#define XpmSize (1L<<3) /* width & height */
143
#define XpmHotspot (1L<<4) /* x_hotspot & y_hotspot */
144
#define XpmCharsPerPixel (1L<<5)
145
#define XpmColorSymbols (1L<<6)
146
#define XpmRgbFilename (1L<<7)
147
#define XpmInfos (1L<<8) /* all infos members */
148
#define XpmExtensions (1L<<10)
150
#define XpmReturnPixels (1L<<9)
151
#define XpmReturnInfos XpmInfos
152
#define XpmReturnExtensions XpmExtensions
155
* minimal portability layer between ansi and KR C
158
/* forward declaration of functions with prototypes */
160
#if __STDC__ || defined(__cplusplus) || defined(c_plusplus)
162
#define FUNC(f, t, p) extern t f p
163
#define LFUNC(f, t, p) static t f p
165
#define FUNC(f, t, p) extern t f()
166
#define LFUNC(f, t, p) static t f()
167
#endif /* end of K&R */
171
* functions declarations
179
FUNC(XpmCreatePixmapFromData, int, (Display * display,
182
Pixmap * pixmap_return,
183
Pixmap * shapemask_return,
184
XpmAttributes * attributes));
186
FUNC(XpmCreateDataFromPixmap, int, (Display * display,
190
XpmAttributes * attributes));
193
FUNC(XpmReadFileToPixmap, int, (Display * display,
196
Pixmap * pixmap_return,
197
Pixmap * shapemask_return,
198
XpmAttributes * attributes));
201
FUNC(XpmWriteFileFromPixmap, int, (Display * display,
205
XpmAttributes * attributes));
207
FUNC(XpmCreateImageFromData, int, (Display * display,
209
XImage ** image_return,
210
XImage ** shapemask_return,
211
XpmAttributes * attributes));
213
FUNC(XpmCreateDataFromImage, int, (Display * display,
217
XpmAttributes * attributes));
220
FUNC(XpmReadFileToImage, int, (Display * display,
222
XImage ** image_return,
223
XImage ** shapeimage_return,
224
XpmAttributes * attributes));
227
FUNC(XpmWriteFileFromImage, int, (Display * display,
231
XpmAttributes * attributes));
234
FUNC(XpmAttributesSize, int, ());
235
FUNC(XpmFreeAttributes, int, (XpmAttributes * attributes));
236
FUNC(XpmFreeExtensions, int, (XpmExtension * extensions, int nextensions));
244
/* backward compatibility */
246
/* for version 3.0c */
247
#define XpmPixmapColorError XpmColorError
248
#define XpmPixmapSuccess XpmSuccess
249
#define XpmPixmapOpenFailed XpmOpenFailed
250
#define XpmPixmapFileInvalid XpmFileInvalid
251
#define XpmPixmapNoMemory XpmNoMemory
252
#define XpmPixmapColorFailed XpmColorFailed
254
#define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \
255
XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
256
#define XpmWritePixmapFile(dpy, file, pix, mask, att) \
257
XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
259
/* for version 3.0b */
260
#define PixmapColorError XpmColorError
261
#define PixmapSuccess XpmSuccess
262
#define PixmapOpenFailed XpmOpenFailed
263
#define PixmapFileInvalid XpmFileInvalid
264
#define PixmapNoMemory XpmNoMemory
265
#define PixmapColorFailed XpmColorFailed
267
#define ColorSymbol XpmColorSymbol
269
#define XReadPixmapFile(dpy, d, file, pix, mask, att) \
270
XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
271
#define XWritePixmapFile(dpy, file, pix, mask, att) \
272
XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
273
#define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \
274
XpmCreatePixmapFromData(dpy, d, data, pix, mask, att)
275
#define XCreateDataFromPixmap(dpy, data, pix, mask, att) \
276
XpmCreateDataFromPixmap(dpy, data, pix, mask, att)