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
|
#ifndef CONVERT_PATH
#define CONVERT_PATH "/usr/bin"
#endif
#ifndef NETPBM_PATH
#define NETPBM_PATH "/usr/bin"
#endif
#ifndef CJPEG_PROG
#define CJPEG_PROG "/usr/bin/cjpeg"
#endif
#ifndef DJPEG_PROG
#define DJPEG_PROG "/usr/bin/djpeg"
#endif
#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
#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 <X11/cursorfont.h>
#ifdef HAVE_LIBJPEG
#include <jpeglib.h>
#endif
#ifdef HAVE_LIBPNG
#include <png.h>
#endif
#ifdef HAVE_LIBTIFF
#include <tiffio.h>
#endif
#ifdef HAVE_LIBGIF
#include <gif_lib.h>
#endif
#define BYTE_ORD_24_RGB 0
#define BYTE_ORD_24_RBG 1
#define BYTE_ORD_24_BRG 2
#define BYTE_ORD_24_BGR 3
#define BYTE_ORD_24_GRB 4
#define BYTE_ORD_24_GBR 5
int index_best_color_match(ImlibData * id, int *r, int *g, int *b);
void dirty_pixmaps(ImlibData * id, ImlibImage * im);
void dirty_images(ImlibData * id, ImlibImage * im);
void find_pixmap(ImlibData * id, ImlibImage * im, int width, int height, Pixmap * pmap, Pixmap * mask);
ImlibImage *find_image(ImlibData * id, char *file);
void free_pixmappmap(ImlibData * id, Pixmap pmap);
void free_image(ImlibData * id, ImlibImage * im);
void flush_image(ImlibData * id, ImlibImage * im);
void add_image(ImlibData * id, ImlibImage * im, char *file);
void add_pixmap(ImlibData * id, ImlibImage * im, int width, int height, XImage * xim, XImage * sxim);
void clean_caches(ImlibData * id);
void nullify_image(ImlibData * id, ImlibImage * im);
char *_GetExtension(char *file);
#ifdef HAVE_LIBJPEG
unsigned char *_LoadJPEG(ImlibData * id, FILE * f, int *w, int *h);
#endif /* HAVE_LIBJPEG */
#ifdef HAVE_LIBPNG
unsigned char *_LoadPNG(ImlibData * id, FILE * f, int *w, int *h, int *t);
#endif /* HAVE_LIBPNG */
#ifdef HAVE_LIBTIFF
unsigned char *_LoadTIFF(ImlibData * id, char *f, int *w, int *h, int *t);
#endif /* HAVE_LIBTIFF */
#ifdef HAVE_LIBGIF
unsigned char *_LoadGIF(ImlibData * id, char *f, int *w, int *h, int *t);
#endif /* HAVE_LIBGIF */
unsigned char *_LoadBMP(ImlibData * id, char *f, int *w, int *h, int *t);
unsigned char *_LoadXPM(ImlibData * id, char *f, int *w, int *h, int *t);
unsigned char *_LoadPPM(ImlibData * id, FILE * f, int *w, int *h);
int ispnm(char *file);
int isjpeg(char *file);
int ispng(char *file);
int istiff(char *file);
int iseim(char *file);
int isgif(char *file);
int isxpm(char *file);
int isbmp(char *file);
void calc_map_tables(ImlibData * id, ImlibImage * im);
void _PaletteAlloc(ImlibData * id, int num, int *cols);
FILE *open_helper(const char *, const char *, const char *);
int close_helper(FILE *);
#define INDEX_RGB(r,g,b) id->fast_rgb[(r<<10)|(g<<5)|(b)]
#define COLOR_INDEX(i) id->palette[i].pixel
#define COLOR_RGB(r,g,b) id->palette[INDEX_RGB(r,g,b)].pixel
#define ERROR_RED(rr,i) rr-id->palette[i].r;
#define ERROR_GRN(gg,i) gg-id->palette[i].g;
#define ERROR_BLU(bb,i) bb-id->palette[i].b;
#define DITHER_ERROR(Der1,Der2,Dex,Der,Deg,Deb) \
ter=&(Der1[Dex]);\
(*ter)+=(Der*7)>>4;ter++;\
(*ter)+=(Deg*7)>>4;ter++;\
(*ter)+=(Deb*7)>>4;\
ter=&(Der2[Dex-6]);\
(*ter)+=(Der*3)>>4;ter++;\
(*ter)+=(Deg*3)>>4;ter++;\
(*ter)+=(Deb*3)>>4;ter++;\
(*ter)+=(Der*5)>>4;ter++;\
(*ter)+=(Deg*5)>>4;ter++;\
(*ter)+=(Deb*5)>>4;ter++;\
(*ter)+=Der>>4;ter++;\
(*ter)+=Deg>>4;ter++;\
(*ter)+=Deb>>4;
|