rnd-20010115-1-src
[rocksndiamonds.git] / src / libgame / image.h
1 /***********************************************************
2 * Artsoft Retro-Game Library                               *
3 *----------------------------------------------------------*
4 * (c) 1994-2001 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * image.h                                                  *
12 ***********************************************************/
13
14 #ifndef IMAGE_H
15 #define IMAGE_H
16
17 #include "system.h"
18
19
20 #if defined(TARGET_X11)
21
22 #define MAX_COLORS      256     /* maximal number of colors for each image */
23
24 typedef unsigned short Intensity;       /* RGB intensity for X11 */
25
26 typedef struct
27 {
28   Display  *display;            /* destination display             */
29   int       depth;              /* depth of destination drawable   */
30   Pixel     index[MAX_COLORS];  /* array of pixel values           */
31   int       no;                 /* number of pixels in the array   */
32   Colormap  cmap;               /* colormap used for image         */
33   Pixmap   pixmap;              /* final pixmap                    */
34   Pixmap   pixmap_mask;         /* final pixmap of mask            */
35 } XImageInfo;
36
37 struct RGBMap
38 {
39   unsigned int used;                    /* number of colors used in RGB map */
40   Intensity    red[MAX_COLORS];         /* color values in X style          */
41   Intensity    green[MAX_COLORS];
42   Intensity    blue[MAX_COLORS];
43   boolean      color_used[MAX_COLORS];  /* flag if color cell is used       */
44 };
45
46 typedef struct
47 {
48   struct RGBMap rgb;            /* RGB map of image if IRGB type       */
49   unsigned int  width;          /* width of image in pixels            */
50   unsigned int  height;         /* height of image in pixels           */
51   unsigned int  depth;          /* depth of image in bits if IRGB type */
52   byte         *data;           /* image data                          */
53 } Image;
54
55 Image *newImage(unsigned int, unsigned int, unsigned int);
56 void freeImage(Image *);
57 void freeXImage(Image *, XImageInfo *);
58 int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *);
59
60 #endif /* TARGET_X11 */
61
62 #endif  /* IMAGE_H */