]> git.saurik.com Git - wxWidgets.git/blame - src/gdk_imlib/gdk_imlib_private.h
Removed child frame CreateStatusBar from MDI sample; renamed config.h to confbase.h;
[wxWidgets.git] / src / gdk_imlib / gdk_imlib_private.h
CommitLineData
c801d85f
KB
1#ifdef _HAVE_STRING_H
2#include <string.h>
3#elif _HAVE_STRINGS_H
4#include <strings.h>
5#endif
6
7#ifndef CONVERT_PATH
c79064fb 8#define CONVERT_PATH "/usr/X11/bin"
c801d85f
KB
9#endif
10
11#ifndef NETPBM_PATH
12#define NETPBM_PATH "/usr/local/bin"
13#endif
14
15#ifndef CJPEG_PROG
16#define CJPEG_PROG "/usr/bin/cjpeg"
17#endif
18
19#include <stdio.h>
20#include <unistd.h>
21#include <stdlib.h>
22#include <math.h>
23#include <ctype.h>
24#include <time.h>
25#include <netinet/in.h>
26#include <sys/ipc.h>
27#include <sys/shm.h>
28#include <sys/time.h>
29#include <sys/types.h>
30
31#ifdef _HAVE_STRING_H
32#include <string.h>
33#elif _HAVE_STRINGS_H
34#include <strings.h>
35#endif
36
37#include <X11/Xlib.h>
38#include <X11/Xutil.h>
39#include <X11/Xatom.h>
40#include <X11/Xos.h>
41#include <X11/extensions/XShm.h>
42#include <X11/extensions/shape.h>
43#include <X11/cursorfont.h>
44#include <gdk/gdkprivate.h>
45
46#ifdef HAVE_LIBJPEG
47#include <jpeglib.h>
48#endif
49#ifdef HAVE_LIBPNG
6163f5d8 50#include <../png/png.h>
c801d85f
KB
51#endif
52#ifdef HAVE_LIBTIFF
53#include <tiffio.h>
54#endif
55#ifdef HAVE_LIBGIF
56#include <gif_lib.h>
57#endif
58
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
65
66struct image_cache
67 {
68 gchar *file;
69 GdkImlibImage *im;
70 gint refnum;
71 gchar dirty;
72 struct image_cache *prev;
73 struct image_cache *next;
74 };
75
76struct pixmap_cache
77 {
78 GdkImlibImage *im;
79 gchar *file;
80 gchar dirty;
81 gint width, height;
82 GdkPixmap *pmap;
83 GdkBitmap *shape_mask;
84 XImage *xim, *sxim;
85 gint refnum;
86 struct pixmap_cache *prev;
87 struct pixmap_cache *next;
88 };
89
90typedef struct _xdata
91 {
92 Display *disp;
93 gint screen;
94 Window root;
95 Visual *visual;
96 gint depth;
97 gint render_depth;
98 Colormap root_cmap;
99 gchar shm;
100 gchar shmp;
101 gint shm_event;
102 XImage *last_xim;
103 XImage *last_sxim;
104 XShmSegmentInfo last_shminfo;
105 XShmSegmentInfo last_sshminfo;
106 Window base_window;
107 GdkWindow *gdk_win;
108 GdkColormap *gdk_cmap;
109 }
110Xdata;
111
112typedef struct _imlibdata
113 {
114 gint num_colors;
115 GdkImlibColor *palette;
116 GdkImlibColor *palette_orig;
117 unsigned char *fast_rgb;
118 gint *fast_err;
119 gint *fast_erg;
120 gint *fast_erb;
121 gint render_type;
122 gint max_shm;
123 Xdata x;
124 gint byte_order;
125 struct _cache
126 {
127 gchar on_image;
128 gint size_image;
129 gint num_image;
130 gint used_image;
131 struct image_cache *image;
132 gchar on_pixmap;
133 gint size_pixmap;
134 gint num_pixmap;
135 gint used_pixmap;
136 struct pixmap_cache *pixmap;
137 }
138 cache;
139 gchar fastrend;
140 gchar hiq;
141 GdkImlibColorModifier mod, rmod, gmod, bmod;
142 unsigned char rmap[256], gmap[256], bmap[256];
143 gchar fallback;
144 gchar ordered_dither;
145 }
146ImlibData;
147
148extern ImlibData *id;
149
150gint gindex_best_color_match(gint * r, gint * g, gint * b);
151
152void gdirty_pixmaps(GdkImlibImage * im);
153void gdirty_images(GdkImlibImage * im);
154void gfind_pixmap(GdkImlibImage * im, int width, int height, GdkPixmap ** pmap, GdkBitmap ** mask);
155GdkImlibImage *gfind_image(char *file);
156void gfree_pixmappmap(GdkPixmap * pmap);
157void gfree_image(GdkImlibImage * im);
158void gflush_image(GdkImlibImage * im);
159void gadd_image(GdkImlibImage * im, char *file);
160void gadd_pixmap(GdkImlibImage * im, int width, int height, XImage * xim, XImage * sxim);
161void gclean_caches();
162void gnullify_image(GdkImlibImage * im);
163
164/* char *g_SplitID(char *file); */
165char *g_GetExtension(char *file);
166
167#ifdef HAVE_LIBJPEG
168unsigned char *g_LoadJPEG(FILE * f, int *w, int *h);
169
170#endif /* HAVE_LIBJPEG */
171#ifdef HAVE_LIBPNG
172unsigned char *g_LoadPNG(FILE * f, int *w, int *h, int *t);
173
174#endif /* HAVE_LIBPNG */
175#ifdef HAVE_LIBTIFF
176unsigned char *g_LoadTIFF(char *f, int *w, int *h, int *t);
177
178#endif /* HAVE_LIBTIFF */
179#ifdef HAVE_LIBGIF
180unsigned char *g_LoadGIF(char *f, int *w, int *h, int *t);
181
182#endif /* HAVE_LIBGIF */
183unsigned char *g_LoadXPM(char *f, int *w, int *h, int *t);
184unsigned char *g_LoadPPM(FILE * f, int *w, int *h);
185
186/*
187static int gispnm(char *file);
188static int gisjpeg(char *file);
189static int gispng(char *file);
190static int gistiff(char *file);
191static int giseim(char *file);
192static int gisgif(char *file);
193static int gisxpm(char *file);
194*/
195
196GdkPixmap *gdk_imlib_pixmap_foreign_new(gint width, gint height, gint depth, Pixmap pmap);
197
198void gcalc_map_tables(GdkImlibImage * im);
199
200void g_PaletteAlloc(int num, int *cols);
201
202FILE *open_helper(const char *, const char *, const char *);
203int close_helper(FILE *);
204
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;
211
212#define DITHER_ERROR(Der1,Der2,Dex,Der,Deg,Deb) \
213ter=&(Der1[Dex]);\
214(*ter)+=(Der*7)>>4;ter++;\
215(*ter)+=(Deg*7)>>4;ter++;\
216(*ter)+=(Deb*7)>>4;\
217ter=&(Der2[Dex-6]);\
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++;\
226(*ter)+=Deb>>4;