1 | /* $Id: winicon.h,v 1.2 1999-08-19 14:18:24 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 icon conversion functions for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen
|
---|
7 | *
|
---|
8 | *
|
---|
9 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
10 | *
|
---|
11 | */
|
---|
12 | #ifndef __WINICON_H__
|
---|
13 | #define __WINICON_H__
|
---|
14 |
|
---|
15 | extern "C" PBYTE ConvertWin32Icon(PBYTE presbits, DWORD dwResSize, DWORD *OS2ResSize);
|
---|
16 | extern "C" void FreeIcon(void *os2icon);
|
---|
17 |
|
---|
18 |
|
---|
19 | #ifndef _OS2WIN_H
|
---|
20 |
|
---|
21 | #pragma pack(1)
|
---|
22 |
|
---|
23 | /* Win v4.0 bitmap structs */
|
---|
24 | /* Image Color Matching color definitions */
|
---|
25 |
|
---|
26 | typedef LONG LCSCSTYPE;
|
---|
27 |
|
---|
28 | #define LCS_CALIBRATED_RGB 0x00000000L
|
---|
29 | #define LCS_DEVICE_RGB 0x00000001L
|
---|
30 | #define LCS_DEVICE_CMYK 0x00000002L
|
---|
31 | typedef LONG LCSGAMUTMATCH;
|
---|
32 |
|
---|
33 | #define LCS_GM_BUSINESS 0x00000001L
|
---|
34 | #define LCS_GM_GRAPHICS 0x00000002L
|
---|
35 | #define LCS_GM_IMAGES 0x00000004L
|
---|
36 |
|
---|
37 | /* ICM Defines for results from CheckColorInGamut() */
|
---|
38 | #define CM_OUT_OF_GAMUT 255
|
---|
39 | #define CM_IN_GAMUT 0
|
---|
40 |
|
---|
41 | /* Macros to retrieve CMYK values from a COLORREF */
|
---|
42 | #define GetKValue(cmyk) ((BYTE)(cmyk))
|
---|
43 | #define GetYValue(cmyk) ((BYTE)((cmyk)>> 8))
|
---|
44 | #define GetMValue(cmyk) ((BYTE)((cmyk)>>16))
|
---|
45 | #define GetCValue(cmyk) ((BYTE)((cmyk)>>24))
|
---|
46 | #define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24)))
|
---|
47 |
|
---|
48 | typedef long FXPT16DOT16, FAR *LPFXPT16DOT16;
|
---|
49 | typedef long FXPT2DOT30, FAR *LPFXPT2DOT30;
|
---|
50 |
|
---|
51 | /* ICM Color Definitions */
|
---|
52 | // The following two structures are used for defining RGB's in terms of
|
---|
53 | // CIEXYZ. The values are fixed point 16.16.
|
---|
54 | typedef struct tagCIEXYZ
|
---|
55 | {
|
---|
56 | FXPT2DOT30 ciexyzX;
|
---|
57 | FXPT2DOT30 ciexyzY;
|
---|
58 | FXPT2DOT30 ciexyzZ;
|
---|
59 | } CIEXYZ;
|
---|
60 | typedef CIEXYZ FAR *LPCIEXYZ;
|
---|
61 |
|
---|
62 | typedef struct tagICEXYZTRIPLE
|
---|
63 | {
|
---|
64 | CIEXYZ ciexyzRed;
|
---|
65 | CIEXYZ ciexyzGreen;
|
---|
66 | CIEXYZ ciexyzBlue;
|
---|
67 | } CIEXYZTRIPLE;
|
---|
68 | typedef CIEXYZTRIPLE FAR *LPCIEXYZTRIPLE;
|
---|
69 |
|
---|
70 | #ifndef MAX_PATH
|
---|
71 | #define MAX_PATH CCHMAXPATH
|
---|
72 | #endif
|
---|
73 | // The next structures the logical color space. Unlike pens and brushes,
|
---|
74 | // but like palettes, there is only one way to create a LogColorSpace.
|
---|
75 | // A pointer to it must be passed, its elements can't be pushed as
|
---|
76 | // arguments.
|
---|
77 |
|
---|
78 | typedef struct tagLOGCOLORSPACEA
|
---|
79 | {
|
---|
80 | DWORD lcsSignature;
|
---|
81 | DWORD lcsVersion;
|
---|
82 | DWORD lcsSize;
|
---|
83 | LCSCSTYPE lcsCSType;
|
---|
84 | LCSGAMUTMATCH lcsIntent;
|
---|
85 | CIEXYZTRIPLE lcsEndpoints;
|
---|
86 | DWORD lcsGammaRed;
|
---|
87 | DWORD lcsGammaGreen;
|
---|
88 | DWORD lcsGammaBlue;
|
---|
89 | CHAR lcsFilename[MAX_PATH];
|
---|
90 | } LOGCOLORSPACEA, *LPLOGCOLORSPACEA;
|
---|
91 |
|
---|
92 | typedef struct tagLOGCOLORSPACEW
|
---|
93 | {
|
---|
94 | DWORD lcsSignature;
|
---|
95 | DWORD lcsVersion;
|
---|
96 | DWORD lcsSize;
|
---|
97 | LCSCSTYPE lcsCSType;
|
---|
98 | LCSGAMUTMATCH lcsIntent;
|
---|
99 | CIEXYZTRIPLE lcsEndpoints;
|
---|
100 | DWORD lcsGammaRed;
|
---|
101 | DWORD lcsGammaGreen;
|
---|
102 | DWORD lcsGammaBlue;
|
---|
103 | WCHAR lcsFilename[MAX_PATH];
|
---|
104 | } LOGCOLORSPACEW, *LPLOGCOLORSPACEW;
|
---|
105 |
|
---|
106 | #ifdef UNICODE
|
---|
107 | typedef LOGCOLORSPACEW LOGCOLORSPACE;
|
---|
108 | typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE;
|
---|
109 | #else
|
---|
110 | typedef LOGCOLORSPACEA LOGCOLORSPACE;
|
---|
111 | typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE;
|
---|
112 | #endif // UNICODE
|
---|
113 |
|
---|
114 | typedef struct
|
---|
115 | {
|
---|
116 | DWORD bV4Size;
|
---|
117 | LONG bV4Width;
|
---|
118 | LONG bV4Height;
|
---|
119 | WORD bV4Planes;
|
---|
120 | WORD bV4BitCount;
|
---|
121 | DWORD bV4V4Compression;
|
---|
122 | DWORD bV4SizeImage;
|
---|
123 | LONG bV4XPelsPerMeter;
|
---|
124 | LONG bV4YPelsPerMeter;
|
---|
125 | DWORD bV4ClrUsed;
|
---|
126 | DWORD bV4ClrImportant;
|
---|
127 | DWORD bV4RedMask;
|
---|
128 | DWORD bV4GreenMask;
|
---|
129 | DWORD bV4BlueMask;
|
---|
130 | DWORD bV4AlphaMask;
|
---|
131 | DWORD bV4CSType;
|
---|
132 | CIEXYZTRIPLE bV4Endpoints;
|
---|
133 | DWORD bV4GammaRed;
|
---|
134 | DWORD bV4GammaGreen;
|
---|
135 | DWORD bV4GammaBlue;
|
---|
136 | } BITMAPV4HEADER, /*FAR *LPBITMAPV4HEADER,*/ *PBITMAPV4HEADER;
|
---|
137 |
|
---|
138 | /* constants for the biCompression field */
|
---|
139 | #define BI_RGB 0L
|
---|
140 | #define BI_RLE8 1L
|
---|
141 | #define BI_RLE4 2L
|
---|
142 | #define BI_BITFIELDS 3L
|
---|
143 |
|
---|
144 | typedef struct {
|
---|
145 | WORD wReserved; // Currently zero
|
---|
146 | WORD wType; // 1 for icons
|
---|
147 | WORD wCount; // Number of components
|
---|
148 | //Fout in docs, geen padding
|
---|
149 | // WORD padding; // filler for DWORD alignment
|
---|
150 | } IconHeader;
|
---|
151 |
|
---|
152 | typedef struct tagWINBITMAPINFOHEADER{
|
---|
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 |
|
---|
166 | typedef 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:
|
---|
175 | typedef struct {
|
---|
176 | BYTE bWidth;
|
---|
177 | BYTE bHeight;
|
---|
178 | BYTE bColorCount;
|
---|
179 | BYTE bReserved;
|
---|
180 | WORD wPlanes;
|
---|
181 | WORD wBitCount;
|
---|
182 | DWORD lBytesInRes;
|
---|
183 | WORD wNameOrdinal; // Points to component
|
---|
184 | //Fout in docs, geen padding
|
---|
185 | // WORD padding; // filler for DWORD alignment
|
---|
186 | } ResourceDirectory;
|
---|
187 |
|
---|
188 | #pragma pack()
|
---|
189 |
|
---|
190 | #endif
|
---|
191 |
|
---|
192 | #endif
|
---|