Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

imf.h

Go to the documentation of this file.
00001 /* Definitions for Xconq images.
00002    Copyright (C) 1992-2000 Stanley T. Shebs.
00003 
00004 Xconq is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2, or (at your option)
00007 any later version.  See the file COPYING.  */
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;                                        /*<! Position of actual data within image - x. */
00058     short bboxy;                                        /*<! Position of actual data within image - y. */
00059     short bboxw;                                        /*<! Dimensions of actual data within image - width. */
00060     short bboxh;                                        /*<! Dimensions of actual data within image -height. */
00061     short hexgridx;                                     /*<! Hex grid width in cells. */
00062     short hexgridy;                                     /*<! Hex grid height in cells. */
00063     char *hook;                                 /*<! Pointer to interface-specific data */
00064     struct a_image **subimages;         /*<! Pointer to collection of subimages */
00065     struct a_image *next;                       /*<! Pointer to next image in family */
00066 } Image;
00067 
00068 typedef struct a_image_family {
00069     char *name;                                 /* Name of the family */
00070     short ersatz;                                       /* True if this image is a substitute */
00071     struct a_image_file *location;              /* File or whatever to look for data */
00072     Obj *notes;                                 /* designer notes about the image family */
00073     char *hook;                                 /* Pointer to interface-specific data */
00074     short numsizes;                             /* Number of images in the list */
00075     Image *images;                              /* Pointer to chain of images */
00076     struct a_image_family *next;                /* Pointer to next image family in a list */
00077 } ImageFamily;
00078 
00079 /* Image files are files that contain raw image data in a standard
00080    format, such as GIF or PNG.  We get actual usable images by
00081    extracting from the images in these files. */
00082 
00083 typedef struct a_image_file {
00084     char *name;                 /* Name of the file */
00085     short loaded;               /* True if it has already been loaded */
00086     struct a_image_file *next;  /* Link to the next file. */
00087 } ImageFile;
00088 
00089 /* Structure holding data about a file image, which is the raw result
00090    of loading from an image file.  A file image often holds an array
00091    of smaller images that will be extracted to make up image
00092    families. */
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 /* Flag that indicates limited GDI memory in Windows ME and below. */
00117 extern short poor_memory;
00118 
00119 /* (should remove these fixed limits someday) */
00120 
00121 #define MAXIMAGEFAMILIES 3000
00122 
00123 /* Some handy macros. */
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);

Generated on Sat Sep 17 10:28:53 2005 for XconqKernel by doxygen 1.3.6