1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205
|
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xos.h>
#include <X11/extensions/XShm.h>
#include <X11/extensions/shape.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <time.h>
#include <netinet/in.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef _HAVE_STRING_H
#include <string.h>
#elif _HAVE_STRINGS_H
#include <strings.h>
#endif
#ifndef SYSTEM_IMRC
#define SYSTEM_IMRC "/etc/imrc"
#endif /* endef SYSTEM_IMRC */
typedef struct _ImlibBorder
{
int left, right;
int top, bottom;
}
ImlibBorder;
typedef struct _ImlibColor
{
int r, g, b;
int pixel;
}
ImlibColor;
typedef struct _ImlibColorModifier
{
int gamma;
int brightness;
int contrast;
}
ImlibColorModifier;
typedef struct _ImlibImage
{
int rgb_width, rgb_height;
unsigned char *rgb_data;
unsigned char *alpha_data;
char *filename;
/* the below information is private */
int width, height;
ImlibColor shape_color;
ImlibBorder border;
Pixmap pixmap;
Pixmap shape_mask;
char cache;
ImlibColorModifier mod, rmod, gmod, bmod;
unsigned char rmap[256], gmap[256], bmap[256];
}
ImlibImage;
struct image_cache
{
char *file;
ImlibImage *im;
int refnum;
char dirty;
struct image_cache *prev;
struct image_cache *next;
};
struct pixmap_cache
{
ImlibImage *im;
char *file;
char dirty;
int width, height;
Pixmap pmap;
Pixmap shape_mask;
XImage *xim;
XImage *sxim;
int refnum;
struct pixmap_cache *prev;
struct pixmap_cache *next;
};
typedef struct _xdata
{
Display *disp;
int screen;
Window root;
Visual *visual;
int depth;
int render_depth;
Colormap root_cmap;
char shm;
char shmp;
int shm_event;
XImage *last_xim;
XImage *last_sxim;
XShmSegmentInfo last_shminfo;
XShmSegmentInfo last_sshminfo;
Window base_window;
int byte_order,bit_order;
}
Xdata;
typedef struct _ImlibData
{
int num_colors;
ImlibColor *palette;
ImlibColor *palette_orig;
unsigned char *fast_rgb;
int *fast_err;
int *fast_erg;
int *fast_erb;
int render_type;
int max_shm;
Xdata x;
int byte_order;
struct _cache
{
char on_image;
int size_image;
int num_image;
int used_image;
struct image_cache *image;
char on_pixmap;
int size_pixmap;
int num_pixmap;
int used_pixmap;
struct pixmap_cache *pixmap;
}
cache;
char fastrend;
char hiq;
ImlibColorModifier mod, rmod, gmod, bmod;
unsigned char rmap[256], gmap[256], bmap[256];
char fallback;
char ordered_dither;
}
ImlibData;
typedef struct _ImlibSaveInfo
{
int quality;
int scaling;
int xjustification;
int yjustification;
int page_size;
char color;
}
ImlibSaveInfo;
typedef struct _ImlibInitParams
{
int flags;
int visualid;
char *palettefile;
char sharedmem;
char sharedpixmaps;
char paletteoverride;
char remap;
char fastrender;
char hiquality;
char dither;
int imagecachesize;
int pixmapcachesize;
}
ImlibInitParams;
#define PARAMS_VISUALID 1<<0
#define PARAMS_PALETTEFILE 1<<1
#define PARAMS_SHAREDMEM 1<<2
#define PARAMS_SHAREDPIXMAPS 1<<3
#define PARAMS_PALETTEOVERRIDE 1<<4
#define PARAMS_REMAP 1<<5
#define PARAMS_FASTRENDER 1<<6
#define PARAMS_HIQUALITY 1<<7
#define PARAMS_DITHER 1<<8
#define PARAMS_IMAGECACHESIZE 1<<9
#define PARAMS_PIXMAPCACHESIZE 1<<10
#define PAGE_SIZE_EXECUTIVE 0
#define PAGE_SIZE_LETTER 1
#define PAGE_SIZE_LEGAL 2
#define PAGE_SIZE_A4 3
#define PAGE_SIZE_A3 4
#define PAGE_SIZE_A5 5
#define PAGE_SIZE_FOLIO 6
#define RT_PLAIN_PALETTE 0
#define RT_PLAIN_PALETTE_FAST 1
#define RT_DITHER_PALETTE 2
#define RT_DITHER_PALETTE_FAST 3
#define RT_PLAIN_TRUECOL 4
/* a special high-quality renderer for people with 15 and 16bpp that dithers */
#define RT_DITHER_TRUECOL 5
|