| 1 | /* $Id: icon.h,v 1.1 1999-09-06 02:20:05 bird Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /* $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/src/win32k/pe2lx/Attic/icon.h,v 1.1 1999-09-06 02:20:05 bird 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 |
|
|---|
| 22 | /* Image Color Matching color definitions */
|
|---|
| 23 |
|
|---|
| 24 | typedef LONG LCSCSTYPE;
|
|---|
| 25 | #define LCS_CALIBRATED_RGB 0x00000000L
|
|---|
| 26 | #define LCS_DEVICE_RGB 0x00000001L
|
|---|
| 27 | #define LCS_DEVICE_CMYK 0x00000002L
|
|---|
| 28 |
|
|---|
| 29 | typedef LONG LCSGAMUTMATCH;
|
|---|
| 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 |
|
|---|
| 44 | #define CMYK(c,m,y,k) ((COLORREF)((((BYTE)(k)|((WORD)((BYTE)(y))<<8))|(((DWORD)(BYTE)(m))<<16))|(((DWORD)(BYTE)(c))<<24)))
|
|---|
| 45 |
|
|---|
| 46 | typedef long FXPT16DOT16, FAR *LPFXPT16DOT16;
|
|---|
| 47 | typedef long FXPT2DOT30, FAR *LPFXPT2DOT30;
|
|---|
| 48 |
|
|---|
| 49 | /* ICM Color Definitions */
|
|---|
| 50 | // The following two structures are used for defining RGB's in terms of
|
|---|
| 51 | // CIEXYZ. The values are fixed point 16.16.
|
|---|
| 52 |
|
|---|
| 53 | typedef struct tagCIEXYZ
|
|---|
| 54 | {
|
|---|
| 55 | FXPT2DOT30 ciexyzX;
|
|---|
| 56 | FXPT2DOT30 ciexyzY;
|
|---|
| 57 | FXPT2DOT30 ciexyzZ;
|
|---|
| 58 | } CIEXYZ;
|
|---|
| 59 | typedef CIEXYZ FAR *LPCIEXYZ;
|
|---|
| 60 |
|
|---|
| 61 | typedef struct tagICEXYZTRIPLE
|
|---|
| 62 | {
|
|---|
| 63 | CIEXYZ ciexyzRed;
|
|---|
| 64 | CIEXYZ ciexyzGreen;
|
|---|
| 65 | CIEXYZ ciexyzBlue;
|
|---|
| 66 | } CIEXYZTRIPLE;
|
|---|
| 67 | typedef CIEXYZTRIPLE FAR *LPCIEXYZTRIPLE;
|
|---|
| 68 |
|
|---|
| 69 | #ifndef MAX_PATH
|
|---|
| 70 | #define MAX_PATH CCHMAXPATH
|
|---|
| 71 | #endif
|
|---|
| 72 | // The next structures the logical color space. Unlike pens and brushes,
|
|---|
| 73 | // but like palettes, there is only one way to create a LogColorSpace.
|
|---|
| 74 | // A pointer to it must be passed, its elements can't be pushed as
|
|---|
| 75 | // arguments.
|
|---|
| 76 |
|
|---|
| 77 | typedef struct tagLOGCOLORSPACEA
|
|---|
| 78 | {
|
|---|
| 79 | DWORD lcsSignature;
|
|---|
| 80 | DWORD lcsVersion;
|
|---|
| 81 | DWORD lcsSize;
|
|---|
| 82 | LCSCSTYPE lcsCSType;
|
|---|
| 83 | LCSGAMUTMATCH lcsIntent;
|
|---|
| 84 | CIEXYZTRIPLE lcsEndpoints;
|
|---|
| 85 | DWORD lcsGammaRed;
|
|---|
| 86 | DWORD lcsGammaGreen;
|
|---|
| 87 | DWORD lcsGammaBlue;
|
|---|
| 88 | CHAR lcsFilename[MAX_PATH];
|
|---|
| 89 | } LOGCOLORSPACEA, *LPLOGCOLORSPACEA;
|
|---|
| 90 |
|
|---|
| 91 | typedef struct tagLOGCOLORSPACEW
|
|---|
| 92 | {
|
|---|
| 93 | DWORD lcsSignature;
|
|---|
| 94 | DWORD lcsVersion;
|
|---|
| 95 | DWORD lcsSize;
|
|---|
| 96 | LCSCSTYPE lcsCSType;
|
|---|
| 97 | LCSGAMUTMATCH lcsIntent;
|
|---|
| 98 | CIEXYZTRIPLE lcsEndpoints;
|
|---|
| 99 | DWORD lcsGammaRed;
|
|---|
| 100 | DWORD lcsGammaGreen;
|
|---|
| 101 | DWORD lcsGammaBlue;
|
|---|
| 102 | WCHAR lcsFilename[MAX_PATH];
|
|---|
| 103 | } LOGCOLORSPACEW, *LPLOGCOLORSPACEW;
|
|---|
| 104 |
|
|---|
| 105 | #ifdef UNICODE
|
|---|
| 106 | typedef LOGCOLORSPACEW LOGCOLORSPACE;
|
|---|
| 107 | typedef LPLOGCOLORSPACEW LPLOGCOLORSPACE;
|
|---|
| 108 | #else
|
|---|
| 109 | typedef LOGCOLORSPACEA LOGCOLORSPACE;
|
|---|
| 110 | typedef LPLOGCOLORSPACEA LPLOGCOLORSPACE;
|
|---|
| 111 | #endif // UNICODE
|
|---|
| 112 |
|
|---|
| 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 |
|
|---|
| 139 |
|
|---|
| 140 | /* constants for the biCompression field */
|
|---|
| 141 | #define BI_RGB 0L
|
|---|
| 142 | #define BI_RLE8 1L
|
|---|
| 143 | #define BI_RLE4 2L
|
|---|
| 144 | #define BI_BITFIELDS 3L
|
|---|
| 145 |
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 |
|
|---|
| 149 |
|
|---|
| 150 | /* Win v3.0 bitmap structs */
|
|---|
| 151 | typedef struct
|
|---|
| 152 | {
|
|---|
| 153 | WORD wReserved; // Currently zero
|
|---|
| 154 | WORD wType; // 1 for icons
|
|---|
| 155 | WORD wCount; // Number of components
|
|---|
| 156 | //Fout in docs, geen padding
|
|---|
| 157 | // WORD padding; // filler for DWORD alignment
|
|---|
| 158 | } IconHeader;
|
|---|
| 159 |
|
|---|
| 160 | typedef struct tagWINBITMAPINFOHEADER
|
|---|
| 161 | {
|
|---|
| 162 | DWORD biSize;
|
|---|
| 163 | LONG biWidth;
|
|---|
| 164 | LONG biHeight;
|
|---|
| 165 | WORD biPlanes;
|
|---|
| 166 | WORD biBitCount;
|
|---|
| 167 | DWORD biCompression;
|
|---|
| 168 | DWORD biSizeImage;
|
|---|
| 169 | LONG biXPelsPerMeter;
|
|---|
| 170 | LONG biYPelsPerMeter;
|
|---|
| 171 | DWORD biClrUsed;
|
|---|
| 172 | DWORD biClrImportant;
|
|---|
| 173 | } WINBITMAPINFOHEADER;
|
|---|
| 174 |
|
|---|
| 175 | typedef struct
|
|---|
| 176 | {
|
|---|
| 177 | BYTE blue;
|
|---|
| 178 | BYTE green;
|
|---|
| 179 | BYTE red;
|
|---|
| 180 | BYTE res;
|
|---|
| 181 | } RGBQUAD;
|
|---|
| 182 |
|
|---|
| 183 | //The next portion is repeated for each component resource:
|
|---|
| 184 | typedef struct
|
|---|
| 185 | {
|
|---|
| 186 | BYTE bWidth;
|
|---|
| 187 | BYTE bHeight;
|
|---|
| 188 | BYTE bColorCount;
|
|---|
| 189 | BYTE bReserved;
|
|---|
| 190 | WORD wPlanes;
|
|---|
| 191 | WORD wBitCount;
|
|---|
| 192 | DWORD lBytesInRes;
|
|---|
| 193 | WORD wNameOrdinal; // Points to component
|
|---|
| 194 | //Fout in docs, geen padding
|
|---|
| 195 | // WORD padding; // filler for DWORD alignment
|
|---|
| 196 | } ResourceDirectory;
|
|---|
| 197 |
|
|---|
| 198 | #pragma pack()
|
|---|
| 199 |
|
|---|
| 200 | class OS2Icon
|
|---|
| 201 | {
|
|---|
| 202 | public:
|
|---|
| 203 | // Constructors and destructors
|
|---|
| 204 | OS2Icon(int id, WINBITMAPINFOHEADER *bmpHdr, int size);
|
|---|
| 205 | ~OS2Icon();
|
|---|
| 206 |
|
|---|
| 207 | int QueryIconSize();
|
|---|
| 208 | void SetIconHdrOffset(int offset);
|
|---|
| 209 | BITMAPFILEHEADER *GetIconHeader();
|
|---|
| 210 |
|
|---|
| 211 | static OS2Icon *GetIcon(int id);
|
|---|
| 212 | static void DestroyAll();
|
|---|
| 213 |
|
|---|
| 214 | protected:
|
|---|
| 215 |
|
|---|
| 216 | private:
|
|---|
| 217 | int id, iconsize, prevoffset;
|
|---|
| 218 | BITMAPFILEHEADER *iconhdr;
|
|---|
| 219 | BITMAPFILEHEADER *iconhdr2;
|
|---|
| 220 |
|
|---|
| 221 | //@KSO: This may need to be changed later. Statics work fine for one single file,
|
|---|
| 222 | // but not necessarily for concurrent files. But for the time beeing, it is
|
|---|
| 223 | // not a problem.
|
|---|
| 224 | // Linked list management
|
|---|
| 225 | OS2Icon *next; // Next Icon
|
|---|
| 226 | static OS2Icon *icons; // List of Icons
|
|---|
| 227 | };
|
|---|
| 228 |
|
|---|
| 229 |
|
|---|
| 230 | #endif
|
|---|