rnd-20001202-2-src
[rocksndiamonds.git] / src / libgame / 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 #include "platform.h"
18
19 #ifndef TARGET_SDL
20
21 #include "types.h"
22 #include "system.h"
23
24 /*
25 #include "types.h"
26 #include "x11.h"
27 */
28
29 #define MAX_COLORS      256     /* maximal number of colors for each image */
30
31 typedef unsigned short Intensity;       /* RGB intensity for X11 */
32
33 typedef struct
34 {
35   Display  *display;            /* destination display             */
36   int       depth;              /* depth of destination drawable   */
37   Pixel     index[MAX_COLORS];  /* array of pixel values           */
38   int       no;                 /* number of pixels in the array   */
39   Colormap  cmap;               /* colormap used for image         */
40   Pixmap   pixmap;              /* final pixmap                    */
41   Pixmap   pixmap_mask;         /* final pixmap of mask            */
42 } XImageInfo;
43
44 struct RGBMap
45 {
46   unsigned int used;                    /* number of colors used in RGB map */
47   Intensity    red[MAX_COLORS];         /* color values in X style          */
48   Intensity    green[MAX_COLORS];
49   Intensity    blue[MAX_COLORS];
50   boolean      color_used[MAX_COLORS];  /* flag if color cell is used       */
51 };
52
53 typedef struct
54 {
55   struct RGBMap rgb;            /* RGB map of image if IRGB type       */
56   unsigned int  width;          /* width of image in pixels            */
57   unsigned int  height;         /* height of image in pixels           */
58   unsigned int  depth;          /* depth of image in bits if IRGB type */
59   byte         *data;           /* image data                          */
60 } Image;
61
62 Image *newImage(unsigned int, unsigned int, unsigned int);
63 void freeImage(Image *);
64 void freeXImage(Image *, XImageInfo *);
65 int Read_PCX_to_Pixmap(Display *, Window, GC, char *, Pixmap *, Pixmap *);
66
67 #endif /* !TARGET_SDL */
68 #endif  /* IMAGE_H */