8 #define CONVERT_PATH "/usr/local/bin"
12 #define NETPBM_PATH "/usr/local/bin"
16 #define CJPEG_PROG "/usr/bin/cjpeg"
25 #include <netinet/in.h>
29 #include <sys/types.h>
38 #include <X11/Xutil.h>
39 #include <X11/Xatom.h>
41 #include <X11/extensions/XShm.h>
42 #include <X11/extensions/shape.h>
43 #include <X11/cursorfont.h>
44 #include <gdk/gdkprivate.h>
59 #define BYTE_ORD_24_RGB 0
60 #define BYTE_ORD_24_RBG 1
61 #define BYTE_ORD_24_BRG 2
62 #define BYTE_ORD_24_BGR 3
63 #define BYTE_ORD_24_GRB 4
64 #define BYTE_ORD_24_GBR 5
72 struct image_cache
*prev
;
73 struct image_cache
*next
;
83 GdkBitmap
*shape_mask
;
86 struct pixmap_cache
*prev
;
87 struct pixmap_cache
*next
;
104 XShmSegmentInfo last_shminfo
;
105 XShmSegmentInfo last_sshminfo
;
108 GdkColormap
*gdk_cmap
;
112 typedef struct _imlibdata
115 GdkImlibColor
*palette
;
116 GdkImlibColor
*palette_orig
;
117 unsigned char *fast_rgb
;
131 struct image_cache
*image
;
136 struct pixmap_cache
*pixmap
;
141 GdkImlibColorModifier mod
, rmod
, gmod
, bmod
;
142 unsigned char rmap
[256], gmap
[256], bmap
[256];
144 gchar ordered_dither
;
148 extern ImlibData
*id
;
150 gint
gindex_best_color_match(gint
* r
, gint
* g
, gint
* b
);
152 void gdirty_pixmaps(GdkImlibImage
* im
);
153 void gdirty_images(GdkImlibImage
* im
);
154 void gfind_pixmap(GdkImlibImage
* im
, int width
, int height
, GdkPixmap
** pmap
, GdkBitmap
** mask
);
155 GdkImlibImage
*gfind_image(char *file
);
156 void gfree_pixmappmap(GdkPixmap
* pmap
);
157 void gfree_image(GdkImlibImage
* im
);
158 void gflush_image(GdkImlibImage
* im
);
159 void gadd_image(GdkImlibImage
* im
, char *file
);
160 void gadd_pixmap(GdkImlibImage
* im
, int width
, int height
, XImage
* xim
, XImage
* sxim
);
161 void gclean_caches();
162 void gnullify_image(GdkImlibImage
* im
);
164 /* char *g_SplitID(char *file); */
165 char *g_GetExtension(char *file
);
168 unsigned char *g_LoadJPEG(FILE * f
, int *w
, int *h
);
170 #endif /* HAVE_LIBJPEG */
172 unsigned char *g_LoadPNG(FILE * f
, int *w
, int *h
, int *t
);
174 #endif /* HAVE_LIBPNG */
176 unsigned char *g_LoadTIFF(char *f
, int *w
, int *h
, int *t
);
178 #endif /* HAVE_LIBTIFF */
180 unsigned char *g_LoadGIF(char *f
, int *w
, int *h
, int *t
);
182 #endif /* HAVE_LIBGIF */
183 unsigned char *g_LoadXPM(char *f
, int *w
, int *h
, int *t
);
184 unsigned char *g_LoadPPM(FILE * f
, int *w
, int *h
);
187 static int gispnm(char *file);
188 static int gisjpeg(char *file);
189 static int gispng(char *file);
190 static int gistiff(char *file);
191 static int giseim(char *file);
192 static int gisgif(char *file);
193 static int gisxpm(char *file);
196 GdkPixmap
*gdk_imlib_pixmap_foreign_new(gint width
, gint height
, gint depth
, Pixmap pmap
);
198 void gcalc_map_tables(GdkImlibImage
* im
);
200 void g_PaletteAlloc(int num
, int *cols
);
202 FILE *open_helper(const char *, const char *, const char *);
203 int close_helper(FILE *);
205 #define INDEX_RGB(r,g,b) id->fast_rgb[(r<<10)|(g<<5)|(b)]
206 #define COLOR_INDEX(i) id->palette[i].pixel
207 #define COLOR_RGB(r,g,b) id->palette[INDEX_RGB(r,g,b)].pixel
208 #define ERROR_RED(rr,i) rr-id->palette[i].r;
209 #define ERROR_GRN(gg,i) gg-id->palette[i].g;
210 #define ERROR_BLU(bb,i) bb-id->palette[i].b;
212 #define DITHER_ERROR(Der1,Der2,Dex,Der,Deg,Deb) \
214 (*ter)+=(Der*7)>>4;ter++;\
215 (*ter)+=(Deg*7)>>4;ter++;\
218 (*ter)+=(Der*3)>>4;ter++;\
219 (*ter)+=(Deg*3)>>4;ter++;\
220 (*ter)+=(Deb*3)>>4;ter++;\
221 (*ter)+=(Der*5)>>4;ter++;\
222 (*ter)+=(Deg*5)>>4;ter++;\
223 (*ter)+=(Deb*5)>>4;ter++;\
224 (*ter)+=Der>>4;ter++;\
225 (*ter)+=Deg>>4;ter++;\