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

Last change on this file since 91 was 46, checked in by sandervl, 26 years ago

* empty log message *

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