00001
00002
00003
00004
00005
00006
00007
00008
00021 typedef struct a_image {
00022 short w;
00023 short h;
00024 short istile;
00025 short isterrain;
00026 short isconnection;
00027 short isborder;
00028 short istransition;
00029 short numsubimages;
00030 short subx;
00031 short suby;
00032 char *embedname;
00033 short embedx;
00034 short embedy;
00035 short embedw;
00036 short embedh;
00037 Obj *monodata;
00038 Obj *colrdata;
00039 Obj *maskdata;
00040 Obj *filedata;
00041 struct a_file_image *file_image;
00042 short actualw;
00043 short actualh;
00044 short pixelsize;
00045 short orig_pixelsize;
00046 Obj *palette;
00047 Obj *notes;
00048 short synthetic;
00049 char *rawmonodata;
00050 char *rawcolrdata;
00051 char *rawmaskdata;
00052 int *rawpalette;
00053 short numcolors;
00054 short r;
00055 short g;
00056 short b;
00057 short bboxx;
00058 short bboxy;
00059 short bboxw;
00060 short bboxh;
00061 short hexgridx;
00062 short hexgridy;
00063 char *hook;
00064 struct a_image **subimages;
00065 struct a_image *next;
00066 } Image;
00067
00068 typedef struct a_image_family {
00069 char *name;
00070 short ersatz;
00071 struct a_image_file *location;
00072 Obj *notes;
00073 char *hook;
00074 short numsizes;
00075 Image *images;
00076 struct a_image_family *next;
00077 } ImageFamily;
00078
00079
00080
00081
00082
00083 typedef struct a_image_file {
00084 char *name;
00085 short loaded;
00086 struct a_image_file *next;
00087 } ImageFile;
00088
00089
00090
00091
00092
00093
00094 typedef struct a_file_image {
00095 char *name;
00096 short type;
00097 short loaded;
00098 short width, height;
00099 char *data;
00100 short numcolors;
00101 int *palette;
00102 short numtransparent;
00103 char *transparent;
00104 struct a_file_image *next;
00105 } FileImage;
00106
00107 extern ImageFamily **images;
00108 extern int numimages;
00109 extern ImageFile *image_files;
00110 extern FileImage *file_images;
00111 extern ImageFamily *(*imf_load_hook)(ImageFamily *imf);
00112 extern ImageFamily *(*imf_interp_hook)(ImageFamily *imf, Image *img,
00113 int force);
00114 extern int use_clip_mask;
00115
00116
00117 extern short poor_memory;
00118
00119
00120
00121 #define MAXIMAGEFAMILIES 3000
00122
00123
00124
00125 #define computed_rowbytes(w, pixelsize) (((w * pixelsize) + 7) / 8)
00126
00127 #define hextoi(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : ((c) - 'a' + 10))
00128
00129 #define for_all_images(imf,img) \
00130 for ((img) = (imf)->images; (img) != NULL; (img) = (img)->next)
00131
00132 typedef void (*readimf_hook)(ImageFamily *, int);
00133
00134 extern ImageFamily *clone_imf(ImageFamily *imf);
00135 extern ImageFamily *get_imf(char *name);
00136 extern ImageFamily *find_imf(char *name);
00137 extern Image *find_img(ImageFamily *imf, int w, int h);
00138 extern Image *get_img(ImageFamily *imf, int w, int h);
00139 extern int valid_imf_name(char *name);
00140
00141 extern ImageFile *get_image_file(char *name);
00142 extern void load_image_families(FILE *fp, int loadnow, readimf_hook callback);
00143 extern int load_imf_file(char *filename, readimf_hook callback);
00144 extern void interp_imf_form(Obj *form, char *filename, readimf_hook callback);
00145
00146 extern ImageFamily *interp_imf(Obj *form);
00147 extern void interp_imf_contents(ImageFamily *imf, Obj *form);
00148 extern void interp_image(ImageFamily *imf, Obj *size, Obj *parts);
00149 extern void interp_bytes(Obj *datalist, int numbytes, char *destaddr,
00150 int jump);
00151
00152 extern Image *best_image_in_range(ImageFamily *imf, int w, int h,
00153 int wmin, int hmin, int wmax, int hmax);
00154 #define best_image(imf, w, h) best_image_in_range(imf, w, h, 0, 0, -1, -1)
00155 extern Image *smallest_image(ImageFamily *imf);
00156 extern int emblem_position(Image *uimg, char *ename, ImageFamily *eimf,
00157 int sw, int sh, int vpuh, int vphh,
00158 int *exxp, int *eyyp, int *ewp, int *ehp);
00159
00160 extern void blacken_masked_area(ImageFamily *imf, Image *img,
00161 int r, int g, int b);
00162 extern void blacken_mono_masked_area(ImageFamily *imf, Image *img,
00163 int r, int g, int b);
00164
00165 extern void make_raw_palette(Image *img);
00166
00167 extern void sort_all_images(void);
00168
00169 extern void check_imf(ImageFamily *imf);
00170
00171 extern void write_imf(FILE *fp, ImageFamily *imf);
00172
00173 extern void make_generic_image_data(ImageFamily *imf);
00174
00175 extern void validify_imf_name(char *buf);
00176 extern void compute_image_bboxes(ImageFamily *imf);
00177 extern void compute_image_bbox(Image *img);
00178 extern void write_imf_dir(char *filename, ImageFamily **imfimages, int num);
00179 extern char *find_color_name(int r, int g, int b);
00180 extern void parse_lisp_palette_entry(Obj *palentry, int *c,
00181 int *r, int *g, int *b);
00182
00183 extern void make_image_from_file_image(ImageFamily *imf,
00184 Image *img, Image *subimg, int subi);
00185 extern void load_file_image(FileImage *fimg);
00186 extern void copy_from_file_image(Image *img, FileImage *fimg,
00187 int xoffset, int yoffset,
00188 int actualw, int actualh);
00189 extern int get_gif(FileImage *fimg);
00190 extern void make_raw_mono_data(Image *img, int force);
00191 extern FileImage *get_file_image(char *fname);
00192
00193 extern ImageFamily *get_generic_images(char *name);