Naveen Neel / shedskin
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers gdipluspixelformats.h Source File

gdipluspixelformats.h

00001 /*
00002  * gdipluspixelformats.h
00003  *
00004  * GDI+ pixel formats
00005  *
00006  * This file is part of the w32api package.
00007  *
00008  * Contributors:
00009  *   Created by Markus Koenig <markus@stber-koenig.de>
00010  *
00011  * THIS SOFTWARE IS NOT COPYRIGHTED
00012  *
00013  * This source code is offered for use in the public domain. You may
00014  * use, modify or distribute it freely.
00015  *
00016  * This code is distributed in the hope that it will be useful but
00017  * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  * DISCLAIMED. This includes but is not limited to warranties of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  */
00022 
00023 #ifndef __GDIPLUS_PIXELFORMATS_H
00024 #define __GDIPLUS_PIXELFORMATS_H
00025 #if __GNUC__ >=3
00026 #pragma GCC system_header
00027 #endif
00028 
00029 typedef DWORD ARGB;
00030 typedef INT PixelFormat;
00031 
00032 #define PixelFormatIndexed ((PixelFormat) 0x00010000)
00033 #define PixelFormatGDI ((PixelFormat) 0x00020000)
00034 #define PixelFormatAlpha ((PixelFormat) 0x00040000)
00035 #define PixelFormatPAlpha ((PixelFormat) 0x00080000)
00036 #define PixelFormatExtended ((PixelFormat) 0x00100000)
00037 #define PixelFormatCanonical ((PixelFormat) 0x00200000)
00038 #define PixelFormatUndefined ((PixelFormat) 0)
00039 #define PixelFormatDontCare ((PixelFormat) 0)
00040 #define PixelFormat1bppIndexed ((PixelFormat) \
00041     (1 | (1<<8) | PixelFormatIndexed | PixelFormatGDI))
00042 #define PixelFormat4bppIndexed ((PixelFormat) \
00043     (2 | (4<<8) | PixelFormatIndexed | PixelFormatGDI))
00044 #define PixelFormat8bppIndexed ((PixelFormat) \
00045     (3 | (8<<8) | PixelFormatIndexed | PixelFormatGDI))
00046 #define PixelFormat16bppGrayScale ((PixelFormat) \
00047     (4 | (16<<8) | PixelFormatExtended))
00048 #define PixelFormat16bppRGB555 ((PixelFormat) \
00049     (5 | (16<<8) | PixelFormatGDI))
00050 #define PixelFormat16bppRGB565 ((PixelFormat) \
00051     (6 | (16<<8) | PixelFormatGDI))
00052 #define PixelFormat16bppARGB1555 ((PixelFormat) \
00053     (7 | (16<<8) | PixelFormatAlpha | PixelFormatGDI))
00054 #define PixelFormat24bppRGB ((PixelFormat) \
00055     (8 | (24<<8) | PixelFormatGDI))
00056 #define PixelFormat32bppRGB ((PixelFormat) \
00057     (9 | (32<<8) | PixelFormatGDI))
00058 #define PixelFormat32bppARGB ((PixelFormat) \
00059     (10 | (32<<8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical))
00060 #define PixelFormat32bppPARGB ((PixelFormat) \
00061     (11 | (32<<8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI))
00062 #define PixelFormat48bppRGB ((PixelFormat) \
00063     (12 | (48<<8) | PixelFormatExtended))
00064 #define PixelFormat64bppARGB ((PixelFormat) \
00065     (13 | (64<<8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended))
00066 #define PixelFormat64bppPARGB ((PixelFormat) \
00067     (14 | (64<<8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended))
00068 #define PixelFormatMax ((PixelFormat) 15)
00069 
00070 typedef enum PaletteFlags {
00071     PaletteFlagsHasAlpha = 1,
00072     PaletteFlagsGrayScale = 2,
00073     PaletteFlagsHalftone = 4
00074 } PaletteFlags;
00075 
00076 typedef enum PaletteType {
00077     PaletteTypeCustom = 0,
00078     PaletteTypeOptimal = 1,
00079     PaletteTypeFixedBW = 2,
00080     PaletteTypeFixedHalftone8 = 3,
00081     PaletteTypeFixedHalftone27 = 4,
00082     PaletteTypeFixedHalftone64 = 5,
00083     PaletteTypeFixedHalftone125 = 6,
00084     PaletteTypeFixedHalftone216 = 7,
00085     PaletteTypeFixedHalftone252 = 8,
00086     PaletteTypeFixedHalftone256 = 9 
00087 } PaletteType;
00088 
00089 typedef struct ColorPalette {
00090     UINT Flags;
00091     UINT Count;
00092     ARGB Entries[1];
00093 } ColorPalette;
00094 
00095 static __inline__ UINT GetPixelFormatSize(PixelFormat pixfmt)
00096 {
00097     return (((UINT) pixfmt) & 0xff00U) >> 8;
00098 }
00099 
00100 static __inline__ BOOL IsAlphaPixelFormat(PixelFormat pixfmt)
00101 {
00102     return (pixfmt & PixelFormatAlpha) != 0;
00103 }
00104 
00105 static __inline__ BOOL IsCanonicalPixelFormat(PixelFormat pixfmt)
00106 {
00107     return (pixfmt & PixelFormatCanonical) != 0;
00108 }
00109 
00110 static __inline__ BOOL IsExtendedPixelFormat(PixelFormat pixfmt)
00111 {
00112     return (pixfmt & PixelFormatExtended) != 0;
00113 }
00114 
00115 static __inline__ BOOL IsIndexedPixelFormat(PixelFormat pixfmt)
00116 {
00117     return (pixfmt & PixelFormatIndexed) != 0;
00118 }
00119 
00120 #endif /* __GDIPLUS_PIXELFORMATS_H */