2 * Copyright 2009 Vincent Povirk for CodeWeavers
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.
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.
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
19 #ifndef WINCODECS_PRIVATE_H
20 #define WINCODECS_PRIVATE_H
23 #include "wincodecsdk.h"
24 #include "wine/unicode.h"
26 DEFINE_GUID(CLSID_WineTgaDecoder
, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
28 DEFINE_GUID(CLSID_WICIcnsEncoder
, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c);
30 DEFINE_GUID(GUID_WineContainerFormatTga
, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22);
32 DEFINE_GUID(GUID_VendorWine
, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a);
34 DEFINE_GUID(IID_IMILBitmapSource
,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe);
35 #define INTERFACE IMILBitmapSource
36 DECLARE_INTERFACE_(IMILBitmapSource
,IUnknown
)
38 /*** IUnknown methods ***/
39 STDMETHOD_(HRESULT
,QueryInterface
)(THIS_ REFIID
,void **) PURE
;
40 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
41 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
42 /*** IMILBitmapSource methods ***/
43 STDMETHOD_(HRESULT
,GetSize
)(THIS_ UINT
*,UINT
*);
44 STDMETHOD_(HRESULT
,GetPixelFormat
)(THIS_
int *);
45 STDMETHOD_(HRESULT
,GetResolution
)(THIS_
double *,double *);
46 STDMETHOD_(HRESULT
,CopyPalette
)(THIS_ IWICPalette
*);
47 STDMETHOD_(HRESULT
,CopyPixels
)(THIS_
const WICRect
*,UINT
,UINT
,BYTE
*);
48 STDMETHOD_(HRESULT
,UnknownMethod1
)(THIS_
void **);
52 #define INTERFACE IMILUnknown1
53 DECLARE_INTERFACE_(IMILUnknown1
,IUnknown
)
55 /*** IUnknown methods ***/
56 STDMETHOD_(HRESULT
,QueryInterface
)(THIS_ REFIID
,void **) PURE
;
57 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
58 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
62 #define INTERFACE IMILUnknown2
63 DECLARE_INTERFACE_(IMILUnknown2
,IUnknown
)
65 /*** IUnknown methods ***/
66 STDMETHOD_(HRESULT
,QueryInterface
)(THIS_ REFIID
,void **) PURE
;
67 STDMETHOD_(ULONG
,AddRef
)(THIS
) PURE
;
68 STDMETHOD_(ULONG
,Release
)(THIS
) PURE
;
69 /*** unknown methods ***/
70 STDMETHOD_(HRESULT
,UnknownMethod1
)(THIS_
void *, void *) PURE
;
74 HRESULT
create_instance(CLSID
*clsid
, const IID
*iid
, void **ppv
) DECLSPEC_HIDDEN
;
76 typedef HRESULT(*class_constructor
)(REFIID
,void**);
77 extern HRESULT
FormatConverter_CreateInstance(REFIID riid
, void** ppv
) DECLSPEC_HIDDEN
;
78 extern HRESULT
ComponentFactory_CreateInstance(REFIID riid
, void** ppv
) DECLSPEC_HIDDEN
;
79 extern HRESULT
BmpDecoder_CreateInstance(REFIID riid
, void** ppv
) DECLSPEC_HIDDEN
;
80 extern HRESULT
PngDecoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
81 extern HRESULT
PngEncoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
82 extern HRESULT
BmpEncoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
83 extern HRESULT
DibDecoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
84 extern HRESULT
GifDecoder_CreateInstance(REFIID riid
, void** ppv
) DECLSPEC_HIDDEN
;
85 extern HRESULT
IcoDecoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
86 extern HRESULT
JpegDecoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
87 extern HRESULT
JpegEncoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
88 extern HRESULT
TiffDecoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
89 extern HRESULT
TiffEncoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
90 extern HRESULT
IcnsEncoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
91 extern HRESULT
TgaDecoder_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
93 extern HRESULT
BitmapImpl_Create(UINT uiWidth
, UINT uiHeight
,
94 UINT stride
, UINT datasize
, void *view
, UINT offset
,
95 REFWICPixelFormatGUID pixelFormat
, WICBitmapCreateCacheOption option
,
96 IWICBitmap
**ppIBitmap
) DECLSPEC_HIDDEN
;
97 extern HRESULT
BitmapScaler_Create(IWICBitmapScaler
**scaler
) DECLSPEC_HIDDEN
;
98 extern HRESULT
FlipRotator_Create(IWICBitmapFlipRotator
**fliprotator
) DECLSPEC_HIDDEN
;
99 extern HRESULT
PaletteImpl_Create(IWICPalette
**palette
) DECLSPEC_HIDDEN
;
100 extern HRESULT
StreamImpl_Create(IWICStream
**stream
) DECLSPEC_HIDDEN
;
101 extern HRESULT
ColorContext_Create(IWICColorContext
**context
) DECLSPEC_HIDDEN
;
102 extern HRESULT
ColorTransform_Create(IWICColorTransform
**transform
) DECLSPEC_HIDDEN
;
103 extern HRESULT
BitmapClipper_Create(IWICBitmapClipper
**clipper
) DECLSPEC_HIDDEN
;
105 extern HRESULT
copy_pixels(UINT bpp
, const BYTE
*srcbuffer
,
106 UINT srcwidth
, UINT srcheight
, INT srcstride
,
107 const WICRect
*rc
, UINT dststride
, UINT dstbuffersize
, BYTE
*dstbuffer
) DECLSPEC_HIDDEN
;
109 extern HRESULT
configure_write_source(IWICBitmapFrameEncode
*iface
,
110 IWICBitmapSource
*source
, const WICRect
*prc
,
111 const WICPixelFormatGUID
*format
,
112 INT width
, INT height
, double xres
, double yres
) DECLSPEC_HIDDEN
;
114 extern HRESULT
write_source(IWICBitmapFrameEncode
*iface
,
115 IWICBitmapSource
*source
, const WICRect
*prc
,
116 const WICPixelFormatGUID
*format
, UINT bpp
,
117 INT width
, INT height
) DECLSPEC_HIDDEN
;
119 extern void reverse_bgr8(UINT bytesperpixel
, LPBYTE bits
, UINT width
, UINT height
, INT stride
) DECLSPEC_HIDDEN
;
121 extern HRESULT
get_pixelformat_bpp(const GUID
*pixelformat
, UINT
*bpp
) DECLSPEC_HIDDEN
;
123 extern HRESULT
CreatePropertyBag2(const PROPBAG2
*options
, UINT count
,
124 IPropertyBag2
**property
) DECLSPEC_HIDDEN
;
126 extern HRESULT
CreateComponentInfo(REFCLSID clsid
, IWICComponentInfo
**ppIInfo
) DECLSPEC_HIDDEN
;
127 extern HRESULT
CreateComponentEnumerator(DWORD componentTypes
, DWORD options
, IEnumUnknown
**ppIEnumUnknown
) DECLSPEC_HIDDEN
;
129 typedef struct BmpDecoder BmpDecoder
;
131 extern HRESULT
IcoDibDecoder_CreateInstance(BmpDecoder
**ppDecoder
) DECLSPEC_HIDDEN
;
132 extern void BmpDecoder_GetWICDecoder(BmpDecoder
*This
, IWICBitmapDecoder
**ppDecoder
) DECLSPEC_HIDDEN
;
133 extern void BmpDecoder_FindIconMask(BmpDecoder
*This
, ULONG
*mask_offset
, int *topdown
) DECLSPEC_HIDDEN
;
135 typedef struct _MetadataItem
142 typedef struct _MetadataHandlerVtbl
146 HRESULT (*fnLoad
)(IStream
*stream
, const GUID
*preferred_vendor
,
147 DWORD persist_options
, MetadataItem
**items
, DWORD
*item_count
);
148 HRESULT (*fnSave
)(IStream
*stream
, DWORD persist_options
,
149 const MetadataItem
*items
, DWORD item_count
);
150 HRESULT (*fnGetSizeMax
)(const MetadataItem
*items
, DWORD item_count
,
151 ULARGE_INTEGER
*size
);
152 } MetadataHandlerVtbl
;
154 extern HRESULT
MetadataReader_Create(const MetadataHandlerVtbl
*vtable
, REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
156 extern HRESULT
UnknownMetadataReader_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
157 extern HRESULT
IfdMetadataReader_CreateInstance(REFIID iid
, void **ppv
) DECLSPEC_HIDDEN
;
158 extern HRESULT
PngChrmReader_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
159 extern HRESULT
PngGamaReader_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
160 extern HRESULT
PngTextReader_CreateInstance(REFIID iid
, void** ppv
) DECLSPEC_HIDDEN
;
161 extern HRESULT
LSDReader_CreateInstance(REFIID iid
, void **ppv
) DECLSPEC_HIDDEN
;
162 extern HRESULT
IMDReader_CreateInstance(REFIID iid
, void **ppv
) DECLSPEC_HIDDEN
;
163 extern HRESULT
GCEReader_CreateInstance(REFIID iid
, void **ppv
) DECLSPEC_HIDDEN
;
164 extern HRESULT
APEReader_CreateInstance(REFIID iid
, void **ppv
) DECLSPEC_HIDDEN
;
165 extern HRESULT
GifCommentReader_CreateInstance(REFIID iid
, void **ppv
) DECLSPEC_HIDDEN
;
166 extern HRESULT
MetadataQueryReader_CreateInstance(IWICMetadataBlockReader
*, const WCHAR
*, IWICMetadataQueryReader
**) DECLSPEC_HIDDEN
;
167 extern HRESULT
stream_initialize_from_filehandle(IWICStream
*iface
, HANDLE hfile
) DECLSPEC_HIDDEN
;
169 static inline WCHAR
*heap_strdupW(const WCHAR
*src
)
173 if (!src
) return NULL
;
174 len
= (strlenW(src
) + 1) * sizeof(WCHAR
);
175 if ((dst
= HeapAlloc(GetProcessHeap(), 0, len
))) memcpy(dst
, src
, len
);
179 #endif /* WINCODECS_PRIVATE_H */