1 // some decls for Direct2D
2 module directx.wincodec;
3 
4 import directx.com;
5 
6 alias WICPixelFormatGUID = GUID;
7 alias WICInProcPointer = BYTE*;
8 alias WICColor = UINT32;
9 
10 alias WICBitmapPaletteType = int;
11 enum : WICBitmapPaletteType
12 {
13         WICBitmapPaletteTypeCustom	= 0,
14         WICBitmapPaletteTypeMedianCut	= 0x1,
15         WICBitmapPaletteTypeFixedBW	= 0x2,
16         WICBitmapPaletteTypeFixedHalftone8	= 0x3,
17         WICBitmapPaletteTypeFixedHalftone27	= 0x4,
18         WICBitmapPaletteTypeFixedHalftone64	= 0x5,
19         WICBitmapPaletteTypeFixedHalftone125	= 0x6,
20         WICBitmapPaletteTypeFixedHalftone216	= 0x7,
21         WICBitmapPaletteTypeFixedWebPalette	= WICBitmapPaletteTypeFixedHalftone216,
22         WICBitmapPaletteTypeFixedHalftone252	= 0x8,
23         WICBitmapPaletteTypeFixedHalftone256	= 0x9,
24         WICBitmapPaletteTypeFixedGray4	= 0xa,
25         WICBitmapPaletteTypeFixedGray16	= 0xb,
26         WICBitmapPaletteTypeFixedGray256	= 0xc,
27         WICBITMAPPALETTETYPE_FORCE_DWORD	= 0x7fffffff
28 }
29 
30 struct WICRect
31 {
32 	INT X;
33 	INT Y;
34 	INT Width;
35 	INT Height;
36 }
37 
38 mixin( uuid!(IWICBitmapSource, "00000120-a8f2-4877-ba0a-fd2b6645fb94") );
39 interface IWICBitmapSource : IUnknown
40 {
41 	extern(Windows):
42     HRESULT GetSize( 
43             /* [out] */ UINT* puiWidth,
44             /* [out] */ UINT* puiHeight);
45         
46 	HRESULT GetPixelFormat( 
47             /* [out] */ WICPixelFormatGUID pPixelFormat);
48         
49     HRESULT GetResolution( 
50             /* [out] */ double* pDpiX,
51             /* [out] */ double* pDpiY);
52         
53     HRESULT CopyPalette( 
54             /* [in] */ IWICPalette pIPalette);
55         
56     HRESULT CopyPixels( 
57             /* [unique][in] */ const (WICRect)* prc,
58             /* [in] */ UINT cbStride,
59             /* [in] */ UINT cbBufferSize,
60             /* [size_is][out] */  BYTE* pbBuffer);        
61 }
62     
63 mixin( uuid!(IWICBitmap, "00000121-a8f2-4877-ba0a-fd2b6645fb94") );
64 interface IWICBitmap : IWICBitmapSource
65 {
66 	extern(Windows):
67 	HRESULT Lock( 
68             /* [unique][in] */ const (WICRect)* prcLock,
69             /* [in] */ DWORD flags,
70             /* [out] */ IWICBitmapLock* ppILock);
71         
72     HRESULT SetPalette( 
73             /* [in] */ IWICPalette pIPalette);
74         
75     HRESULT SetResolution( 
76             /* [in] */ double dpiX,
77             /* [in] */ double dpiY);
78         
79 }
80 
81 mixin( uuid!(IWICBitmapLock, "00000123-a8f2-4877-ba0a-fd2b6645fb94") );
82 interface IWICBitmapLock : IUnknown
83 {
84 	extern(Windows):
85 	HRESULT GetSize( 
86             /* [out] */ UINT* puiWidth,
87             /* [out] */ UINT* puiHeight);
88         
89 	HRESULT GetStride( 
90             /* [out] */ UINT* pcbStride);
91         
92     HRESULT GetDataPointer( 
93             /* [out] */ UINT* pcbBufferSize,
94             /* [size_is][size_is][out] */ WICInProcPointer ppbData);
95         
96     HRESULT GetPixelFormat( 
97             /* [out] */ WICPixelFormatGUID pPixelFormat);
98 
99 }
100 
101 mixin( uuid!(IWICPalette, "00000040-a8f2-4877-ba0a-fd2b6645fb94") );
102 interface IWICPalette : IUnknown
103 {
104     extern(Windows):
105     HRESULT InitializePredefined( 
106             /* [in] */ WICBitmapPaletteType ePaletteType,
107             /* [in] */ BOOL fAddTransparentColor);
108         
109     HRESULT InitializeCustom( 
110             /* [size_is][in] */ WICColor *pColors,
111             /* [in] */ UINT cCount);
112         
113     HRESULT InitializeFromBitmap( 
114             /* [in] */ IWICBitmapSource pISurface,
115             /* [in] */ UINT cCount,
116             /* [in] */ BOOL fAddTransparentColor);
117         
118     HRESULT InitializeFromPalette( 
119             /* [in] */ IWICPalette pIPalette);
120         
121     HRESULT GetType( 
122             /* [out] */ WICBitmapPaletteType* pePaletteType);
123         
124     HRESULT GetColorCount( 
125             /* [out] */ UINT* pcCount);
126         
127     HRESULT GetColors( 
128             /* [in] */ UINT cCount,
129             /* [size_is][out] */ WICColor *pColors,
130             /* [out] */ UINT* pcActualColors);
131         
132     HRESULT IsBlackWhite( 
133             /* [out] */ BOOL* pfIsBlackWhite);
134         
135     HRESULT IsGrayscale( 
136             /* [out] */ BOOL* pfIsGrayscale);
137         
138     HRESULT HasAlpha( 
139             /* [out] */ BOOL* pfHasAlpha);
140 
141 }