1 /* -*-c-*- */ 2 /* Copyright (C) 2002 Olivier Chapuis */ 3 4 #ifndef FXPM_H 5 #define FXPM_H 6 7 #include "PictureBase.h" 8 9 #if XpmSupport 10 #include <X11/xpm.h> 11 #endif 12 13 /* ---------------------------- global definitions ------------------------- */ 14 15 /* ---------------------------- global macros ------------------------------ */ 16 17 /* ---------------------------- type definitions --------------------------- */ 18 19 #if XpmSupport 20 typedef XpmColorSymbol FxpmColorSymbol; 21 typedef XpmExtension FxpmExtension; 22 typedef XpmColor FxpmColor; 23 typedef XpmAttributes FxpmAttributes; 24 typedef XpmImage FxpmImage; 25 typedef XpmInfo FxpmInfo; 26 #else 27 typedef struct { 28 char *name; 29 char *value; 30 Pixel pixel; 31 } FxpmColorSymbol; 32 typedef struct { 33 char *name; 34 unsigned int nlines; 35 char **lines; 36 } FxpmExtension; 37 typedef struct { 38 char *string; 39 char *symbolic; 40 char *m_color; 41 char *g4_color; 42 char *g_color; 43 char *c_color; 44 } FxpmColor; 45 typedef int (*FxpmAllocColorFunc)( 46 #ifdef __STDC__ 47 Display*,Colormap,char*,XColor*,void* 48 #endif 49 ); 50 typedef int (*FxpmFreeColorsFunc)( 51 #ifdef __STDC__ 52 Display*,Colormap,Pixel*,int,void* 53 #endif 54 ); 55 typedef struct { 56 unsigned long valuemask; 57 Visual *visual; 58 Colormap colormap; 59 unsigned int depth; 60 unsigned int width; 61 unsigned int height; 62 unsigned int x_hotspot; 63 unsigned int y_hotspot; 64 unsigned int cpp; 65 Pixel *pixels; 66 unsigned int npixels; 67 FxpmColorSymbol *colorsymbols; 68 unsigned int numsymbols; 69 char *rgb_fname; 70 unsigned int nextensions; 71 FxpmExtension *extensions; 72 unsigned int ncolors; 73 FxpmColor *colorTable; 74 char *hints_cmt; 75 char *colors_cmt; 76 char *pixels_cmt; 77 unsigned int mask_pixel; 78 Bool exactColors; 79 unsigned int closeness; 80 unsigned int red_closeness; 81 unsigned int green_closeness; 82 unsigned int blue_closeness; 83 int color_key; 84 Pixel *alloc_pixels; 85 int nalloc_pixels; 86 Bool alloc_close_colors; 87 int bitmap_format; 88 FxpmAllocColorFunc alloc_color; 89 FxpmFreeColorsFunc free_colors; 90 void *color_closure; 91 } FxpmAttributes; 92 typedef struct { 93 unsigned int width; 94 unsigned int height; 95 unsigned int cpp; 96 unsigned int ncolors; 97 FxpmColor *colorTable; 98 unsigned int *data; 99 } FxpmImage; 100 typedef struct { 101 unsigned long valuemask; 102 unsigned int x_hotspot; 103 unsigned int y_hotspot; 104 } FxpmInfo; 105 #endif 106 107 /* ---------------------------- global definitions ------------------------- */ 108 109 #if XpmSupport 110 111 #define FxpmReturnPixels XpmReturnPixels 112 #define FxpmSize XpmSize 113 #define FxpmReturnAllocPixels XpmReturnAllocPixels 114 #define FxpmCloseness XpmCloseness 115 #define FxpmVisual XpmVisual 116 #define FxpmColormap XpmColormap 117 #define FxpmDepth XpmDepth 118 #define FxpmHotspot XpmHotspot 119 #define FxpmExtensions XpmExtensions 120 #define FxpmCharsPerPixel XpmCharsPerPixel 121 #define FxpmColorSymbols XpmColorSymbols 122 #define FxpmRgbFilename XpmRgbFilename 123 #define FxpmInfos XpmInfos 124 #define FxpmReturnInfos XpmReturnInfos 125 #define FxpmReturnExtensions XpmReturnExtensions 126 #define FxpmRGBCloseness XpmRGBCloseness 127 #define FxpmColorKey XpmColorKey 128 #define FxpmAllocCloseColors XpmAllocCloseColors 129 #define FxpmBitmapFormat XpmBitmapFormat 130 #define FxpmAllocColor XpmAllocColor 131 #define FxpmFreeColors XpmFreeColors 132 #define FxpmColorClosure XpmColorClosure 133 #define FxpmComments XpmComments 134 #define FxpmReturnComments XpmReturnComments 135 136 #define FxpmUndefPixel XpmUndefPixel 137 138 #define FxpmColorError XpmColorError 139 #define FxpmSuccess XpmSuccess 140 #define FxpmOpenFailed XpmOpenFailed 141 #define FxpmFileInvalid XpmFileInvalid 142 #define FxpmNoMemory XpmNoMemory 143 #define FxpmColorFailed XpmColorFailed 144 145 #define FXPM_MONO XPM_MONO 146 #define FXPM_GREY4 XPM_GREY4 147 #define FXPM_GRAY4 XPM_GRAY4 148 #define FXPM_GREY XPM_GREY 149 #define FXPM_GRAY XPM_GRAY 150 #define FXPM_COLOR XPM_COLOR 151 152 #define FxpmReadFileToXpmImage(a,b,c) XpmReadFileToXpmImage(a,b,c) 153 #define FxpmCreatePixmapFromXpmImage(a,b,c,d,e,f) \ 154 XpmCreatePixmapFromXpmImage(a,b,c,d,e,f) 155 #define FxpmFreeXpmImage(a) XpmFreeXpmImage(a) 156 #define FxpmFreeXpmInfo(a) XpmFreeXpmInfo(a) 157 #define FxpmReadFileToPixmap(a,b,c,d,e,f) XpmReadFileToPixmap(a,b,c,d,e,f) 158 #define FxpmReadFileToImage(a,b,c,d,e) XpmReadFileToImage(a,b,c,d,e) 159 #define FxpmCreatePixmapFromData(a,b,c,d,e,f) \ 160 XpmCreatePixmapFromData(a,b,c,d,e,f) 161 162 #else /* !XpmSupport */ 163 #define FxpmReturnPixels 0 164 #define FxpmSize 0 165 #define FxpmReturnAllocPixels 0 166 #define FxpmCloseness 0 167 #define FxpmVisual 0 168 #define FxpmColormap 0 169 #define FxpmDepth 0 170 #define FxpmHotspot 0 171 #define FxpmExtensions 0 172 #define FxpmCharsPerPixel 0 173 #define FxpmColorSymbols 0 174 #define FxpmRgbFilename 0 175 #define FxpmInfos 0 176 #define FxpmReturnInfos 0 177 #define FxpmReturnExtensions 0 178 #define FxpmRGBCloseness 0 179 #define FxpmColorKey 0 180 #define FxpmAllocCloseColors 0 181 #define FxpmBitmapFormat 0 182 #define FxpmAllocColor 0 183 #define FxpmFreeColors 0 184 #define FxpmColorClosure 0 185 #define FxpmComments 0 186 #define FxpmReturnComments 0 187 188 #define FxpmUndefPixel 0 189 190 #define FxpmColorError 1 191 #define FxpmSuccess 0 192 #define FxpmOpenFailed -1 193 #define FxpmFileInvalid -2 194 #define FxpmNoMemory -3 195 #define FxpmColorFailed -4 196 197 #define FXPM_MONO 2 198 #define FXPM_GREY4 3 199 #define FXPM_GRAY4 3 200 #define FXPM_GREY 4 201 #define FXPM_GRAY 4 202 #define FXPM_COLOR 5 203 204 #define FxpmReadFileToXpmImage(a,b,c) 0 205 #define FxpmCreatePixmapFromXpmImage(a,b,c,d,e,f) 0 206 #define FxpmFreeXpmImage(a) 207 #define FxpmFreeXpmInfo(a) 208 #define FxpmReadFileToPixmap(a,b,c,d,e,f) 0 209 #define FxpmCreatePixmapFromData(a,b,c,d,e,f) 0 210 211 #endif /* XpmSupport */ 212 213 #endif /* FXPM_H */ 214