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