1 /* Copyright 1990,91 GROUPE BULL -- See licence conditions in file COPYRIGHT */ 2 /*****************************************************************************\ 3 * xpm.h: * 4 * * 5 * XPM library * 6 * Include file * 7 * * 8 * Developed by Arnaud Le Hors * 9 \*****************************************************************************/ 10 11 #ifndef XPM_h 12 #define XPM_h 13 14 #ifdef VMS 15 #include "decw$include:Xlib.h" 16 #include "decw$include:Intrinsic.h" 17 #include "sys$library:stdio.h" 18 #else 19 #include <X11/Xlib.h> 20 #include <X11/Intrinsic.h> 21 #include <stdio.h> 22 #endif 23 24 /* we keep the same codes as for Bitmap management */ 25 #ifndef _XUTIL_H_ 26 #ifdef VMS 27 #include "decw$include:Xutil.h" 28 #else 29 #include <X11/Xutil.h> 30 #endif 31 #endif 32 33 /* Return ErrorStatus codes: 34 * null if full success 35 * positive if partial success 36 * negative if failure 37 */ 38 39 #define XpmColorError 1 40 #define XpmSuccess 0 41 #define XpmOpenFailed -1 42 #define XpmFileInvalid -2 43 #define XpmNoMemory -3 44 #define XpmColorFailed -4 45 46 47 typedef struct { 48 char *name; /* Symbolic color name */ 49 char *value; /* Color value */ 50 Pixel pixel; /* Color pixel */ 51 } XpmColorSymbol; 52 53 typedef struct { 54 unsigned long valuemask; /* Specifies which attributes are 55 * defined */ 56 57 Visual *visual; /* Specifies the visual to use */ 58 Colormap colormap; /* Specifies the colormap to use */ 59 unsigned int depth; /* Specifies the depth */ 60 unsigned int width; /* Returns the width of the created 61 * pixmap */ 62 unsigned int height; /* Returns the height of the created 63 * pixmap */ 64 unsigned int x_hotspot; /* Returns the x hotspot's 65 * coordinate */ 66 unsigned int y_hotspot; /* Returns the y hotspot's 67 * coordinate */ 68 unsigned int cpp; /* Specifies the number of char per 69 * pixel */ 70 Pixel *pixels; /* List of used color pixels */ 71 unsigned int npixels; /* Number of pixels */ 72 XpmColorSymbol *colorsymbols; /* Array of color symbols to 73 * override */ 74 unsigned int numsymbols; /* Number of symbols */ 75 char *rgb_fname; /* RGB text file name */ 76 77 /* Infos */ 78 unsigned int ncolors; /* Number of colors */ 79 char ***colorTable; /* Color table pointer */ 80 char *hints_cmt; /* Comment of the hints section */ 81 char *colors_cmt; /* Comment of the colors section */ 82 char *pixels_cmt; /* Comment of the pixels section */ 83 unsigned int mask_pixel; /* Transparent pixel's color table 84 * index */ 85 } XpmAttributes; 86 87 /* Xpm attribute value masks bits */ 88 #define XpmVisual (1L<<0) 89 #define XpmColormap (1L<<1) 90 #define XpmDepth (1L<<2) 91 #define XpmSize (1L<<3) /* width & height */ 92 #define XpmHotspot (1L<<4) /* x_hotspot & y_hotspot */ 93 #define XpmCharsPerPixel (1L<<5) 94 #define XpmColorSymbols (1L<<6) 95 #define XpmRgbFilename (1L<<7) 96 #define XpmInfos (1L<<8) /* all infos members */ 97 98 #define XpmReturnPixels (1L<<9) 99 #define XpmReturnInfos XpmInfos 100 101 /* 102 * minimal portability layer between ansi and KR C 103 */ 104 105 /* forward declaration of functions with prototypes */ 106 107 #if __STDC__ || defined(__cplusplus) || defined(c_plusplus) 108 /* ANSI || C++ */ 109 #define FUNC(f, t, p) extern t f p 110 #define LFUNC(f, t, p) static t f p 111 #else /* K&R */ 112 #define FUNC(f, t, p) extern t f() 113 #define LFUNC(f, t, p) static t f() 114 #endif /* end of K&R */ 115 116 117 /* 118 * functions declarations 119 */ 120 121 #ifdef __cplusplus 122 extern "C" { 123 #endif 124 125 FUNC(XpmCreatePixmapFromData, int, (Display * display, 126 Drawable d, 127 char **data, 128 Pixmap * pixmap_return, 129 Pixmap * shapemask_return, 130 XpmAttributes * attributes)); 131 132 FUNC(XpmCreateDataFromPixmap, int, (Display * display, 133 char ***data_return, 134 Pixmap pixmap, 135 Pixmap shapemask, 136 XpmAttributes * attributes)); 137 138 FUNC(XpmReadFileToPixmap, int, (Display * display, 139 Drawable d, 140 char *filename, 141 Pixmap * pixmap_return, 142 Pixmap * shapemask_return, 143 XpmAttributes * attributes)); 144 145 FUNC(XpmWriteFileFromPixmap, int, (Display * display, 146 char *filename, 147 Pixmap pixmap, 148 Pixmap shapemask, 149 XpmAttributes * attributes)); 150 151 FUNC(XpmCreateImageFromData, int, (Display * display, 152 char **data, 153 XImage ** image_return, 154 XImage ** shapemask_return, 155 XpmAttributes * attributes)); 156 157 FUNC(XpmCreateDataFromImage, int, (Display * display, 158 char ***data_return, 159 XImage * image, 160 XImage * shapeimage, 161 XpmAttributes * attributes)); 162 163 FUNC(XpmReadFileToImage, int, (Display * display, 164 char *filename, 165 XImage ** image_return, 166 XImage ** shapeimage_return, 167 XpmAttributes * attributes)); 168 169 FUNC(XpmWriteFileFromImage, int, (Display * display, 170 char *filename, 171 XImage * image, 172 XImage * shapeimage, 173 XpmAttributes * attributes)); 174 175 FUNC(XpmAttributesSize, int, ()); 176 FUNC(XpmFreeAttributes, int, (XpmAttributes * attributes)); 177 178 #ifdef __cplusplus 179 } /* for C++ V2.0 */ 180 181 #endif 182 183 184 /* bakward compatibility */ 185 186 /* for version 3.0c */ 187 #define XpmPixmapColorError XpmColorError 188 #define XpmPixmapSuccess XpmSuccess 189 #define XpmPixmapOpenFailed XpmOpenFailed 190 #define XpmPixmapFileInvalid XpmFileInvalid 191 #define XpmPixmapNoMemory XpmNoMemory 192 #define XpmPixmapColorFailed XpmColorFailed 193 194 #define XpmReadPixmapFile(dpy, d, file, pix, mask, att) \ 195 XpmReadFileToPixmap(dpy, d, file, pix, mask, att) 196 #define XpmWritePixmapFile(dpy, file, pix, mask, att) \ 197 XpmWriteFileFromPixmap(dpy, file, pix, mask, att) 198 199 /* for version 3.0b */ 200 #define PixmapColorError XpmColorError 201 #define PixmapSuccess XpmSuccess 202 #define PixmapOpenFailed XpmOpenFailed 203 #define PixmapFileInvalid XpmFileInvalid 204 #define PixmapNoMemory XpmNoMemory 205 #define PixmapColorFailed XpmColorFailed 206 207 #define ColorSymbol XpmColorSymbol 208 209 #define XReadPixmapFile(dpy, d, file, pix, mask, att) \ 210 XpmReadFileToPixmap(dpy, d, file, pix, mask, att) 211 #define XWritePixmapFile(dpy, file, pix, mask, att) \ 212 XpmWriteFileFromPixmap(dpy, file, pix, mask, att) 213 #define XCreatePixmapFromData(dpy, d, data, pix, mask, att) \ 214 XpmCreatePixmapFromData(dpy, d, data, pix, mask, att) 215 #define XCreateDataFromPixmap(dpy, data, pix, mask, att) \ 216 XpmCreateDataFromPixmap(dpy, data, pix, mask, att) 217 218 #endif 219