| [9849] | 1 | /* $Id: winicon.h,v 1.3 2003-02-24 17:01:47 sandervl Exp $ */
 | 
|---|
| [575] | 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 | 
 | 
|---|
| [581] | 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 | 
 | 
|---|
| [575] | 144 | typedef struct {
 | 
|---|
 | 145 |   WORD   wReserved;          // Currently zero
 | 
|---|
 | 146 |   WORD   wType;              // 1 for icons
 | 
|---|
 | 147 |   WORD   wCount;             // Number of components
 | 
|---|
 | 148 | } IconHeader;
 | 
|---|
 | 149 | 
 | 
|---|
 | 150 | typedef struct tagWINBITMAPINFOHEADER{
 | 
|---|
 | 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 | 
 | 
|---|
 | 164 | typedef 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:
 | 
|---|
 | 173 | typedef struct {
 | 
|---|
 | 174 |   BYTE   bWidth;
 | 
|---|
 | 175 |   BYTE   bHeight;
 | 
|---|
 | 176 |   BYTE   bColorCount;
 | 
|---|
 | 177 |   BYTE   bReserved;
 | 
|---|
 | 178 |   WORD   wPlanes;
 | 
|---|
 | 179 |   WORD   wBitCount;
 | 
|---|
 | 180 |   DWORD  lBytesInRes;
 | 
|---|
 | 181 |   WORD   wNameOrdinal;       // Points to component
 | 
|---|
 | 182 | } ResourceDirectory;
 | 
|---|
 | 183 | 
 | 
|---|
| [9849] | 184 | typedef struct
 | 
|---|
 | 185 | {
 | 
|---|
 | 186 |         BYTE bWidth;
 | 
|---|
 | 187 |         BYTE bHeight;
 | 
|---|
 | 188 |         BYTE bColorCount;
 | 
|---|
 | 189 |         BYTE bReserved;
 | 
|---|
 | 190 |         WORD wPlanes;
 | 
|---|
 | 191 |         WORD wBitCount;
 | 
|---|
 | 192 |         DWORD dwBytesInRes;
 | 
|---|
 | 193 |         DWORD dwImageOffset;
 | 
|---|
 | 194 | } ICONDIRENTRY;
 | 
|---|
 | 195 | 
 | 
|---|
 | 196 | typedef struct
 | 
|---|
 | 197 | {
 | 
|---|
 | 198 |         WORD idReserved;
 | 
|---|
 | 199 |         WORD idType;
 | 
|---|
 | 200 |         WORD idCount;
 | 
|---|
 | 201 | } ICONDIR;
 | 
|---|
 | 202 | 
 | 
|---|
| [575] | 203 | #pragma pack()
 | 
|---|
 | 204 | 
 | 
|---|
 | 205 | #endif
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 | #endif
 | 
|---|