File indexing completed on 2025-01-18 10:14:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 #ifndef XPM_h
0046 #define XPM_h
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 #define XpmFormat 3
0061 #define XpmVersion 4
0062 #define XpmRevision 11
0063 #define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision)
0064
0065 #ifndef XPM_NUMBERS
0066
0067 #ifdef FOR_MSW
0068 # define SYSV
0069 # include <malloc.h>
0070 # include "simx.h" /* defines some X stuff using MSW types */
0071 #define NEED_STRCASECMP
0072 #else
0073 # ifdef AMIGA
0074 # include "amigax.h"
0075 # else
0076 # include <X11/Xfuncproto.h>
0077 # include <X11/Xlib.h>
0078 # include <X11/Xutil.h>
0079 # endif
0080 #endif
0081
0082
0083 #if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED)
0084 typedef unsigned long Pixel;
0085 # define PIXEL_ALREADY_TYPEDEFED
0086 #endif
0087
0088
0089
0090
0091
0092
0093
0094 #define XpmColorError 1
0095 #define XpmSuccess 0
0096 #define XpmOpenFailed -1
0097 #define XpmFileInvalid -2
0098 #define XpmNoMemory -3
0099 #define XpmColorFailed -4
0100
0101 typedef struct {
0102 char *name;
0103 char *value;
0104 Pixel pixel;
0105 } XpmColorSymbol;
0106
0107 typedef struct {
0108 char *name;
0109 unsigned int nlines;
0110 char **lines;
0111 } XpmExtension;
0112
0113 typedef struct {
0114 char *string;
0115 char *symbolic;
0116 char *m_color;
0117 char *g4_color;
0118 char *g_color;
0119 char *c_color;
0120 } XpmColor;
0121
0122 typedef struct {
0123 unsigned int width;
0124 unsigned int height;
0125 unsigned int cpp;
0126 unsigned int ncolors;
0127 XpmColor *colorTable;
0128 unsigned int *data;
0129 } XpmImage;
0130
0131 typedef struct {
0132 unsigned long valuemask;
0133 char *hints_cmt;
0134 char *colors_cmt;
0135 char *pixels_cmt;
0136 unsigned int x_hotspot;
0137 unsigned int y_hotspot;
0138 unsigned int nextensions;
0139 XpmExtension *extensions;
0140 } XpmInfo;
0141
0142 typedef int (*XpmAllocColorFunc)(
0143 Display* ,
0144 Colormap ,
0145 char* ,
0146 XColor* ,
0147 void*
0148 );
0149
0150 typedef int (*XpmFreeColorsFunc)(
0151 Display* ,
0152 Colormap ,
0153 Pixel* ,
0154 int ,
0155 void*
0156 );
0157
0158 typedef struct {
0159 unsigned long valuemask;
0160
0161
0162 Visual *visual;
0163 Colormap colormap;
0164 unsigned int depth;
0165 unsigned int width;
0166
0167 unsigned int height;
0168
0169 unsigned int x_hotspot;
0170
0171 unsigned int y_hotspot;
0172
0173 unsigned int cpp;
0174
0175 Pixel *pixels;
0176 unsigned int npixels;
0177 XpmColorSymbol *colorsymbols;
0178 unsigned int numsymbols;
0179 char *rgb_fname;
0180 unsigned int nextensions;
0181 XpmExtension *extensions;
0182
0183 unsigned int ncolors;
0184 XpmColor *colorTable;
0185
0186 char *hints_cmt;
0187 char *colors_cmt;
0188 char *pixels_cmt;
0189
0190 unsigned int mask_pixel;
0191
0192
0193
0194 Bool exactColors;
0195 unsigned int closeness;
0196 unsigned int red_closeness;
0197 unsigned int green_closeness;
0198 unsigned int blue_closeness;
0199 int color_key;
0200
0201 Pixel *alloc_pixels;
0202
0203 int nalloc_pixels;
0204
0205
0206 Bool alloc_close_colors;
0207
0208
0209 int bitmap_format;
0210
0211
0212
0213 XpmAllocColorFunc alloc_color;
0214 XpmFreeColorsFunc free_colors;
0215 void *color_closure;
0216
0217
0218 } XpmAttributes;
0219
0220
0221 #define XpmVisual (1L<<0)
0222 #define XpmColormap (1L<<1)
0223 #define XpmDepth (1L<<2)
0224 #define XpmSize (1L<<3)
0225 #define XpmHotspot (1L<<4)
0226 #define XpmCharsPerPixel (1L<<5)
0227 #define XpmColorSymbols (1L<<6)
0228 #define XpmRgbFilename (1L<<7)
0229
0230 #define XpmInfos (1L<<8)
0231 #define XpmReturnInfos XpmInfos
0232
0233 #define XpmReturnPixels (1L<<9)
0234 #define XpmExtensions (1L<<10)
0235 #define XpmReturnExtensions XpmExtensions
0236
0237 #define XpmExactColors (1L<<11)
0238 #define XpmCloseness (1L<<12)
0239 #define XpmRGBCloseness (1L<<13)
0240 #define XpmColorKey (1L<<14)
0241
0242 #define XpmColorTable (1L<<15)
0243 #define XpmReturnColorTable XpmColorTable
0244
0245 #define XpmReturnAllocPixels (1L<<16)
0246 #define XpmAllocCloseColors (1L<<17)
0247 #define XpmBitmapFormat (1L<<18)
0248
0249 #define XpmAllocColor (1L<<19)
0250 #define XpmFreeColors (1L<<20)
0251 #define XpmColorClosure (1L<<21)
0252
0253
0254
0255 #define XpmComments XpmInfos
0256 #define XpmReturnComments XpmComments
0257
0258
0259 #ifndef FOR_MSW
0260 #define XpmUndefPixel 0x80000000
0261 #else
0262
0263 #define XpmUndefPixel 0x8000
0264 #endif
0265
0266
0267
0268
0269
0270 #define XPM_MONO 2
0271 #define XPM_GREY4 3
0272 #define XPM_GRAY4 3
0273 #define XPM_GREY 4
0274 #define XPM_GRAY 4
0275 #define XPM_COLOR 5
0276
0277
0278
0279 #ifndef _X_EXPORT
0280 # define _X_EXPORT
0281 # define _X_HIDDEN
0282 #endif
0283 #define FUNC(f, t, p) extern _X_EXPORT t f p
0284 #define HFUNC(f, t, p) extern _X_HIDDEN t f p
0285 #define LFUNC(f, t, p) static t f p
0286
0287
0288
0289
0290
0291
0292 _XFUNCPROTOBEGIN
0293
0294
0295
0296
0297 #if !defined(FOR_MSW) && !defined(AMIGA)
0298 FUNC(XpmCreatePixmapFromData, int, (Display *display,
0299 Drawable d,
0300 char **data,
0301 Pixmap *pixmap_return,
0302 Pixmap *shapemask_return,
0303 XpmAttributes *attributes));
0304
0305 FUNC(XpmCreateDataFromPixmap, int, (Display *display,
0306 char ***data_return,
0307 Pixmap pixmap,
0308 Pixmap shapemask,
0309 XpmAttributes *attributes));
0310
0311 FUNC(XpmReadFileToPixmap, int, (Display *display,
0312 Drawable d,
0313 const char *filename,
0314 Pixmap *pixmap_return,
0315 Pixmap *shapemask_return,
0316 XpmAttributes *attributes));
0317
0318 FUNC(XpmWriteFileFromPixmap, int, (Display *display,
0319 const char *filename,
0320 Pixmap pixmap,
0321 Pixmap shapemask,
0322 XpmAttributes *attributes));
0323 #endif
0324
0325 FUNC(XpmCreateImageFromData, int, (Display *display,
0326 char **data,
0327 XImage **image_return,
0328 XImage **shapemask_return,
0329 XpmAttributes *attributes));
0330
0331 FUNC(XpmCreateDataFromImage, int, (Display *display,
0332 char ***data_return,
0333 XImage *image,
0334 XImage *shapeimage,
0335 XpmAttributes *attributes));
0336
0337 FUNC(XpmReadFileToImage, int, (Display *display,
0338 const char *filename,
0339 XImage **image_return,
0340 XImage **shapeimage_return,
0341 XpmAttributes *attributes));
0342
0343 FUNC(XpmWriteFileFromImage, int, (Display *display,
0344 const char *filename,
0345 XImage *image,
0346 XImage *shapeimage,
0347 XpmAttributes *attributes));
0348
0349 FUNC(XpmCreateImageFromBuffer, int, (Display *display,
0350 char *buffer,
0351 XImage **image_return,
0352 XImage **shapemask_return,
0353 XpmAttributes *attributes));
0354 #if !defined(FOR_MSW) && !defined(AMIGA)
0355 FUNC(XpmCreatePixmapFromBuffer, int, (Display *display,
0356 Drawable d,
0357 char *buffer,
0358 Pixmap *pixmap_return,
0359 Pixmap *shapemask_return,
0360 XpmAttributes *attributes));
0361
0362 FUNC(XpmCreateBufferFromImage, int, (Display *display,
0363 char **buffer_return,
0364 XImage *image,
0365 XImage *shapeimage,
0366 XpmAttributes *attributes));
0367
0368 FUNC(XpmCreateBufferFromPixmap, int, (Display *display,
0369 char **buffer_return,
0370 Pixmap pixmap,
0371 Pixmap shapemask,
0372 XpmAttributes *attributes));
0373 #endif
0374 FUNC(XpmReadFileToBuffer, int, (const char *filename, char **buffer_return));
0375 FUNC(XpmWriteFileFromBuffer, int, (const char *filename, char *buffer));
0376
0377 FUNC(XpmReadFileToData, int, (const char *filename, char ***data_return));
0378 FUNC(XpmWriteFileFromData, int, (const char *filename, char **data));
0379
0380 FUNC(XpmAttributesSize, int, (void));
0381 FUNC(XpmFreeAttributes, void, (XpmAttributes *attributes));
0382 FUNC(XpmFreeExtensions, void, (XpmExtension *extensions,
0383 int nextensions));
0384
0385 FUNC(XpmFreeXpmImage, void, (XpmImage *image));
0386 FUNC(XpmFreeXpmInfo, void, (XpmInfo *info));
0387 FUNC(XpmGetErrorString, char *, (int errcode));
0388 FUNC(XpmLibraryVersion, int, (void));
0389
0390
0391 FUNC(XpmReadFileToXpmImage, int, (const char *filename,
0392 XpmImage *image,
0393 XpmInfo *info));
0394
0395 FUNC(XpmWriteFileFromXpmImage, int, (const char *filename,
0396 XpmImage *image,
0397 XpmInfo *info));
0398 #if !defined(FOR_MSW) && !defined(AMIGA)
0399 FUNC(XpmCreatePixmapFromXpmImage, int, (Display *display,
0400 Drawable d,
0401 XpmImage *image,
0402 Pixmap *pixmap_return,
0403 Pixmap *shapemask_return,
0404 XpmAttributes *attributes));
0405 #endif
0406 FUNC(XpmCreateImageFromXpmImage, int, (Display *display,
0407 XpmImage *image,
0408 XImage **image_return,
0409 XImage **shapeimage_return,
0410 XpmAttributes *attributes));
0411
0412 FUNC(XpmCreateXpmImageFromImage, int, (Display *display,
0413 XImage *image,
0414 XImage *shapeimage,
0415 XpmImage *xpmimage,
0416 XpmAttributes *attributes));
0417 #if !defined(FOR_MSW) && !defined(AMIGA)
0418 FUNC(XpmCreateXpmImageFromPixmap, int, (Display *display,
0419 Pixmap pixmap,
0420 Pixmap shapemask,
0421 XpmImage *xpmimage,
0422 XpmAttributes *attributes));
0423 #endif
0424 FUNC(XpmCreateDataFromXpmImage, int, (char ***data_return,
0425 XpmImage *image,
0426 XpmInfo *info));
0427
0428 FUNC(XpmCreateXpmImageFromData, int, (char **data,
0429 XpmImage *image,
0430 XpmInfo *info));
0431
0432 FUNC(XpmCreateXpmImageFromBuffer, int, (char *buffer,
0433 XpmImage *image,
0434 XpmInfo *info));
0435
0436 FUNC(XpmCreateBufferFromXpmImage, int, (char **buffer_return,
0437 XpmImage *image,
0438 XpmInfo *info));
0439
0440 FUNC(XpmGetParseError, int, (char *filename,
0441 int *linenum_return,
0442 int *charnum_return));
0443
0444 FUNC(XpmFree, void, (void *ptr));
0445
0446 _XFUNCPROTOEND
0447
0448
0449
0450
0451 #define XpmPixmapColorError XpmColorError
0452 #define XpmPixmapSuccess XpmSuccess
0453 #define XpmPixmapOpenFailed XpmOpenFailed
0454 #define XpmPixmapFileInvalid XpmFileInvalid
0455 #define XpmPixmapNoMemory XpmNoMemory
0456 #define XpmPixmapColorFailed XpmColorFailed
0457
0458 #define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \
0459 XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
0460 #define XpmWritePixmapFile(dpy, file, pix, mask, att) \
0461 XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
0462
0463
0464 #define PixmapColorError XpmColorError
0465 #define PixmapSuccess XpmSuccess
0466 #define PixmapOpenFailed XpmOpenFailed
0467 #define PixmapFileInvalid XpmFileInvalid
0468 #define PixmapNoMemory XpmNoMemory
0469 #define PixmapColorFailed XpmColorFailed
0470
0471 #define ColorSymbol XpmColorSymbol
0472
0473 #define XReadPixmapFile(dpy, d, file, pix, mask, att) \
0474 XpmReadFileToPixmap(dpy, d, file, pix, mask, att)
0475 #define XWritePixmapFile(dpy, file, pix, mask, att) \
0476 XpmWriteFileFromPixmap(dpy, file, pix, mask, att)
0477 #define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \
0478 XpmCreatePixmapFromData(dpy, d, data, pix, mask, att)
0479 #define XCreateDataFromPixmap(dpy, data, pix, mask, att) \
0480 XpmCreateDataFromPixmap(dpy, data, pix, mask, att)
0481
0482 #endif
0483 #endif