| 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 |
*--------------------------------------------------------------------- |
| 5 |
* |
| 6 |
* |
| 7 |
* Copyright (c) 1992, Visual Edge Software Ltd. |
| 8 |
* |
| 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 |
*-------------------------------------------------------------------*/ |
| 19 |
|
| 20 |
/* |
| 21 |
* Copyright 1990, 1991 GROUPE BULL |
| 22 |
* |
| 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. |
| 32 |
* |
| 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. |
| 41 |
* |
| 42 |
*/ |
| 43 |
|
| 44 |
/*****************************************************************************\ |
| 45 |
* xpm.h: * |
| 46 |
* * |
| 47 |
* XPM library * |
| 48 |
* Include file * |
| 49 |
* * |
| 50 |
* Developed by Arnaud Le Hors * |
| 51 |
\*****************************************************************************/ |
| 52 |
|
| 53 |
#ifndef XPM_h |
| 54 |
#define XPM_h |
| 55 |
|
| 56 |
#ifdef VMS |
| 57 |
#include "decw$include:Xlib.h" |
| 58 |
#include "decw$include:Intrinsic.h" |
| 59 |
#include "sys$library:stdio.h" |
| 60 |
#else |
| 61 |
#include <X11/Xlib.h> |
| 62 |
#include <X11/Intrinsic.h> |
| 63 |
#include <stdio.h> |
| 64 |
#endif |
| 65 |
|
| 66 |
/* we keep the same codes as for Bitmap management */ |
| 67 |
#ifndef _XUTIL_H_ |
| 68 |
#ifdef VMS |
| 69 |
#include "decw$include:Xutil.h" |
| 70 |
#else |
| 71 |
#include <X11/Xutil.h> |
| 72 |
#endif |
| 73 |
#endif |
| 74 |
|
| 75 |
/* Return ErrorStatus codes: |
| 76 |
* null if full success |
| 77 |
* positive if partial success |
| 78 |
* negative if failure |
| 79 |
*/ |
| 80 |
|
| 81 |
#define XpmColorError 1 |
| 82 |
#define XpmSuccess 0 |
| 83 |
#define XpmOpenFailed -1 |
| 84 |
#define XpmFileInvalid -2 |
| 85 |
#define XpmNoMemory -3 |
| 86 |
#define XpmColorFailed -4 |
| 87 |
|
| 88 |
|
| 89 |
typedef struct { |
| 90 |
char *name; /* Symbolic color name */ |
| 91 |
char *value; /* Color value */ |
| 92 |
Pixel pixel; /* Color pixel */ |
| 93 |
} XpmColorSymbol; |
| 94 |
|
| 95 |
typedef struct { |
| 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 |
| 99 |
strings */ |
| 100 |
} XpmExtension; |
| 101 |
|
| 102 |
typedef struct { |
| 103 |
unsigned long valuemask; /* Specifies which attributes are |
| 104 |
* defined */ |
| 105 |
|
| 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 |
| 110 |
* pixmap */ |
| 111 |
unsigned int height; /* Returns the height of the created |
| 112 |
* pixmap */ |
| 113 |
unsigned int x_hotspot; /* Returns the x hotspot's |
| 114 |
* coordinate */ |
| 115 |
unsigned int y_hotspot; /* Returns the y hotspot's |
| 116 |
* coordinate */ |
| 117 |
unsigned int cpp; /* Specifies the number of char per |
| 118 |
* pixel */ |
| 119 |
Pixel *pixels; /* List of used color pixels */ |
| 120 |
unsigned int npixels; /* Number of pixels */ |
| 121 |
XpmColorSymbol *colorsymbols; /* Array of color symbols to |
| 122 |
* override */ |
| 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 */ |
| 127 |
|
| 128 |
/* Infos */ |
| 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 |
| 135 |
* index */ |
| 136 |
} XpmAttributes; |
| 137 |
|
| 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) |
| 149 |
|
| 150 |
#define XpmReturnPixels (1L<<9) |
| 151 |
#define XpmReturnInfos XpmInfos |
| 152 |
#define XpmReturnExtensions XpmExtensions |
| 153 |
|
| 154 |
/* |
| 155 |
* minimal portability layer between ansi and KR C |
| 156 |
*/ |
| 157 |
|
| 158 |
/* forward declaration of functions with prototypes */ |
| 159 |
|
| 160 |
#if __STDC__ || defined(__cplusplus) || defined(c_plusplus) |
| 161 |
/* ANSI || C++ */ |
| 162 |
#define FUNC(f, t, p) extern t f p |
| 163 |
#define LFUNC(f, t, p) static t f p |
| 164 |
#else /* K&R */ |
| 165 |
#define FUNC(f, t, p) extern t f() |
| 166 |
#define LFUNC(f, t, p) static t f() |
| 167 |
#endif /* end of K&R */ |
| 168 |
|
| 169 |
|
| 170 |
/* |
| 171 |
* functions declarations |
| 172 |
*/ |
| 173 |
|
| 174 |
#ifdef __cplusplus |
| 175 |
extern "C" { |
| 176 |
#endif |
| 177 |
|
| 178 |
#ifdef NOT_NEEDED |
| 179 |
FUNC(XpmCreatePixmapFromData, int, (Display * display, |
| 180 |
Drawable d, |
| 181 |
char **data, |
| 182 |
Pixmap * pixmap_return, |
| 183 |
Pixmap * shapemask_return, |
| 184 |
XpmAttributes * attributes)); |
| 185 |
|
| 186 |
FUNC(XpmCreateDataFromPixmap, int, (Display * display, |
| 187 |
char ***data_return, |
| 188 |
Pixmap pixmap, |
| 189 |
Pixmap shapemask, |
| 190 |
XpmAttributes * attributes)); |
| 191 |
#endif |
| 192 |
|
| 193 |
FUNC(XpmReadFileToPixmap, int, (Display * display, |
| 194 |
Drawable d, |
| 195 |
char *filename, |
| 196 |
Pixmap * pixmap_return, |
| 197 |
Pixmap * shapemask_return, |
| 198 |
XpmAttributes * attributes)); |
| 199 |
|
| 200 |
#ifdef NOT_NEEDED |
| 201 |
FUNC(XpmWriteFileFromPixmap, int, (Display * display, |
| 202 |
char *filename, |
| 203 |
Pixmap pixmap, |
| 204 |
Pixmap shapemask, |
| 205 |
XpmAttributes * attributes)); |
| 206 |
|
| 207 |
FUNC(XpmCreateImageFromData, int, (Display * display, |
| 208 |
char **data, |
| 209 |
XImage ** image_return, |
| 210 |
XImage ** shapemask_return, |
| 211 |
XpmAttributes * attributes)); |
| 212 |
|
| 213 |
FUNC(XpmCreateDataFromImage, int, (Display * display, |
| 214 |
char ***data_return, |
| 215 |
XImage * image, |
| 216 |
XImage * shapeimage, |
| 217 |
XpmAttributes * attributes)); |
| 218 |
#endif |
| 219 |
|
| 220 |
FUNC(XpmReadFileToImage, int, (Display * display, |
| 221 |
char *filename, |
| 222 |
XImage ** image_return, |
| 223 |
XImage ** shapeimage_return, |
| 224 |
XpmAttributes * attributes)); |
| 225 |
|
| 226 |
#ifdef NOT_NEEDED |
| 227 |
FUNC(XpmWriteFileFromImage, int, (Display * display, |
| 228 |
char *filename, |
| 229 |
XImage * image, |
| 230 |
XImage * shapeimage, |
| 231 |
XpmAttributes * attributes)); |
| 232 |
#endif |
| 233 |
|
| 234 |
FUNC(XpmAttributesSize, int, ()); |
| 235 |
FUNC(XpmFreeAttributes, int, (XpmAttributes * attributes)); |
| 236 |
FUNC(XpmFreeExtensions, int, (XpmExtension * extensions, int nextensions)); |
| 237 |
|
| 238 |
#ifdef __cplusplus |
| 239 |
} /* for C++ V2.0 */ |
| 240 |
|
| 241 |
#endif |
| 242 |
|
| 243 |
#ifdef NOT_NEEDED |
| 244 |
/* backward compatibility */ |
| 245 |
|
| 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 |
| 253 |
|
| 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) |
| 258 |
|
| 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 |
| 266 |
|
| 267 |
#define ColorSymbol XpmColorSymbol |
| 268 |
|
| 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) |
| 277 |
|
| 278 |
#endif |
| 279 |
|
| 280 |
#endif |