1 /*
2  * cursor.h �����������(general)
3  *
4  * Copyright (C) 2000- TAJIRI Yasuhiro  <tajiri@venus.dti.ne.jp>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20 */
21 /* $Id: cursor.h,v 1.3 2001/03/30 19:16:38 chikama Exp $ */
22 
23 #ifndef __CURSOR_H__
24 #define __CURSOR_H__
25 
26 #define BitSet(byte, bit)  (((byte) & (bit)) == (bit))
27 
28 typedef struct {
29 	short idReserved;  /* always set to 0 */
30 	short idType;      /* always set to 1 */
31 	short idCount;     /* number of cursor images,always set to 1 */
32 	/* immediately followed by idCount TCursorDirEntries */
33 } CursorHeader;
34 
35 typedef struct {
36 	unsigned char  bWidth;       /* Width */
37 	unsigned char  bHeight;	     /* Height */
38 	unsigned char  bColorCount;
39 	unsigned char  bReserved;
40 	unsigned short wxHotspot;
41 	unsigned short wyHotspot;
42 	unsigned long  dwBytesInRes; /* total number of bytes in image */
43 	unsigned long  dwImageOffset;
44 } TCursorDirEntry;
45 
46 typedef struct {
47 	long biSize;           /* sizeof(TBitmapInfoHeader) */
48 	long biWidth;          /* width of bitmap */
49 	long biHeight;	       /* height of bitmap, see notes */
50 	short biPlanes;	       /* planes, always 1 */
51 	short biBitCount;      /* number of color bits */
52 	long biCompression;    /* compression used, 0 */
53 	long biSizeImage;      /* size of the pixel data, see notes */
54 	long biXPelsPerMeter;  /* not used, 0 */
55 	long biYPelsPerMeter;  /* not used, 0 */
56 	long biClrUsed;	       /* # of colors used, set to 0 */
57 	long biClrImportant;   /* important colors, set to 0 */
58 	short hotX;
59 	short hotY;
60 } TBitmapInfoHeader;
61 
62 /*
63    biHeight=2*TIconDirEntry.bHeight;
64    biSizeImage=ANDmask + XORmask;
65 
66    XORmask=(TIconDirEntry.bWidth * TIconDirEntry.bHeight * biBitCount)/8;
67    ANDmask=(TIconDirEntry.bWidth * TIconDirEntry.bHeight)/8;
68  */
69 
70 typedef struct {
71 	unsigned char rgbBlue;     /* blue component of color */
72 	unsigned char rgbGreen;    /* green component of color */
73 	unsigned char rgbRed;      /* red component of color */
74 	unsigned char rgbReserved; /* reserved, 0 */
75 } TRGBQuad;
76 
77 typedef struct {
78 	TBitmapInfoHeader icHeader; /* image header info */
79 	TRGBQuad *icColors;	    /* image palette */
80 	int xormasklen;
81 	int andmasklen;
82 } CursorImage;
83 
84 typedef struct {
85 	int cbSizeof;
86 	int cFrames;
87 	int cSteps;
88 	int cx;
89 	int cy;
90 	int cBitCount;
91 	int cPlanes;
92 	int jiffRate;
93 	int fl;
94 
95 	int *rate;
96 	int *seq;
97 } AnimationCursorHeader ;
98 
99 typedef struct {
100 	AnimationCursorHeader *header;
101 	CursorImage *images;
102 } AniCursorImage;
103 
104 extern void cursor_load(int no, int linkno);
105 
106 #endif  /* __CURSOR_H__ */
107