source: trunk/src/pe2lx/icon.h@ 1036

Last change on this file since 1036 was 349, checked in by sandervl, 26 years ago

Icon changes (saved in BITMAPINFOHEADER2 format)

File size: 6.4 KB
Line 
1/* $Id: icon.h,v 1.4 1999-07-20 17:50:19 sandervl Exp $ */
2
3/* $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/pe2lx/icon.h,v 1.4 1999-07-20 17:50:19 sandervl Exp $
4 *
5 * Declarations, protypes and defintions for conversion of icons.
6 *
7 * Copyright (c) 1997-1999 Sander van Leeuwen
8 * Copyright (c) 1998-1999 knut st. osmundsen
9 *
10 *
11 * Project Odin Software License can be found in LICENSE.TXT
12 *
13 */
14
15#ifndef __ICON_H__
16#define __ICON_H__
17
18#pragma pack(1)
19
20/* Win v4.0 bitmap structs */
21/* Image Color Matching color definitions */
22
23typedef LONG LCSCSTYPE;
24
25#define LCS_CALIBRATED_RGB 0x00000000L
26#define LCS_DEVICE_RGB 0x00000001L
27#define LCS_DEVICE_CMYK 0x00000002L
28typedef LONG LCSGAMUTMATCH;
29
30#define LCS_GM_BUSINESS 0x00000001L
31#define LCS_GM_GRAPHICS 0x00000002L
32#define LCS_GM_IMAGES 0x00000004L
33
34/* ICM Defines for results from CheckColorInGamut() */
35#define CM_OUT_OF_GAMUT 255
36#define CM_IN_GAMUT 0
37
38/* Macros to retrieve CMYK values from a COLORREF */
39#define GetKValue(cmyk) ((BYTE)(cmyk))
40#define GetYValue(cmyk) ((BYTE)((cmyk)>> 8))
41#define GetMValue(cmyk) ((BYTE)((cmyk)>>16))
42#define GetCValue(cmyk) ((BYTE)((cmyk)>>24))
43#define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24)))
44
45typedef long FXPT16DOT16, FAR *LPFXPT16DOT16;
46typedef long FXPT2DOT30, FAR *LPFXPT2DOT30;
47
48/* ICM Color Definitions */
49// The following two structures are used for defining RGB's in terms of
50// CIEXYZ. The values are fixed point 16.16.
51typedef struct tagCIEXYZ
52{
53 FXPT2DOT30 ciexyzX;
54 FXPT2DOT30 ciexyzY;
55 FXPT2DOT30 ciexyzZ;
56} CIEXYZ;
57typedef CIEXYZ FAR *LPCIEXYZ;
58
59typedef struct tagICEXYZTRIPLE
60{
61 CIEXYZ ciexyzRed;
62 CIEXYZ ciexyzGreen;
63 CIEXYZ ciexyzBlue;
64} CIEXYZTRIPLE;
65typedef CIEXYZTRIPLE FAR *LPCIEXYZTRIPLE;
66
67#ifndef MAX_PATH
68 #define MAX_PATH CCHMAXPATH
69#endif
70// The next structures the logical color space. Unlike pens and brushes,
71// but like palettes, there is only one way to create a LogColorSpace.
72// A pointer to it must be passed, its elements can't be pushed as
73// arguments.
74
75typedef struct tagLOGCOLORSPACEA
76{
77 DWORD lcsSignature;
78 DWORD lcsVersion;
79 DWORD lcsSize;
80 LCSCSTYPE lcsCSType;
81 LCSGAMUTMATCH lcsIntent;
82 CIEXYZTRIPLE lcsEndpoints;
83 DWORD lcsGammaRed;
84 DWORD lcsGammaGreen;
85 DWORD lcsGammaBlue;
86 CHAR lcsFilename[MAX_PATH];
87} LOGCOLORSPACEA, *LPLOGCOLORSPACEA;
88
89typedef struct tagLOGCOLORSPACEW
90{
91 DWORD lcsSignature;
92 DWORD lcsVersion;
93 DWORD lcsSize;
94 LCSCSTYPE lcsCSType;
95 LCSGAMUTMATCH lcsIntent;
96 CIEXYZTRIPLE lcsEndpoints;
97 DWORD lcsGammaRed;
98 DWORD lcsGammaGreen;
99 DWORD lcsGammaBlue;
100 WCHAR lcsFilename[MAX_PATH];
101} LOGCOLORSPACEW, *LPLOGCOLORSPACEW;
102
103#ifdef UNICODE
104typedef LOGCOLORSPACEW LOGCOLORSPACE;
105typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE;
106#else
107typedef LOGCOLORSPACEA LOGCOLORSPACE;
108typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE;
109#endif // UNICODE
110
111typedef struct
112{
113 DWORD bV4Size;
114 LONG bV4Width;
115 LONG bV4Height;
116 WORD bV4Planes;
117 WORD bV4BitCount;
118 DWORD bV4V4Compression;
119 DWORD bV4SizeImage;
120 LONG bV4XPelsPerMeter;
121 LONG bV4YPelsPerMeter;
122 DWORD bV4ClrUsed;
123 DWORD bV4ClrImportant;
124 DWORD bV4RedMask;
125 DWORD bV4GreenMask;
126 DWORD bV4BlueMask;
127 DWORD bV4AlphaMask;
128 DWORD bV4CSType;
129 CIEXYZTRIPLE bV4Endpoints;
130 DWORD bV4GammaRed;
131 DWORD bV4GammaGreen;
132 DWORD bV4GammaBlue;
133} BITMAPV4HEADER, /*FAR *LPBITMAPV4HEADER,*/ *PBITMAPV4HEADER;
134
135/* constants for the biCompression field */
136#define BI_RGB 0L
137#define BI_RLE8 1L
138#define BI_RLE4 2L
139#define BI_BITFIELDS 3L
140
141/* Win v3.0 bitmap structs */
142typedef struct
143{
144 WORD wReserved; // Currently zero
145 WORD wType; // 1 for icons
146 WORD wCount; // Number of components
147//Fout in docs, geen padding
148// WORD padding; // filler for DWORD alignment
149} IconHeader;
150
151typedef struct tagWINBITMAPINFOHEADER
152{
153 DWORD biSize;
154 LONG biWidth;
155 LONG biHeight;
156 WORD biPlanes;
157 WORD biBitCount;
158 DWORD biCompression;
159 DWORD biSizeImage;
160 LONG biXPelsPerMeter;
161 LONG biYPelsPerMeter;
162 DWORD biClrUsed;
163 DWORD biClrImportant;
164} WINBITMAPINFOHEADER;
165
166typedef struct
167{
168 BYTE blue;
169 BYTE green;
170 BYTE red;
171 BYTE res;
172} RGBQUAD;
173
174//The next portion is repeated for each component resource:
175typedef struct
176{
177 BYTE bWidth;
178 BYTE bHeight;
179 BYTE bColorCount;
180 BYTE bReserved;
181 WORD wPlanes;
182 WORD wBitCount;
183 DWORD lBytesInRes;
184 WORD wNameOrdinal; // Points to component
185//Fout in docs, geen padding
186// WORD padding; // filler for DWORD alignment
187} ResourceDirectory;
188
189#pragma pack()
190
191class OS2Icon
192{
193public:
194 // Constructors and destructors
195 OS2Icon(int id, WINBITMAPINFOHEADER *bmpHdr, int size);
196 ~OS2Icon();
197
198 int QueryIconSize();
199 void SetIconHdrOffset(int offset);
200 BITMAPFILEHEADER2 *GetIconHeader();
201
202 static OS2Icon *GetIcon(int id);
203 static void DestroyAll();
204
205protected:
206
207private:
208 int id, iconsize, prevoffset;
209 BITMAPFILEHEADER2 *iconhdr;
210 BITMAPFILEHEADER2 *iconhdr2;
211
212 //@KSO: This may need to be changed later. Statics work fine for one single file,
213 // but not necessarily for concurrent files. But for the time beeing, it is
214 // not a problem.
215 // Linked list management
216 OS2Icon *next; // Next Icon
217 static OS2Icon *icons; // List of Icons
218};
219#endif
220
Note: See TracBrowser for help on using the repository browser.