| 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 | #ifndef XPM_h |
| 36 | #define XPM_h |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | #define XpmFormat 3 |
| 51 | #define XpmVersion 4 |
| 52 | #define XpmRevision 11 |
| 53 | #define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision) |
| 54 | |
| 55 | #ifndef XPM_NUMBERS |
| 56 | |
| 57 | # include <X11/Xfuncproto.h> |
| 58 | # include <X11/Xlib.h> |
| 59 | # include <X11/Xutil.h> |
| 60 | |
| 61 | |
| 62 | #if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED) |
| 63 | typedef unsigned long Pixel; |
| 64 | # define PIXEL_ALREADY_TYPEDEFED |
| 65 | #endif |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | #define XpmColorError 1 |
| 74 | #define XpmSuccess 0 |
| 75 | #define XpmOpenFailed -1 |
| 76 | #define XpmFileInvalid -2 |
| 77 | #define XpmNoMemory -3 |
| 78 | #define XpmColorFailed -4 |
| 79 | |
| 80 | typedef struct { |
| 81 | char *name; |
| 82 | char *value; |
| 83 | Pixel pixel; |
| 84 | } XpmColorSymbol; |
| 85 | |
| 86 | typedef struct { |
| 87 | char *name; |
| 88 | unsigned int nlines; |
| 89 | char **lines; |
| 90 | } XpmExtension; |
| 91 | |
| 92 | typedef struct { |
| 93 | char *string; |
| 94 | char *symbolic; |
| 95 | char *m_color; |
| 96 | char *g4_color; |
| 97 | char *g_color; |
| 98 | char *c_color; |
| 99 | } XpmColor; |
| 100 | |
| 101 | typedef struct { |
| 102 | unsigned int width; |
| 103 | unsigned int height; |
| 104 | unsigned int cpp; |
| 105 | unsigned int ncolors; |
| 106 | XpmColor *colorTable; |
| 107 | unsigned int *data; |
| 108 | } XpmImage; |
| 109 | |
| 110 | typedef struct { |
| 111 | unsigned long valuemask; |
| 112 | char *hints_cmt; |
| 113 | char *colors_cmt; |
| 114 | char *pixels_cmt; |
| 115 | unsigned int x_hotspot; |
| 116 | unsigned int y_hotspot; |
| 117 | unsigned int nextensions; |
| 118 | XpmExtension *extensions; |
| 119 | } XpmInfo; |
| 120 | |
| 121 | typedef int (*XpmAllocColorFunc)( |
| 122 | Display* , |
| 123 | Colormap , |
| 124 | char* , |
| 125 | XColor* , |
| 126 | void* |
| 127 | ); |
| 128 | |
| 129 | typedef int (*XpmFreeColorsFunc)( |
| 130 | Display* , |
| 131 | Colormap , |
| 132 | Pixel* , |
| 133 | int , |
| 134 | void* |
| 135 | ); |
| 136 | |
| 137 | typedef struct { |
| 138 | unsigned long valuemask; |
| 139 | |
| 140 | |
| 141 | Visual *visual; |
| 142 | Colormap colormap; |
| 143 | unsigned int depth; |
| 144 | unsigned int width; |
| 145 | |
| 146 | unsigned int height; |
| 147 | |
| 148 | unsigned int x_hotspot; |
| 149 | |
| 150 | unsigned int y_hotspot; |
| 151 | |
| 152 | unsigned int cpp; |
| 153 | |
| 154 | Pixel *pixels; |
| 155 | unsigned int npixels; |
| 156 | XpmColorSymbol *colorsymbols; |
| 157 | unsigned int numsymbols; |
| 158 | char *rgb_fname; |
| 159 | unsigned int nextensions; |
| 160 | XpmExtension *extensions; |
| 161 | |
| 162 | unsigned int ncolors; |
| 163 | XpmColor *colorTable; |
| 164 | |
| 165 | char *hints_cmt; |
| 166 | char *colors_cmt; |
| 167 | char *pixels_cmt; |
| 168 | |
| 169 | unsigned int mask_pixel; |
| 170 | |
| 171 | |
| 172 | |
| 173 | Bool exactColors; |
| 174 | unsigned int closeness; |
| 175 | unsigned int red_closeness; |
| 176 | unsigned int green_closeness; |
| 177 | unsigned int blue_closeness; |
| 178 | int color_key; |
| 179 | |
| 180 | Pixel *alloc_pixels; |
| 181 | |
| 182 | int nalloc_pixels; |
| 183 | |
| 184 | |
| 185 | Bool alloc_close_colors; |
| 186 | |
| 187 | |
| 188 | int bitmap_format; |
| 189 | |
| 190 | |
| 191 | |
| 192 | XpmAllocColorFunc alloc_color; |
| 193 | XpmFreeColorsFunc free_colors; |
| 194 | void *color_closure; |
| 195 | |
| 196 | |
| 197 | } XpmAttributes; |
| 198 | |
| 199 | |
| 200 | #define XpmVisual (1L<<0) |
| 201 | #define XpmColormap (1L<<1) |
| 202 | #define XpmDepth (1L<<2) |
| 203 | #define XpmSize (1L<<3) |
| 204 | #define XpmHotspot (1L<<4) |
| 205 | #define XpmCharsPerPixel (1L<<5) |
| 206 | #define XpmColorSymbols (1L<<6) |
| 207 | #define XpmRgbFilename (1L<<7) |
| 208 | |
| 209 | #define XpmInfos (1L<<8) |
| 210 | #define XpmReturnInfos XpmInfos |
| 211 | |
| 212 | #define XpmReturnPixels (1L<<9) |
| 213 | #define XpmExtensions (1L<<10) |
| 214 | #define XpmReturnExtensions XpmExtensions |
| 215 | |
| 216 | #define XpmExactColors (1L<<11) |
| 217 | #define XpmCloseness (1L<<12) |
| 218 | #define XpmRGBCloseness (1L<<13) |
| 219 | #define XpmColorKey (1L<<14) |
| 220 | |
| 221 | #define XpmColorTable (1L<<15) |
| 222 | #define XpmReturnColorTable XpmColorTable |
| 223 | |
| 224 | #define XpmReturnAllocPixels (1L<<16) |
| 225 | #define XpmAllocCloseColors (1L<<17) |
| 226 | #define XpmBitmapFormat (1L<<18) |
| 227 | |
| 228 | #define XpmAllocColor (1L<<19) |
| 229 | #define XpmFreeColors (1L<<20) |
| 230 | #define XpmColorClosure (1L<<21) |
| 231 | |
| 232 | |
| 233 | |
| 234 | #define XpmComments XpmInfos |
| 235 | #define XpmReturnComments XpmComments |
| 236 | |
| 237 | |
| 238 | #define XpmUndefPixel 0x80000000 |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | #define XPM_MONO 2 |
| 245 | #define XPM_GREY4 3 |
| 246 | #define XPM_GRAY4 3 |
| 247 | #define XPM_GREY 4 |
| 248 | #define XPM_GRAY 4 |
| 249 | #define XPM_COLOR 5 |
| 250 | |
| 251 | |
| 252 | |
| 253 | #ifndef _X_EXPORT |
| 254 | # define _X_EXPORT |
| 255 | # define _X_HIDDEN |
| 256 | #endif |
| 257 | #define FUNC(f, t, p) extern _X_EXPORT t f p |
| 258 | #define HFUNC(f, t, p) extern _X_HIDDEN t f p |
| 259 | #define LFUNC(f, t, p) static t f p |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | _XFUNCPROTOBEGIN |
| 267 | |
| 268 | FUNC(XpmCreatePixmapFromData, int, (Display *display, |
| 269 | Drawable d, |
| 270 | char **data, |
| 271 | Pixmap *pixmap_return, |
| 272 | Pixmap *shapemask_return, |
| 273 | XpmAttributes *attributes)); |
| 274 | |
| 275 | FUNC(XpmCreateDataFromPixmap, int, (Display *display, |
| 276 | char ***data_return, |
| 277 | Pixmap pixmap, |
| 278 | Pixmap shapemask, |
| 279 | XpmAttributes *attributes)); |
| 280 | |
| 281 | FUNC(XpmReadFileToPixmap, int, (Display *display, |
| 282 | Drawable d, |
| 283 | const char *filename, |
| 284 | Pixmap *pixmap_return, |
| 285 | Pixmap *shapemask_return, |
| 286 | XpmAttributes *attributes)); |
| 287 | |
| 288 | FUNC(XpmWriteFileFromPixmap, int, (Display *display, |
| 289 | const char *filename, |
| 290 | Pixmap pixmap, |
| 291 | Pixmap shapemask, |
| 292 | XpmAttributes *attributes)); |
| 293 | |
| 294 | FUNC(XpmCreateImageFromData, int, (Display *display, |
| 295 | char **data, |
| 296 | XImage **image_return, |
| 297 | XImage **shapemask_return, |
| 298 | XpmAttributes *attributes)); |
| 299 | |
| 300 | FUNC(XpmCreateDataFromImage, int, (Display *display, |
| 301 | char ***data_return, |
| 302 | XImage *image, |
| 303 | XImage *shapeimage, |
| 304 | XpmAttributes *attributes)); |
| 305 | |
| 306 | FUNC(XpmReadFileToImage, int, (Display *display, |
| 307 | const char *filename, |
| 308 | XImage **image_return, |
| 309 | XImage **shapeimage_return, |
| 310 | XpmAttributes *attributes)); |
| 311 | |
| 312 | FUNC(XpmWriteFileFromImage, int, (Display *display, |
| 313 | const char *filename, |
| 314 | XImage *image, |
| 315 | XImage *shapeimage, |
| 316 | XpmAttributes *attributes)); |
| 317 | |
| 318 | FUNC(XpmCreateImageFromBuffer, int, (Display *display, |
| 319 | char *buffer, |
| 320 | XImage **image_return, |
| 321 | XImage **shapemask_return, |
| 322 | XpmAttributes *attributes)); |
| 323 | |
| 324 | FUNC(XpmCreatePixmapFromBuffer, int, (Display *display, |
| 325 | Drawable d, |
| 326 | char *buffer, |
| 327 | Pixmap *pixmap_return, |
| 328 | Pixmap *shapemask_return, |
| 329 | XpmAttributes *attributes)); |
| 330 | |
| 331 | FUNC(XpmCreateBufferFromImage, int, (Display *display, |
| 332 | char **buffer_return, |
| 333 | XImage *image, |
| 334 | XImage *shapeimage, |
| 335 | XpmAttributes *attributes)); |
| 336 | |
| 337 | FUNC(XpmCreateBufferFromPixmap, int, (Display *display, |
| 338 | char **buffer_return, |
| 339 | Pixmap pixmap, |
| 340 | Pixmap shapemask, |
| 341 | XpmAttributes *attributes)); |
| 342 | |
| 343 | FUNC(XpmReadFileToBuffer, int, (const char *filename, char **buffer_return)); |
| 344 | FUNC(XpmWriteFileFromBuffer, int, (const char *filename, char *buffer)); |
| 345 | |
| 346 | FUNC(XpmReadFileToData, int, (const char *filename, char ***data_return)); |
| 347 | FUNC(XpmWriteFileFromData, int, (const char *filename, char **data)); |
| 348 | |
| 349 | FUNC(XpmAttributesSize, int, (void)); |
| 350 | FUNC(XpmFreeAttributes, void, (XpmAttributes *attributes)); |
| 351 | FUNC(XpmFreeExtensions, void, (XpmExtension *extensions, |
| 352 | int nextensions)); |
| 353 | |
| 354 | FUNC(XpmFreeXpmImage, void, (XpmImage *image)); |
| 355 | FUNC(XpmFreeXpmInfo, void, (XpmInfo *info)); |
| 356 | FUNC(XpmGetErrorString, char *, (int errcode)); |
| 357 | FUNC(XpmLibraryVersion, int, (void)); |
| 358 | |
| 359 | |
| 360 | FUNC(XpmReadFileToXpmImage, int, (const char *filename, |
| 361 | XpmImage *image, |
| 362 | XpmInfo *info)); |
| 363 | |
| 364 | FUNC(XpmWriteFileFromXpmImage, int, (const char *filename, |
| 365 | XpmImage *image, |
| 366 | XpmInfo *info)); |
| 367 | |
| 368 | FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display, |
| 369 | Drawable d, |
| 370 | XpmImage *image, |
| 371 | Pixmap *pixmap_return, |
| 372 | Pixmap *shapemask_return, |
| 373 | XpmAttributes *attributes)); |
| 374 | |
| 375 | FUNC(XpmCreateImageFromXpmImage, int, (Display *display, |
| 376 | XpmImage *image, |
| 377 | XImage **image_return, |
| 378 | XImage **shapeimage_return, |
| 379 | XpmAttributes *attributes)); |
| 380 | |
| 381 | FUNC(XpmCreateXpmImageFromImage, int, (Display *display, |
| 382 | XImage *image, |
| 383 | XImage *shapeimage, |
| 384 | XpmImage *xpmimage, |
| 385 | XpmAttributes *attributes)); |
| 386 | |
| 387 | FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display, |
| 388 | Pixmap pixmap, |
| 389 | Pixmap shapemask, |
| 390 | XpmImage *xpmimage, |
| 391 | XpmAttributes *attributes)); |
| 392 | |
| 393 | FUNC(XpmCreateDataFromXpmImage, int, (char ***data_return, |
| 394 | XpmImage *image, |
| 395 | XpmInfo *info)); |
| 396 | |
| 397 | FUNC(XpmCreateXpmImageFromData, int, (char **data, |
| 398 | XpmImage *image, |
| 399 | XpmInfo *info)); |
| 400 | |
| 401 | FUNC(XpmCreateXpmImageFromBuffer, int, (char *buffer, |
| 402 | XpmImage *image, |
| 403 | XpmInfo *info)); |
| 404 | |
| 405 | FUNC(XpmCreateBufferFromXpmImage, int, (char **buffer_return, |
| 406 | XpmImage *image, |
| 407 | XpmInfo *info)); |
| 408 | |
| 409 | FUNC(XpmGetParseError, int, (char *filename, |
| 410 | int *linenum_return, |
| 411 | int *charnum_return)); |
| 412 | |
| 413 | FUNC(XpmFree, void, (void *ptr)); |
| 414 | |
| 415 | _XFUNCPROTOEND |
| 416 | |
| 417 | |
| 418 | |
| 419 | |
| 420 | #define XpmPixmapColorError XpmColorError |
| 421 | #define XpmPixmapSuccess XpmSuccess |
| 422 | #define XpmPixmapOpenFailed XpmOpenFailed |
| 423 | #define XpmPixmapFileInvalid XpmFileInvalid |
| 424 | #define XpmPixmapNoMemory XpmNoMemory |
| 425 | #define XpmPixmapColorFailed XpmColorFailed |
| 426 | |
| 427 | #define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \ |
| 428 | XpmReadFileToPixmap(dpy, d, file, pix, mask, att) |
| 429 | #define XpmWritePixmapFile(dpy, file, pix, mask, att) \ |
| 430 | XpmWriteFileFromPixmap(dpy, file, pix, mask, att) |
| 431 | |
| 432 | |
| 433 | #define PixmapColorError XpmColorError |
| 434 | #define PixmapSuccess XpmSuccess |
| 435 | #define PixmapOpenFailed XpmOpenFailed |
| 436 | #define PixmapFileInvalid XpmFileInvalid |
| 437 | #define PixmapNoMemory XpmNoMemory |
| 438 | #define PixmapColorFailed XpmColorFailed |
| 439 | |
| 440 | #define ColorSymbol XpmColorSymbol |
| 441 | |
| 442 | #define XReadPixmapFile(dpy, d, file, pix, mask, att) \ |
| 443 | XpmReadFileToPixmap(dpy, d, file, pix, mask, att) |
| 444 | #define XWritePixmapFile(dpy, file, pix, mask, att) \ |
| 445 | XpmWriteFileFromPixmap(dpy, file, pix, mask, att) |
| 446 | #define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \ |
| 447 | XpmCreatePixmapFromData(dpy, d, data, pix, mask, att) |
| 448 | #define XCreateDataFromPixmap(dpy, data, pix, mask, att) \ |
| 449 | XpmCreateDataFromPixmap(dpy, data, pix, mask, att) |
| 450 | |
| 451 | #endif |
| 452 | #endif |