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
|
#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;
} Xdata;
typedef struct _ImlibData
{
int num_colors;
ImlibColor *palette;
ImlibColor *palette_orig;
int *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;
} ImlibData;
typedef struct _ImlibSaveInfo
{
int quality;
int scaling;
int xjustification;
int yjustification;
int page_size;
char color;
} ImlibSaveInfo;
#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
|