rnd-20001130-1-src
[rocksndiamonds.git] / src / image.h
1 /***********************************************************
2 *  Rocks'n'Diamonds -- McDuffin Strikes Back!              *
3 *----------------------------------------------------------*
4 *  (c) 1995-98 Artsoft Entertainment                       *
5 *              Holger Schemel                              *
6 *              Oststrasse 11a                              *
7 *              33604 Bielefeld                             *
8 *              phone: ++49 +521 290471                     *
9 *              email: aeglos@valinor.owl.de                *
10 *----------------------------------------------------------*
11 *  image.h                                                 *
12 ***********************************************************/
13
14 #ifndef IMAGE_H
15 #define IMAGE_H
16
17 #ifndef TARGET_SDL
18
19 #include "main.h"
20
21 #define MAX_COLORS      256     /* maximal number of colors for each image */
22
23 typedef unsigned short Intensity;       /* RGB intensity for X11 */
24
25 typedef struct
26 {
27   Display  *display;            /* destination display             */
28   int       depth;              /* depth of destination drawable   */
29   Pixel     index[MAX_COLORS];  /* array of pixel values           */
30   int       no;                 /* number of pixels in the array   */
31   Colormap  cmap;               /* colormap used for image         */
32   Pixmap   pixmap;              /* final pixmap                    */
33   Pixmap   pixmap_mask;         /* final pixmap of mask            */
34 } XImageInfo;
35
36 struct RGBMap
37 {
38   unsigned int used;                    /* number of colors used in RGB map */
39   Intensity    red[MAX_COLORS];         /* color values in X style          */
40   Intensity    green[MAX_COLORS];
41   Intensity    blue[MAX_COLORS];
42   boolean      color_used[MAX_COLORS];  /* flag if color cell is used       */
43 };
44
45 typedef struct
46 {
47   struct RGBMap rgb;            /* RGB map of image if IRGB type       */
48   unsigned int  width;          /* width of image in pixels            */
49   unsigned int  height;         /* height of image in pixels           */
50   unsigned int  depth;          /* depth of image in bits if IRGB type */
51   byte         *data;           /* image data                          */
52 } Image;
53
54 Image *newImage(unsigned int, unsigned int, unsigned int);
55 void freeImage(Image *);
56 void freeXImage(Image *, XImageInfo *);
57 int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *);
58
59 #endif /* !TARGET_SDL */
60 #endif  /* IMAGE_H */