1 /* File: icon.h */
2 
3 /* Purpose: icon environment definitions */
4 
5 /*
6  * Copyright (c) 1997-2001 Tim Baker
7  *
8  * This software may be copied and distributed for educational, research, and
9  * not for profit purposes provided that this copyright and statement are
10  * included in all such copies.
11  */
12 
13 #ifndef _INCLUDE_ICON_H_
14 #define _INCLUDE_ICON_H_
15 
16 typedef struct IconSpec {
17 	int type;
18 	int index;
19 } IconSpec;
20 
21 extern int g_icon_depth; /* 8, 16 or 24 */
22 extern long g_icon_length;
23 
24 /* 32x32 x 32bits = 32x32x4 */
25 #define ICON_LENGTH_MAX (4096L * 4)
26 
27 typedef byte IconData[ICON_LENGTH_MAX];
28 typedef byte *IconPtr;
29 
30 typedef union PixelPtr
31 {
32 	byte *pix8;
33 	u16b *pix16;
34 	u32b *pix24;
35 } PixelPtr;
36 
37 typedef struct t_icon_data {
38 	cptr desc; /* type name */
39 	IconPtr icon_data; /* Address of icon data */
40 	int icon_count; /* Number of icons */
41 
42 	int depth; /* Bits per pixel (8, 16, 24) */
43 	int bypp; /* Bytes per pixel (1, 2, 3 or 4) */
44 	int width; /* Pixels per column */
45 	int height; /* Pixels per row */
46 	int pitch; /* Convenience: width * bypp */
47 	int length; /* Convenience: width * height * bypp */
48 	int pixels; /* Convenience: width * height */
49 } t_icon_data;
50 
51 extern t_icon_data *g_icon_data; /* Array of icon types */
52 extern int g_icon_data_count; /* Number of icon types */
53 
54 extern void PixelSet_RGB(IconPtr dst, int r, int g, int b, int bypp);
55 
56 extern int Icon_Init(Tcl_Interp *interp, int size, int depth);
57 
58 
59 /*
60  * Constants for g_icon_data[] index.
61  * icon_type.type constants.
62  */
63 
64 /* Special type "none". It's a transparent icon. */
65 #define ICON_TYPE_NONE 0
66 
67 #define ICON_TYPE_BLANK 1
68 #define ICON_TYPE_DEFAULT 2
69 
70 /* One assigned icon */
71 typedef struct t_assign_icon {
72 	int type;
73 	int index;
74 } t_assign_icon;
75 
76 
77 /*
78  * Icon assignment for each member of each group (monster,
79  * object, features, etc)
80  */
81 typedef struct t_assign_group {
82 	int count; /* Number of elements in array */
83 	t_assign_icon *assign; /* Array of iassignments */
84 } t_assign_group;
85 
86 
87 extern byte *g_palette_rgb;
88 
89 #endif /* _INCLUDE_ICON_H_ */
90