| Ozkan Sezer | 9e09a80 | 2011-11-17 07:42:03 +0000 | [diff] [blame] | 1 | /* |
| 2 | * gdipluspixelformats.h |
| 3 | * |
| 4 | * GDI+ pixel formats |
| 5 | * |
| 6 | * This file is part of the w32api package. |
| 7 | * |
| 8 | * Contributors: |
| 9 | * Created by Markus Koenig <markus@stber-koenig.de> |
| 10 | * |
| 11 | * THIS SOFTWARE IS NOT COPYRIGHTED |
| 12 | * |
| 13 | * This source code is offered for use in the public domain. You may |
| 14 | * use, modify or distribute it freely. |
| 15 | * |
| 16 | * This code is distributed in the hope that it will be useful but |
| 17 | * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY |
| 18 | * DISCLAIMED. This includes but is not limited to warranties of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | #ifndef __GDIPLUS_PIXELFORMATS_H |
| 24 | #define __GDIPLUS_PIXELFORMATS_H |
| 25 | #if __GNUC__ >=3 |
| 26 | #pragma GCC system_header |
| 27 | #endif |
| 28 | |
| 29 | typedef DWORD ARGB; |
| 30 | typedef INT PixelFormat; |
| 31 | |
| 32 | #define PixelFormatIndexed ((INT) 0x00010000) |
| 33 | #define PixelFormatGDI ((INT) 0x00020000) |
| 34 | #define PixelFormatAlpha ((INT) 0x00040000) |
| 35 | #define PixelFormatPAlpha ((INT) 0x00080000) |
| 36 | #define PixelFormatExtended ((INT) 0x00100000) |
| 37 | #define PixelFormatCanonical ((INT) 0x00200000) |
| 38 | #define PixelFormatUndefined ((INT) 0) |
| 39 | #define PixelFormatDontCare ((INT) 0) |
| 40 | #define PixelFormat1bppIndexed ((INT) \ |
| 41 | (1 | (1<<8) | PixelFormatIndexed | PixelFormatGDI)) |
| 42 | #define PixelFormat4bppIndexed ((INT) \ |
| 43 | (2 | (4<<8) | PixelFormatIndexed | PixelFormatGDI)) |
| 44 | #define PixelFormat8bppIndexed ((INT) \ |
| 45 | (3 | (8<<8) | PixelFormatIndexed | PixelFormatGDI)) |
| 46 | #define PixelFormat16bppGrayScale ((INT) \ |
| 47 | (4 | (16<<8) | PixelFormatExtended)) |
| 48 | #define PixelFormat16bppRGB555 ((INT) \ |
| 49 | (5 | (16<<8) | PixelFormatGDI)) |
| 50 | #define PixelFormat16bppRGB565 ((INT) \ |
| 51 | (6 | (16<<8) | PixelFormatGDI)) |
| 52 | #define PixelFormat16bppARGB1555 ((INT) \ |
| 53 | (7 | (16<<8) | PixelFormatAlpha | PixelFormatGDI)) |
| 54 | #define PixelFormat24bppRGB ((INT) \ |
| 55 | (8 | (24<<8) | PixelFormatGDI)) |
| 56 | #define PixelFormat32bppRGB ((INT) \ |
| 57 | (9 | (32<<8) | PixelFormatGDI)) |
| 58 | #define PixelFormat32bppARGB ((INT) \ |
| 59 | (10 | (32<<8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)) |
| 60 | #define PixelFormat32bppPARGB ((INT) \ |
| 61 | (11 | (32<<8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)) |
| 62 | #define PixelFormat48bppRGB ((INT) \ |
| 63 | (12 | (48<<8) | PixelFormatExtended)) |
| 64 | #define PixelFormat64bppARGB ((INT) \ |
| 65 | (13 | (64<<8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)) |
| 66 | #define PixelFormat64bppPARGB ((INT) \ |
| 67 | (14 | (64<<8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)) |
| 68 | #define PixelFormatMax ((INT) 15) |
| 69 | |
| 70 | typedef enum PaletteFlags { |
| 71 | PaletteFlagsHasAlpha = 1, |
| 72 | PaletteFlagsGrayScale = 2, |
| 73 | PaletteFlagsHalftone = 4 |
| 74 | } PaletteFlags; |
| 75 | |
| 76 | typedef enum PaletteType { |
| 77 | PaletteTypeCustom = 0, |
| 78 | PaletteTypeOptimal = 1, |
| 79 | PaletteTypeFixedBW = 2, |
| 80 | PaletteTypeFixedHalftone8 = 3, |
| 81 | PaletteTypeFixedHalftone27 = 4, |
| 82 | PaletteTypeFixedHalftone64 = 5, |
| 83 | PaletteTypeFixedHalftone125 = 6, |
| 84 | PaletteTypeFixedHalftone216 = 7, |
| 85 | PaletteTypeFixedHalftone252 = 8, |
| 86 | PaletteTypeFixedHalftone256 = 9 |
| 87 | } PaletteType; |
| 88 | |
| 89 | typedef struct ColorPalette { |
| 90 | UINT Flags; |
| 91 | UINT Count; |
| 92 | ARGB Entries[1]; |
| 93 | } ColorPalette; |
| 94 | |
| 95 | static __inline__ UINT GetPixelFormatSize(PixelFormat pixfmt) |
| 96 | { |
| 97 | return (((UINT) pixfmt) & 0xff00U) >> 8; |
| 98 | } |
| 99 | |
| 100 | static __inline__ BOOL IsAlphaPixelFormat(PixelFormat pixfmt) |
| 101 | { |
| 102 | return (pixfmt & PixelFormatAlpha) != 0; |
| 103 | } |
| 104 | |
| 105 | static __inline__ BOOL IsCanonicalPixelFormat(PixelFormat pixfmt) |
| 106 | { |
| 107 | return (pixfmt & PixelFormatCanonical) != 0; |
| 108 | } |
| 109 | |
| 110 | static __inline__ BOOL IsExtendedPixelFormat(PixelFormat pixfmt) |
| 111 | { |
| 112 | return (pixfmt & PixelFormatExtended) != 0; |
| 113 | } |
| 114 | |
| 115 | static __inline__ BOOL IsIndexedPixelFormat(PixelFormat pixfmt) |
| 116 | { |
| 117 | return (pixfmt & PixelFormatIndexed) != 0; |
| 118 | } |
| 119 | |
| 120 | #endif /* __GDIPLUS_PIXELFORMATS_H */ |