1 #ifndef _IMAGELIB_H_
2 #define _IMAGELIB_H_
3 
4 #ifdef _cards_h_
5 #error include imagelib.h before cards.h
6 #endif
7 
8 #ifndef PIXELS_TYPE
9 #define PIXELS_TYPE void *
10 #endif
11 
12 typedef struct image {
13   /* filled in by make-imglib */
14   int width;
15   int height;
16   const unsigned char *file_data;
17   /* available to program */
18   struct image *next;
19   int type;
20   PIXELS_TYPE pixels; /* platform and display specific format, like XImage or Pixmap */
21   struct image_list *list;
22   void (*synth_func)(struct image *); /* if set, is synthetic */
23   int synth_flags;
24 } image;
25 
26 struct image_list;
27 
28 typedef image *(*synth_imagelist_function)(struct image_list *list, int type, int width, int height);
29 
30 typedef struct image_list {
31   /* filled in by make-imglib */
32   char *name;
33   int across;
34   int down;
35   image *subimage[3];
36   /* available to program */
37   struct image_list *next;
38   synth_imagelist_function synth_func; /* if set, is synthetic */
39   int synth_flags;
40 } image_list;
41 
42 /* Put to this to display on the display's main window. */
43 extern image *display_image;
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #if 0
48 } /* To keep emacs from indenting all the below functions. */
49 #endif
50 #endif
51 
52 extern image_list appimglib_imagelib[];
53 int register_imagelib(image_list *);
54 
55 image *alloc_synth_image (image_list *list, int width, int height, int type);
56 
57 void   get_image_set_display_type (int type);
58 image *get_image (char *name, int preferred_width, int preferred_height, int flags);
59 /* This means the preferred dimensions are absolute maximums. */
60 #define GI_NOT_BIGGER	0x01
61 /* This means that a close size match is more important than the right type. */
62 #define GI_ANY_TYPE	0x02
63 
64 #define PUT_INVERTED	0x01
65 #define PUT_ROTATED	0x02
66 /* dx dy relative to where src's origin would have been, not relative
67    to the x, y point indicated here. */
68 void put_image (image *src, int x, int y, int w, int h,
69 		image *dest, int dx, int dy, int flags);
70 /* Same, but copies mask (creating one if needed) */
71 void put_mask (image *src, int x, int y, int w, int h,
72 	       image *dest, int dx, int dy, int flags);
73 /* Similar, but always the whole subimage (based on across, down in image_list) */
74 void put_subimage (image *src, int col, int row,
75 		   image *dest, int dx, int dy, int flags);
76 /* For synthesizing images. */
77 void fill_image (image *dest, int x, int y, int w, int h,
78 		 int r, int g, int b);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif
85