ReactOS  0.4.13-dev-657-g10798fa
wincodecs_private.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009 Vincent Povirk for CodeWeavers
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 WINCODECS_PRIVATE_H
20 #define WINCODECS_PRIVATE_H
21 
22 #include "wincodec.h"
23 #include "wincodecsdk.h"
24 
25 #include "wine/debug.h"
26 #include "wine/unicode.h"
27 
28 DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
29 
30 DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c);
31 
32 DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22);
33 
34 DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a);
35 
36 DEFINE_GUID(IID_IMILBitmap,0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a);
37 DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe);
38 DEFINE_GUID(IID_IMILBitmapLock,0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd);
39 DEFINE_GUID(IID_IMILBitmapScaler,0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb);
40 DEFINE_GUID(IID_IMILFormatConverter,0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0);
41 DEFINE_GUID(IID_IMILPalette,0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f);
42 
43 #define INTERFACE IMILBitmapSource
44 DECLARE_INTERFACE_(IMILBitmapSource,IUnknown)
45 {
46  /*** IUnknown methods ***/
50  /*** IWICBitmapSource methods ***/
53  STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
54  STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
55  STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
56  /*** IMILBitmapSource methods ***/
57  STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE;
60  STDMETHOD_(HRESULT,SetPalette)(THIS_ IWICPalette *) PURE;
62  STDMETHOD_(HRESULT,AddDirtyRect)(THIS_ const WICRect *) PURE;
63 };
64 #undef INTERFACE
65 
66 #define INTERFACE IMILBitmapScaler
67 DECLARE_INTERFACE_(IMILBitmapScaler,IUnknown)
68 {
69  /*** IUnknown methods ***/
73  /*** IWICBitmapSource methods ***/
76  STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
77  STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
78  STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
79  /*** IMILBitmapScaler methods ***/
80  STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE;
82 };
83 #undef INTERFACE
84 
85 #ifdef __i386__ /* thiscall functions are i386-specific */
86 
87 #define THISCALL(func) __thiscall_ ## func
88 #define DEFINE_THISCALL_WRAPPER(func,args) \
89  extern typeof(func) THISCALL(func); \
90  __ASM_STDCALL_FUNC(__thiscall_ ## func, args, \
91  "popl %eax\n\t" \
92  "pushl %ecx\n\t" \
93  "pushl %eax\n\t" \
94  "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
95 #else /* __i386__ */
96 
97 #define THISCALL(func) func
98 #define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
99 
100 #endif /* __i386__ */
101 
102 #define INTERFACE IMILUnknown1
104 {
105  /*** IUnknown methods ***/
109  /*** thiscall method ***/
110  STDMETHOD_(void,unknown1)(THIS_ void*) PURE;
111  /*** stdcall ***/
112  STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE;
113  /*** thiscall method ***/
114  STDMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE;
115  /*** stdcall ***/
116  STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE;
117  STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE;
118  STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE;
119  STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE;
120  /*** thiscall method ***/
121  STDMETHOD_(HRESULT,unknown8)(THIS) PURE;
122 };
123 #undef INTERFACE
124 
125 #define INTERFACE IMILUnknown2
127 {
128  /*** IUnknown methods ***/
132  /*** unknown methods ***/
133  STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void **) PURE;
134  STDMETHOD_(HRESULT,unknown2)(THIS_ void *,void *) PURE;
135  STDMETHOD_(HRESULT,unknown3)(THIS_ void *) PURE;
136 };
137 #undef INTERFACE
138 
140 
141 typedef HRESULT(*class_constructor)(REFIID,void**);
158 
159 extern HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
160  UINT stride, UINT datasize, void *view, UINT offset,
162  IWICBitmap **ppIBitmap) DECLSPEC_HIDDEN;
170 
171 extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
172  UINT srcwidth, UINT srcheight, INT srcstride,
173  const WICRect *rc, UINT dststride, UINT dstbuffersize, BYTE *dstbuffer) DECLSPEC_HIDDEN;
174 
177  const WICPixelFormatGUID *format,
178  INT width, INT height, double xres, double yres) DECLSPEC_HIDDEN;
179 
184 
185 extern void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride) DECLSPEC_HIDDEN;
186 
188 
189 extern HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
191 
193 extern void ReleaseComponentInfos(void) DECLSPEC_HIDDEN;
194 extern HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) DECLSPEC_HIDDEN;
196 
197 typedef struct BmpDecoder BmpDecoder;
198 
201 extern void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown) DECLSPEC_HIDDEN;
202 
203 typedef struct _MetadataItem
204 {
205  PROPVARIANT schema;
206  PROPVARIANT id;
207  PROPVARIANT value;
208 } MetadataItem;
209 
210 typedef struct _MetadataHandlerVtbl
211 {
213  const CLSID *clsid;
214  HRESULT (*fnLoad)(IStream *stream, const GUID *preferred_vendor,
215  DWORD persist_options, MetadataItem **items, DWORD *item_count);
216  HRESULT (*fnSave)(IStream *stream, DWORD persist_options,
217  const MetadataItem *items, DWORD item_count);
218  HRESULT (*fnGetSizeMax)(const MetadataItem *items, DWORD item_count,
221 
223 
236 
237 static inline WCHAR *heap_strdupW(const WCHAR *src)
238 {
239  WCHAR *dst;
240  SIZE_T len;
241  if (!src) return NULL;
242  len = (strlenW(src) + 1) * sizeof(WCHAR);
243  if ((dst = HeapAlloc(GetProcessHeap(), 0, len))) memcpy(dst, src, len);
244  return dst;
245 }
246 
247 static inline const char *debug_wic_rect(const WICRect *rect)
248 {
249  if (!rect) return "(null)";
250  return wine_dbg_sprintf("(%u,%u)-(%u,%u)", rect->X, rect->Y, rect->Width, rect->Height);
251 }
252 
253 #endif /* WINCODECS_PRIVATE_H */
HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:249
static WCHAR * heap_strdupW(const WCHAR *src)
HRESULT ImagingFactory_CreateInstance(REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: imgfactory.c:1470
HRESULT ColorTransform_Create(IWICColorTransform **transform) DECLSPEC_HIDDEN
struct _MetadataItem MetadataItem
HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:168
DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a, 0x67cc, 0x43e6, 0xa9, 0xce, 0xe3, 0xd5, 0x49, 0x45, 0xd3, 0x04)
#define HRESULT
Definition: msvc.h:9
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT configure_write_source(IWICBitmapFrameEncode *iface, IWICBitmapSource *source, const WICRect *prc, const WICPixelFormatGUID *format, INT width, INT height, double xres, double yres) DECLSPEC_HIDDEN
Definition: main.c:123
HRESULT JpegDecoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: jpegformat.c:1550
#define REFIID
Definition: guiddef.h:113
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define THIS_
Definition: basetyps.h:65
static void * vtable[]
Definition: typelib.c:1231
Definition: scsiwmi.h:51
_In_ BOOLEAN Release
Definition: classpnp.h:929
HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:528
HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, IPropertyBag2 **property) DECLSPEC_HIDDEN
Definition: propertybag.c:281
int WINAPI GetPixelFormat(_In_ HDC)
HRESULT PngDecoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: pngformat.c:2177
Definition: http.c:6587
#define THIS
Definition: basetyps.h:66
REFIID riid
Definition: precomp.h:44
#define REFCLSID
Definition: guiddef.h:112
HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void **ppv) DECLSPEC_HIDDEN
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLintptr offset
Definition: glext.h:5920
REFIID LPVOID * ppv
Definition: atlbase.h:39
struct _MetadataHandlerVtbl MetadataHandlerVtbl
PROPVARIANT value
HRESULT DibDecoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: bmpdecode.c:1199
DECLARE_INTERFACE_(IMILBitmapSource, IUnknown)
HRESULT FormatConverter_CreateInstance(REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: converter.c:1762
NTSTATUS QueryInterface(IN PDEVICE_OBJECT DeviceObject, IN CONST GUID InterfaceType, IN LONG Size, IN LONG Version, OUT PVOID Interface)
Definition: fdo.c:532
HRESULT PngGamaReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: pngformat.c:217
HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) DECLSPEC_HIDDEN
Definition: info.c:2075
#define DWORD
Definition: nt_native.h:44
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
HRESULT IcnsEncoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: icnsformat.c:738
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
WICBitmapCreateCacheOption
Definition: wincodec.idl:33
void BmpDecoder_GetWICDecoder(BmpDecoder *This, IWICBitmapDecoder **ppDecoder) DECLSPEC_HIDDEN
Definition: bmpdecode.c:1209
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator) DECLSPEC_HIDDEN
Definition: fliprotate.c:268
void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown) DECLSPEC_HIDDEN
Definition: bmpdecode.c:1215
void ReleaseComponentInfos(void) DECLSPEC_HIDDEN
Definition: info.c:2155
HRESULT TiffEncoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: tiffformat.c:2366
unsigned char * LPBYTE
Definition: typedefs.h:52
HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
smooth NULL
Definition: ftsmooth.c:416
Definition: getopt.h:108
HRESULT(* fnLoad)(IStream *stream, const GUID *preferred_vendor, DWORD persist_options, MetadataItem **items, DWORD *item_count)
pixelformat
Definition: converter.c:40
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *, const WCHAR *, IWICMetadataQueryReader **) DECLSPEC_HIDDEN
PROPVARIANT schema
HRESULT GifEncoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:2375
GLsizei stride
Definition: glext.h:5848
HRESULT BmpDecoder_CreateInstance(REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: bmpdecode.c:1194
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI GetSize(LPVOID)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
HRESULT PngChrmReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: pngformat.c:295
HRESULT PngEncoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: pngformat.c:2183
HRESULT(* fnSave)(IStream *stream, DWORD persist_options, const MetadataItem *items, DWORD item_count)
#define IMILUnknown1
Definition: msvc.h:10
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT ColorContext_Create(IWICColorContext **context) DECLSPEC_HIDDEN
Definition: colorcontext.c:258
HRESULT PaletteImpl_Create(IWICPalette **palette) DECLSPEC_HIDDEN
Definition: palette.c:899
HRESULT PngTextReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: pngformat.c:155
REFCLSID clsid
Definition: msctf.c:84
WICBitmapInterpolationMode
Definition: wincodec.idl:76
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, void *view, UINT offset, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap) DECLSPEC_HIDDEN
Definition: bitmap.c:809
HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) DECLSPEC_HIDDEN
Definition: scaler.c:551
Definition: parse.h:22
HRESULT TiffDecoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: tiffformat.c:2360
GLuint GLuint stream
Definition: glext.h:7522
static const char * debug_wic_rect(const WICRect *rect)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG IN OUT PLONG IN LONG Increment IN PNDIS_RW_LOCK Lock
Definition: CrNtStubs.h:75
GLenum src
Definition: glext.h:6340
HRESULT(* class_constructor)(REFIID, void **)
static HPALETTE palette
Definition: clipboard.c:1345
HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer, UINT srcwidth, UINT srcheight, INT srcstride, const WICRect *rc, UINT dststride, UINT dstbuffersize, BYTE *dstbuffer) DECLSPEC_HIDDEN
Definition: main.c:58
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HRESULT StreamImpl_Create(IWICStream **stream) DECLSPEC_HIDDEN
Definition: stream.c:1150
ULONG_PTR SIZE_T
Definition: typedefs.h:78
_In_ BOOLEAN SetResolution
Definition: exfuncs.h:870
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
uint64_t DWORD64
Definition: typedefs.h:65
HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
HRESULT TgaDecoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: tgaformat.c:942
GLenum GLenum dst
Definition: glext.h:6340
BOOL Initialize(HINSTANCE hInstance)
Definition: msconfig.c:341
#define PURE
Definition: basetyps.h:64
unsigned int UINT
Definition: ndis.h:50
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp) DECLSPEC_HIDDEN
Definition: main.c:231
HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:327
static ULONG WINAPI AddRef(IStream *iface)
Definition: clist.c:90
HRESULT GifDecoder_CreateInstance(REFIID riid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:1434
HRESULT IcoDecoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: icoformat.c:759
HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder) DECLSPEC_HIDDEN
Definition: bmpdecode.c:1204
HRESULT create_instance(CLSID *clsid, const IID *iid, void **ppv) DECLSPEC_HIDDEN
Definition: clsfactory.c:208
void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride) DECLSPEC_HIDDEN
Definition: main.c:212
unsigned int ULONG
Definition: retypes.h:1
HRESULT get_decoder_info(REFCLSID clsid, IWICBitmapDecoderInfo **info) DECLSPEC_HIDDEN
Definition: info.c:2162
HRESULT(* fnGetSizeMax)(const MetadataItem *items, DWORD item_count, ULARGE_INTEGER *size)
GLuint GLenum GLenum transform
Definition: glext.h:9407
DWORD bpp
Definition: surface.c:181
HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper) DECLSPEC_HIDDEN
Definition: clipper.c:243
HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: gifformat.c:434
#define STDMETHOD_(t, m)
Definition: basetyps.h:63
static TCHAR * items[]
Definition: page1.c:45
_Out_ LPRECT prc
Definition: ntgdi.h:1658
HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN
Definition: stream.c:1039
HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) DECLSPEC_HIDDEN
Definition: info.c:2380
HRESULT BmpEncoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: bmpencode.c:642
HRESULT write_source(IWICBitmapFrameEncode *iface, IWICBitmapSource *source, const WICRect *prc, const WICPixelFormatGUID *format, UINT bpp, INT width, INT height) DECLSPEC_HIDDEN
Definition: main.c:155
HRESULT JpegEncoder_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN
Definition: jpegformat.c:1556