1c2c66affSColin Finck /*
2c2c66affSColin Finck * Copyright (C) 2007 Google (Evan Stade)
3c2c66affSColin Finck *
4c2c66affSColin Finck * This library is free software; you can redistribute it and/or
5c2c66affSColin Finck * modify it under the terms of the GNU Lesser General Public
6c2c66affSColin Finck * License as published by the Free Software Foundation; either
7c2c66affSColin Finck * version 2.1 of the License, or (at your option) any later version.
8c2c66affSColin Finck *
9c2c66affSColin Finck * This library is distributed in the hope that it will be useful,
10c2c66affSColin Finck * but WITHOUT ANY WARRANTY; without even the implied warranty of
11c2c66affSColin Finck * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12c2c66affSColin Finck * Lesser General Public License for more details.
13c2c66affSColin Finck *
14c2c66affSColin Finck * You should have received a copy of the GNU Lesser General Public
15c2c66affSColin Finck * License along with this library; if not, write to the Free Software
16c2c66affSColin Finck * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17c2c66affSColin Finck */
18c2c66affSColin Finck
19c2c66affSColin Finck #ifndef _GDIPLUSPIXELFORMATS_H
20c2c66affSColin Finck #define _GDIPLUSPIXELFORMATS_H
21c2c66affSColin Finck
22c2c66affSColin Finck typedef DWORD ARGB;
23c2c66affSColin Finck typedef INT PixelFormat;
24c2c66affSColin Finck
25c2c66affSColin Finck #define PixelFormatIndexed 0x00010000
26c2c66affSColin Finck #define PixelFormatGDI 0x00020000
27c2c66affSColin Finck #define PixelFormatAlpha 0x00040000
28c2c66affSColin Finck #define PixelFormatPAlpha 0x00080000
29c2c66affSColin Finck #define PixelFormatExtended 0x00100000
30c2c66affSColin Finck #define PixelFormatCanonical 0x00200000
31c2c66affSColin Finck
32c2c66affSColin Finck #define PixelFormatUndefined 0
33c2c66affSColin Finck #define PixelFormatDontCare 0
34c2c66affSColin Finck
35c2c66affSColin Finck #define PixelFormat1bppIndexed (1 | (1 << 8) | PixelFormatIndexed | PixelFormatGDI)
36c2c66affSColin Finck #define PixelFormat4bppIndexed (2 | (4 << 8) | PixelFormatIndexed | PixelFormatGDI)
37c2c66affSColin Finck #define PixelFormat8bppIndexed (3 | (8 << 8) | PixelFormatIndexed | PixelFormatGDI)
38c2c66affSColin Finck #define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended)
39c2c66affSColin Finck #define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI)
40c2c66affSColin Finck #define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI)
41c2c66affSColin Finck #define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI)
42c2c66affSColin Finck #define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI)
43c2c66affSColin Finck #define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI)
44c2c66affSColin Finck #define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)
45c2c66affSColin Finck #define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)
46c2c66affSColin Finck #define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended)
47c2c66affSColin Finck #define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)
48c2c66affSColin Finck #define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)
49c2c66affSColin Finck #define PixelFormat32bppCMYK (15 | (32 << 8))
50c2c66affSColin Finck #define PixelFormatMax 16
51c2c66affSColin Finck
52*e7814f19SKatayama Hirofumi MZ static inline BOOL
IsIndexedPixelFormat(PixelFormat format)53*e7814f19SKatayama Hirofumi MZ IsIndexedPixelFormat(PixelFormat format)
54c2c66affSColin Finck {
55c2c66affSColin Finck return (format & PixelFormatIndexed) != 0;
56c2c66affSColin Finck }
57c2c66affSColin Finck
58*e7814f19SKatayama Hirofumi MZ static inline BOOL
IsAlphaPixelFormat(PixelFormat format)59*e7814f19SKatayama Hirofumi MZ IsAlphaPixelFormat(PixelFormat format)
60c2c66affSColin Finck {
61c2c66affSColin Finck return (format & PixelFormatAlpha) != 0;
62c2c66affSColin Finck }
63c2c66affSColin Finck
64*e7814f19SKatayama Hirofumi MZ static inline BOOL
IsCanonicalPixelFormat(PixelFormat format)65*e7814f19SKatayama Hirofumi MZ IsCanonicalPixelFormat(PixelFormat format)
66c2c66affSColin Finck {
67c2c66affSColin Finck return (format & PixelFormatCanonical) != 0;
68c2c66affSColin Finck }
69c2c66affSColin Finck
70*e7814f19SKatayama Hirofumi MZ static inline BOOL
IsExtendedPixelFormat(PixelFormat format)71*e7814f19SKatayama Hirofumi MZ IsExtendedPixelFormat(PixelFormat format)
72c2c66affSColin Finck {
73c2c66affSColin Finck return (format & PixelFormatExtended) != 0;
74c2c66affSColin Finck }
75c2c66affSColin Finck
76*e7814f19SKatayama Hirofumi MZ static inline UINT
GetPixelFormatSize(PixelFormat format)77*e7814f19SKatayama Hirofumi MZ GetPixelFormatSize(PixelFormat format)
78c2c66affSColin Finck {
79c2c66affSColin Finck return (format >> 8) & 0xff;
80c2c66affSColin Finck }
81c2c66affSColin Finck
82c2c66affSColin Finck enum PaletteFlags
83c2c66affSColin Finck {
84c2c66affSColin Finck PaletteFlagsHasAlpha = 1,
85c2c66affSColin Finck PaletteFlagsGrayScale = 2,
86c2c66affSColin Finck PaletteFlagsHalftone = 4
87c2c66affSColin Finck };
88c2c66affSColin Finck
89c2c66affSColin Finck #ifdef __cplusplus
90c2c66affSColin Finck
91c2c66affSColin Finck struct ColorPalette
92c2c66affSColin Finck {
93c2c66affSColin Finck public:
94c2c66affSColin Finck UINT Flags;
95c2c66affSColin Finck UINT Count;
96c2c66affSColin Finck ARGB Entries[1];
97c2c66affSColin Finck };
98c2c66affSColin Finck
99c2c66affSColin Finck #else /* end of c++ typedefs */
100c2c66affSColin Finck
101c2c66affSColin Finck typedef struct ColorPalette
102c2c66affSColin Finck {
103c2c66affSColin Finck UINT Flags;
104c2c66affSColin Finck UINT Count;
105c2c66affSColin Finck ARGB Entries[1];
106c2c66affSColin Finck } ColorPalette;
107c2c66affSColin Finck
108c2c66affSColin Finck #endif /* end of c typedefs */
109c2c66affSColin Finck
110c2c66affSColin Finck typedef enum DitherType
111c2c66affSColin Finck {
112c2c66affSColin Finck DitherTypeNone,
113c2c66affSColin Finck DitherTypeSolid,
114c2c66affSColin Finck DitherTypeOrdered4x4,
115c2c66affSColin Finck DitherTypeOrdered8x8,
116c2c66affSColin Finck DitherTypeOrdered16x16,
117c2c66affSColin Finck DitherTypeSpiral4x4,
118c2c66affSColin Finck DitherTypeSpiral8x8,
119c2c66affSColin Finck DitherTypeDualSpiral4x4,
120c2c66affSColin Finck DitherTypeDualSpiral8x8,
121c2c66affSColin Finck DitherTypeErrorDiffusion,
122c2c66affSColin Finck DitherTypeMax
123c2c66affSColin Finck } DitherType;
124c2c66affSColin Finck
125c2c66affSColin Finck typedef enum PaletteType
126c2c66affSColin Finck {
127c2c66affSColin Finck PaletteTypeCustom,
128c2c66affSColin Finck PaletteTypeOptimal,
129c2c66affSColin Finck PaletteTypeFixedBW,
130c2c66affSColin Finck PaletteTypeFixedHalftone8,
131c2c66affSColin Finck PaletteTypeFixedHalftone27,
132c2c66affSColin Finck PaletteTypeFixedHalftone64,
133c2c66affSColin Finck PaletteTypeFixedHalftone125,
134c2c66affSColin Finck PaletteTypeFixedHalftone216,
135c2c66affSColin Finck PaletteTypeFixedHalftone252,
136c2c66affSColin Finck PaletteTypeFixedHalftone256
137c2c66affSColin Finck } PaletteType;
138c2c66affSColin Finck
139c2c66affSColin Finck #endif
140