ReactOS 0.4.16-dev-336-gb667d82
imgfactory.c File Reference
#include "config.h"
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "objbase.h"
#include "shellapi.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
Include dependency graph for imgfactory.c:

Go to the source code of this file.

Classes

struct  ImagingFactory
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wincodecs)
 
static ImagingFactoryimpl_from_IWICComponentFactory (IWICComponentFactory *iface)
 
static ImagingFactoryimpl_from_IWICImagingFactory2 (IWICImagingFactory2 *iface)
 
static HRESULT WINAPI ImagingFactory_QueryInterface (IWICImagingFactory2 *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI ImagingFactory_AddRef (IWICImagingFactory2 *iface)
 
static ULONG WINAPI ImagingFactory_Release (IWICImagingFactory2 *iface)
 
static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename (IWICImagingFactory2 *iface, LPCWSTR wzFilename, const GUID *pguidVendor, DWORD dwDesiredAccess, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT find_decoder (IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream (IWICImagingFactory2 *iface, IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle (IWICImagingFactory2 *iface, ULONG_PTR hFile, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT WINAPI ImagingFactory_CreateComponentInfo (IWICImagingFactory2 *iface, REFCLSID clsidComponent, IWICComponentInfo **ppIInfo)
 
static HRESULT WINAPI ImagingFactory_CreateDecoder (IWICImagingFactory2 *iface, REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapDecoder **ppIDecoder)
 
static HRESULT WINAPI ImagingFactory_CreateEncoder (IWICImagingFactory2 *iface, REFGUID guidContainerFormat, const GUID *pguidVendor, IWICBitmapEncoder **ppIEncoder)
 
static HRESULT WINAPI ImagingFactory_CreatePalette (IWICImagingFactory2 *iface, IWICPalette **ppIPalette)
 
static HRESULT WINAPI ImagingFactory_CreateFormatConverter (IWICImagingFactory2 *iface, IWICFormatConverter **ppIFormatConverter)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapScaler (IWICImagingFactory2 *iface, IWICBitmapScaler **ppIBitmapScaler)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapClipper (IWICImagingFactory2 *iface, IWICBitmapClipper **ppIBitmapClipper)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFlipRotator (IWICImagingFactory2 *iface, IWICBitmapFlipRotator **ppIBitmapFlipRotator)
 
static HRESULT WINAPI ImagingFactory_CreateStream (IWICImagingFactory2 *iface, IWICStream **ppIWICStream)
 
static HRESULT WINAPI ImagingFactory_CreateColorContext (IWICImagingFactory2 *iface, IWICColorContext **ppIColorContext)
 
static HRESULT WINAPI ImagingFactory_CreateColorTransformer (IWICImagingFactory2 *iface, IWICColorTransform **ppIColorTransform)
 
static HRESULT WINAPI ImagingFactory_CreateBitmap (IWICImagingFactory2 *iface, UINT uiWidth, UINT uiHeight, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
 
static HRESULT create_bitmap_from_source_rect (IWICBitmapSource *piBitmapSource, const WICRect *rect, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromSource (IWICImagingFactory2 *iface, IWICBitmapSource *piBitmapSource, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromSourceRect (IWICImagingFactory2 *iface, IWICBitmapSource *piBitmapSource, UINT x, UINT y, UINT width, UINT height, IWICBitmap **ppIBitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromMemory (IWICImagingFactory2 *iface, UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap)
 
static BOOL get_16bpp_format (HBITMAP hbm, WICPixelFormatGUID *format)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromHBITMAP (IWICImagingFactory2 *iface, HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON (IWICImagingFactory2 *iface, HICON hicon, IWICBitmap **bitmap)
 
static HRESULT WINAPI ImagingFactory_CreateComponentEnumerator (IWICImagingFactory2 *iface, DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
 
static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder (IWICImagingFactory2 *iface, IWICBitmapDecoder *pIDecoder, IWICFastMetadataEncoder **ppIFastEncoder)
 
static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode (IWICImagingFactory2 *iface, IWICBitmapFrameDecode *pIFrameDecoder, IWICFastMetadataEncoder **ppIFastEncoder)
 
static HRESULT WINAPI ImagingFactory_CreateQueryWriter (IWICImagingFactory2 *iface, REFGUID guidMetadataFormat, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter)
 
static HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader (IWICImagingFactory2 *iface, IWICMetadataQueryReader *pIQueryReader, const GUID *pguidVendor, IWICMetadataQueryWriter **ppIQueryWriter)
 
static HRESULT WINAPI ImagingFactory_CreateImageEncoder (IWICImagingFactory2 *iface, ID2D1Device *device, IWICImageEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_QueryInterface (IWICComponentFactory *iface, REFIID iid, void **ppv)
 
static ULONG WINAPI ComponentFactory_AddRef (IWICComponentFactory *iface)
 
static ULONG WINAPI ComponentFactory_Release (IWICComponentFactory *iface)
 
static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename (IWICComponentFactory *iface, LPCWSTR filename, const GUID *vendor, DWORD desired_access, WICDecodeOptions options, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream (IWICComponentFactory *iface, IStream *stream, const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle (IWICComponentFactory *iface, ULONG_PTR hFile, const GUID *vendor, WICDecodeOptions options, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateComponentInfo (IWICComponentFactory *iface, REFCLSID component, IWICComponentInfo **info)
 
static HRESULT WINAPI ComponentFactory_CreateDecoder (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, IWICBitmapDecoder **decoder)
 
static HRESULT WINAPI ComponentFactory_CreateEncoder (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, IWICBitmapEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_CreatePalette (IWICComponentFactory *iface, IWICPalette **palette)
 
static HRESULT WINAPI ComponentFactory_CreateFormatConverter (IWICComponentFactory *iface, IWICFormatConverter **converter)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapScaler (IWICComponentFactory *iface, IWICBitmapScaler **scaler)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapClipper (IWICComponentFactory *iface, IWICBitmapClipper **clipper)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator (IWICComponentFactory *iface, IWICBitmapFlipRotator **fliprotator)
 
static HRESULT WINAPI ComponentFactory_CreateStream (IWICComponentFactory *iface, IWICStream **stream)
 
static HRESULT WINAPI ComponentFactory_CreateColorContext (IWICComponentFactory *iface, IWICColorContext **context)
 
static HRESULT WINAPI ComponentFactory_CreateColorTransformer (IWICComponentFactory *iface, IWICColorTransform **transformer)
 
static HRESULT WINAPI ComponentFactory_CreateBitmap (IWICComponentFactory *iface, UINT width, UINT height, REFWICPixelFormatGUID pixel_format, WICBitmapCreateCacheOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource (IWICComponentFactory *iface, IWICBitmapSource *source, WICBitmapCreateCacheOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect (IWICComponentFactory *iface, IWICBitmapSource *source, UINT x, UINT y, UINT width, UINT height, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory (IWICComponentFactory *iface, UINT width, UINT height, REFWICPixelFormatGUID format, UINT stride, UINT size, BYTE *buffer, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP (IWICComponentFactory *iface, HBITMAP hbm, HPALETTE hpal, WICBitmapAlphaChannelOption option, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON (IWICComponentFactory *iface, HICON hicon, IWICBitmap **bitmap)
 
static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator (IWICComponentFactory *iface, DWORD component_types, DWORD options, IEnumUnknown **enumerator)
 
static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder (IWICComponentFactory *iface, IWICBitmapDecoder *decoder, IWICFastMetadataEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode (IWICComponentFactory *iface, IWICBitmapFrameDecode *frame_decode, IWICFastMetadataEncoder **encoder)
 
static HRESULT WINAPI ComponentFactory_CreateQueryWriter (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, IWICMetadataQueryWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader (IWICComponentFactory *iface, IWICMetadataQueryReader *reader, const GUID *vendor, IWICMetadataQueryWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataReader (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataWriter (IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IWICMetadataWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader (IWICComponentFactory *iface, IWICMetadataReader *reader, const GUID *vendor, IWICMetadataWriter **writer)
 
static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader (IWICComponentFactory *iface, IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
 
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter (IWICComponentFactory *iface, IWICMetadataBlockWriter *block_writer, IWICMetadataQueryWriter **query_writer)
 
static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag (IWICComponentFactory *iface, PROPBAG2 *options, UINT count, IPropertyBag2 **property)
 
HRESULT ImagingFactory_CreateInstance (REFIID iid, void **ppv)
 
HRESULT WINAPI WICCreateBitmapFromSectionEx (UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap)
 
HRESULT WINAPI WICCreateBitmapFromSection (UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, IWICBitmap **bitmap)
 

Variables

static const IWICImagingFactory2Vtbl ImagingFactory_Vtbl
 
static const IWICComponentFactoryVtbl ComponentFactory_Vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file imgfactory.c.

Function Documentation

◆ ComponentFactory_AddRef()

static ULONG WINAPI ComponentFactory_AddRef ( IWICComponentFactory iface)
static

Definition at line 1074 of file imgfactory.c.

1075{
1077 return IWICImagingFactory2_AddRef(&This->IWICImagingFactory2_iface);
1078}
static ImagingFactory * impl_from_IWICComponentFactory(IWICComponentFactory *iface)
Definition: imgfactory.c:45

◆ ComponentFactory_CreateBitmap()

static HRESULT WINAPI ComponentFactory_CreateBitmap ( IWICComponentFactory iface,
UINT  width,
UINT  height,
REFWICPixelFormatGUID  pixel_format,
WICBitmapCreateCacheOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 1179 of file imgfactory.c.

1181{
1183 return IWICImagingFactory2_CreateBitmap(&This->IWICImagingFactory2_iface, width, height, pixel_format, option, bitmap);
1184}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
Definition: uimain.c:89
Definition: getopt.h:109

◆ ComponentFactory_CreateBitmapClipper()

static HRESULT WINAPI ComponentFactory_CreateBitmapClipper ( IWICComponentFactory iface,
IWICBitmapClipper **  clipper 
)
static

Definition at line 1149 of file imgfactory.c.

1150{
1152 return IWICImagingFactory2_CreateBitmapClipper(&This->IWICImagingFactory2_iface, clipper);
1153}

◆ ComponentFactory_CreateBitmapFlipRotator()

static HRESULT WINAPI ComponentFactory_CreateBitmapFlipRotator ( IWICComponentFactory iface,
IWICBitmapFlipRotator **  fliprotator 
)
static

Definition at line 1155 of file imgfactory.c.

1156{
1158 return IWICImagingFactory2_CreateBitmapFlipRotator(&This->IWICImagingFactory2_iface, fliprotator);
1159}

◆ ComponentFactory_CreateBitmapFromHBITMAP()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromHBITMAP ( IWICComponentFactory iface,
HBITMAP  hbm,
HPALETTE  hpal,
WICBitmapAlphaChannelOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 1208 of file imgfactory.c.

1210{
1212 return IWICImagingFactory2_CreateBitmapFromHBITMAP(&This->IWICImagingFactory2_iface, hbm, hpal, option, bitmap);
1213}
_In_ HBITMAP hbm
Definition: ntgdi.h:2776

◆ ComponentFactory_CreateBitmapFromHICON()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromHICON ( IWICComponentFactory iface,
HICON  hicon,
IWICBitmap **  bitmap 
)
static

Definition at line 1215 of file imgfactory.c.

1216{
1218 return IWICImagingFactory2_CreateBitmapFromHICON(&This->IWICImagingFactory2_iface, hicon, bitmap);
1219}

◆ ComponentFactory_CreateBitmapFromMemory()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromMemory ( IWICComponentFactory iface,
UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
UINT  stride,
UINT  size,
BYTE buffer,
IWICBitmap **  bitmap 
)
static

Definition at line 1200 of file imgfactory.c.

1202{
1204 return IWICImagingFactory2_CreateBitmapFromMemory(&This->IWICImagingFactory2_iface, width, height, format, stride,
1205 size, buffer, bitmap);
1206}
GLsizeiptr size
Definition: glext.h:5919
GLsizei stride
Definition: glext.h:5848
GLuint buffer
Definition: glext.h:5915
Definition: format.c:58

◆ ComponentFactory_CreateBitmapFromSource()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromSource ( IWICComponentFactory iface,
IWICBitmapSource source,
WICBitmapCreateCacheOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 1186 of file imgfactory.c.

1188{
1190 return IWICImagingFactory2_CreateBitmapFromSource(&This->IWICImagingFactory2_iface, source, option, bitmap);
1191}

◆ ComponentFactory_CreateBitmapFromSourceRect()

static HRESULT WINAPI ComponentFactory_CreateBitmapFromSourceRect ( IWICComponentFactory iface,
IWICBitmapSource source,
UINT  x,
UINT  y,
UINT  width,
UINT  height,
IWICBitmap **  bitmap 
)
static

Definition at line 1193 of file imgfactory.c.

1195{
1197 return IWICImagingFactory2_CreateBitmapFromSourceRect(&This->IWICImagingFactory2_iface, source, x, y, width, height, bitmap);
1198}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ ComponentFactory_CreateBitmapScaler()

static HRESULT WINAPI ComponentFactory_CreateBitmapScaler ( IWICComponentFactory iface,
IWICBitmapScaler **  scaler 
)
static

Definition at line 1143 of file imgfactory.c.

1144{
1146 return IWICImagingFactory2_CreateBitmapScaler(&This->IWICImagingFactory2_iface, scaler);
1147}

◆ ComponentFactory_CreateColorContext()

static HRESULT WINAPI ComponentFactory_CreateColorContext ( IWICComponentFactory iface,
IWICColorContext **  context 
)
static

Definition at line 1167 of file imgfactory.c.

1168{
1170 return IWICImagingFactory2_CreateColorContext(&This->IWICImagingFactory2_iface, context);
1171}
Definition: http.c:7252

◆ ComponentFactory_CreateColorTransformer()

static HRESULT WINAPI ComponentFactory_CreateColorTransformer ( IWICComponentFactory iface,
IWICColorTransform **  transformer 
)
static

Definition at line 1173 of file imgfactory.c.

1174{
1176 return IWICImagingFactory2_CreateColorTransformer(&This->IWICImagingFactory2_iface, transformer);
1177}

◆ ComponentFactory_CreateComponentEnumerator()

static HRESULT WINAPI ComponentFactory_CreateComponentEnumerator ( IWICComponentFactory iface,
DWORD  component_types,
DWORD  options,
IEnumUnknown **  enumerator 
)
static

Definition at line 1221 of file imgfactory.c.

1223{
1225 return IWICImagingFactory2_CreateComponentEnumerator(&This->IWICImagingFactory2_iface, component_types,
1226 options, enumerator);
1227}

◆ ComponentFactory_CreateComponentInfo()

static HRESULT WINAPI ComponentFactory_CreateComponentInfo ( IWICComponentFactory iface,
REFCLSID  component,
IWICComponentInfo **  info 
)
static

Definition at line 1110 of file imgfactory.c.

1112{
1114 return IWICImagingFactory2_CreateComponentInfo(&This->IWICImagingFactory2_iface, component, info);
1115}

◆ ComponentFactory_CreateDecoder()

static HRESULT WINAPI ComponentFactory_CreateDecoder ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1117 of file imgfactory.c.

1119{
1121 return IWICImagingFactory2_CreateDecoder(&This->IWICImagingFactory2_iface, format, vendor, decoder);
1122}
const WCHAR * vendor
Definition: db.cpp:872

◆ ComponentFactory_CreateDecoderFromFileHandle()

static HRESULT WINAPI ComponentFactory_CreateDecoderFromFileHandle ( IWICComponentFactory iface,
ULONG_PTR  hFile,
const GUID vendor,
WICDecodeOptions  options,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1102 of file imgfactory.c.

1104{
1106 return IWICImagingFactory2_CreateDecoderFromFileHandle(&This->IWICImagingFactory2_iface, hFile, vendor,
1107 options, decoder);
1108}
_In_ HANDLE hFile
Definition: mswsock.h:90

◆ ComponentFactory_CreateDecoderFromFilename()

static HRESULT WINAPI ComponentFactory_CreateDecoderFromFilename ( IWICComponentFactory iface,
LPCWSTR  filename,
const GUID vendor,
DWORD  desired_access,
WICDecodeOptions  options,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1086 of file imgfactory.c.

1088{
1090 return IWICImagingFactory2_CreateDecoderFromFilename(&This->IWICImagingFactory2_iface, filename, vendor,
1091 desired_access, options, decoder);
1092}
const char * filename
Definition: ioapi.h:137

◆ ComponentFactory_CreateDecoderFromStream()

static HRESULT WINAPI ComponentFactory_CreateDecoderFromStream ( IWICComponentFactory iface,
IStream stream,
const GUID vendor,
WICDecodeOptions  options,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 1094 of file imgfactory.c.

1096{
1098 return IWICImagingFactory2_CreateDecoderFromStream(&This->IWICImagingFactory2_iface, stream, vendor,
1099 options, decoder);
1100}
Definition: parse.h:23

◆ ComponentFactory_CreateEncoder()

static HRESULT WINAPI ComponentFactory_CreateEncoder ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
IWICBitmapEncoder **  encoder 
)
static

Definition at line 1124 of file imgfactory.c.

1126{
1128 return IWICImagingFactory2_CreateEncoder(&This->IWICImagingFactory2_iface, format, vendor, encoder);
1129}

◆ ComponentFactory_CreateEncoderPropertyBag()

static HRESULT WINAPI ComponentFactory_CreateEncoderPropertyBag ( IWICComponentFactory iface,
PROPBAG2 *  options,
UINT  count,
IPropertyBag2 **  property 
)
static

Definition at line 1425 of file imgfactory.c.

1427{
1428 TRACE("(%p,%p,%u,%p)\n", iface, options, count, property);
1430}
HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count, IPropertyBag2 **ppPropertyBag2)
Definition: propertybag.c:281
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define TRACE(s)
Definition: solgame.cpp:4

◆ ComponentFactory_CreateFastMetadataEncoderFromDecoder()

static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromDecoder ( IWICComponentFactory iface,
IWICBitmapDecoder decoder,
IWICFastMetadataEncoder **  encoder 
)
static

Definition at line 1229 of file imgfactory.c.

1231{
1233 return IWICImagingFactory2_CreateFastMetadataEncoderFromDecoder(&This->IWICImagingFactory2_iface, decoder, encoder);
1234}

◆ ComponentFactory_CreateFastMetadataEncoderFromFrameDecode()

static HRESULT WINAPI ComponentFactory_CreateFastMetadataEncoderFromFrameDecode ( IWICComponentFactory iface,
IWICBitmapFrameDecode frame_decode,
IWICFastMetadataEncoder **  encoder 
)
static

Definition at line 1236 of file imgfactory.c.

1238{
1240 return IWICImagingFactory2_CreateFastMetadataEncoderFromFrameDecode(&This->IWICImagingFactory2_iface, frame_decode, encoder);
1241}

◆ ComponentFactory_CreateFormatConverter()

static HRESULT WINAPI ComponentFactory_CreateFormatConverter ( IWICComponentFactory iface,
IWICFormatConverter **  converter 
)
static

Definition at line 1137 of file imgfactory.c.

1138{
1140 return IWICImagingFactory2_CreateFormatConverter(&This->IWICImagingFactory2_iface, converter);
1141}

◆ ComponentFactory_CreateMetadataReader()

static HRESULT WINAPI ComponentFactory_CreateMetadataReader ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
DWORD  options,
IStream stream,
IWICMetadataReader **  reader 
)
static

Definition at line 1257 of file imgfactory.c.

1259{
1260 FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor),
1262 return E_NOTIMPL;
1263}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
#define debugstr_guid
Definition: kernel32.h:35
Definition: reader.h:84

◆ ComponentFactory_CreateMetadataReaderFromContainer()

static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
DWORD  options,
IStream stream,
IWICMetadataReader **  reader 
)
static

Definition at line 1265 of file imgfactory.c.

1267{
1268 HRESULT hr;
1269 IEnumUnknown *enumreaders;
1270 IUnknown *unkreaderinfo;
1271 IWICMetadataReaderInfo *readerinfo;
1272 IWICPersistStream *wicpersiststream;
1273 ULONG num_fetched;
1274 GUID decoder_vendor;
1275 BOOL matches;
1277
1278 TRACE("%p,%s,%s,%x,%p,%p\n", iface, debugstr_guid(format), debugstr_guid(vendor),
1280
1281 if (!format || !stream || !reader)
1282 return E_INVALIDARG;
1283
1284 zero.QuadPart = 0;
1285
1287 if (FAILED(hr)) return hr;
1288
1289 *reader = NULL;
1290
1291start:
1292 while (!*reader)
1293 {
1294 hr = IEnumUnknown_Next(enumreaders, 1, &unkreaderinfo, &num_fetched);
1295
1296 if (hr == S_OK)
1297 {
1298 hr = IUnknown_QueryInterface(unkreaderinfo, &IID_IWICMetadataReaderInfo, (void**)&readerinfo);
1299
1300 if (SUCCEEDED(hr))
1301 {
1302 if (vendor)
1303 {
1304 hr = IWICMetadataReaderInfo_GetVendorGUID(readerinfo, &decoder_vendor);
1305
1306 if (FAILED(hr) || !IsEqualIID(vendor, &decoder_vendor))
1307 {
1308 IWICMetadataReaderInfo_Release(readerinfo);
1309 IUnknown_Release(unkreaderinfo);
1310 continue;
1311 }
1312 }
1313
1314 hr = IWICMetadataReaderInfo_MatchesPattern(readerinfo, format, stream, &matches);
1315
1316 if (SUCCEEDED(hr) && matches)
1317 {
1318 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
1319
1320 if (SUCCEEDED(hr))
1321 hr = IWICMetadataReaderInfo_CreateInstance(readerinfo, reader);
1322
1323 if (SUCCEEDED(hr))
1324 {
1325 hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void**)&wicpersiststream);
1326
1327 if (SUCCEEDED(hr))
1328 {
1329 hr = IWICPersistStream_LoadEx(wicpersiststream,
1331
1332 IWICPersistStream_Release(wicpersiststream);
1333 }
1334
1335 if (FAILED(hr))
1336 {
1337 IWICMetadataReader_Release(*reader);
1338 *reader = NULL;
1339 }
1340 }
1341 }
1342
1343 IUnknown_Release(readerinfo);
1344 }
1345
1346 IUnknown_Release(unkreaderinfo);
1347 }
1348 else
1349 break;
1350 }
1351
1352 if (!*reader && vendor)
1353 {
1354 vendor = NULL;
1355 IEnumUnknown_Reset(enumreaders);
1356 goto start;
1357 }
1358
1359 IEnumUnknown_Release(enumreaders);
1360
1362 {
1363 hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
1364
1365 if (SUCCEEDED(hr))
1366 hr = UnknownMetadataReader_CreateInstance(&IID_IWICMetadataReader, (void**)reader);
1367
1368 if (SUCCEEDED(hr))
1369 {
1370 hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void**)&wicpersiststream);
1371
1372 if (SUCCEEDED(hr))
1373 {
1374 hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options & WICPersistOptionMask);
1375
1376 IWICPersistStream_Release(wicpersiststream);
1377 }
1378
1379 if (FAILED(hr))
1380 {
1381 IWICMetadataReader_Release(*reader);
1382 *reader = NULL;
1383 }
1384 }
1385 }
1386
1387 if (*reader)
1388 return S_OK;
1389 else
1391}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define NULL
Definition: types.h:112
HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown)
Definition: info.c:2380
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint start
Definition: gl.h:1545
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void **ppv)
#define matches(FN)
Definition: match.h:70
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
int zero
Definition: sehframes.cpp:29
HRESULT hr
Definition: shlfolder.c:183
uint32_t ULONG
Definition: typedefs.h:59
@ WICComponentEnumerateDefault
Definition: wincodec.idl:142
@ WICMetadataReader
Definition: wincodec.idl:128
@ WICMetadataCreationFailUnknown
Definition: wincodecsdk.idl:35
@ WICPersistOptionMask
Definition: wincodecsdk.idl:29
#define WINCODEC_ERR_COMPONENTNOTFOUND
Definition: winerror.h:3296

◆ ComponentFactory_CreateMetadataWriter()

static HRESULT WINAPI ComponentFactory_CreateMetadataWriter ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
DWORD  options,
IWICMetadataWriter **  writer 
)
static

Definition at line 1393 of file imgfactory.c.

1395{
1396 FIXME("%p,%s,%s,%x,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, writer);
1397 return E_NOTIMPL;
1398}

◆ ComponentFactory_CreateMetadataWriterFromReader()

static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader ( IWICComponentFactory iface,
IWICMetadataReader reader,
const GUID vendor,
IWICMetadataWriter **  writer 
)
static

Definition at line 1400 of file imgfactory.c.

1402{
1403 FIXME("%p,%p,%s,%p: stub\n", iface, reader, debugstr_guid(vendor), writer);
1404 return E_NOTIMPL;
1405}

◆ ComponentFactory_CreatePalette()

static HRESULT WINAPI ComponentFactory_CreatePalette ( IWICComponentFactory iface,
IWICPalette **  palette 
)
static

Definition at line 1131 of file imgfactory.c.

1132{
1134 return IWICImagingFactory2_CreatePalette(&This->IWICImagingFactory2_iface, palette);
1135}
static HPALETTE palette
Definition: clipboard.c:1345

◆ ComponentFactory_CreateQueryReaderFromBlockReader()

static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader ( IWICComponentFactory iface,
IWICMetadataBlockReader block_reader,
IWICMetadataQueryReader **  query_reader 
)
static

Definition at line 1407 of file imgfactory.c.

1409{
1410 TRACE("%p,%p,%p\n", iface, block_reader, query_reader);
1411
1412 if (!block_reader || !query_reader)
1413 return E_INVALIDARG;
1414
1415 return MetadataQueryReader_CreateInstance(block_reader, NULL, query_reader);
1416}
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, const WCHAR *root, IWICMetadataQueryReader **out)

◆ ComponentFactory_CreateQueryWriter()

static HRESULT WINAPI ComponentFactory_CreateQueryWriter ( IWICComponentFactory iface,
REFGUID  format,
const GUID vendor,
IWICMetadataQueryWriter **  writer 
)
static

Definition at line 1243 of file imgfactory.c.

1245{
1247 return IWICImagingFactory2_CreateQueryWriter(&This->IWICImagingFactory2_iface, format, vendor, writer);
1248}

◆ ComponentFactory_CreateQueryWriterFromBlockWriter()

static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter ( IWICComponentFactory iface,
IWICMetadataBlockWriter block_writer,
IWICMetadataQueryWriter **  query_writer 
)
static

Definition at line 1418 of file imgfactory.c.

1420{
1421 FIXME("%p,%p,%p: stub\n", iface, block_writer, query_writer);
1422 return E_NOTIMPL;
1423}

◆ ComponentFactory_CreateQueryWriterFromReader()

static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromReader ( IWICComponentFactory iface,
IWICMetadataQueryReader reader,
const GUID vendor,
IWICMetadataQueryWriter **  writer 
)
static

Definition at line 1250 of file imgfactory.c.

1252{
1254 return IWICImagingFactory2_CreateQueryWriterFromReader(&This->IWICImagingFactory2_iface, reader, vendor, writer);
1255}

◆ ComponentFactory_CreateStream()

static HRESULT WINAPI ComponentFactory_CreateStream ( IWICComponentFactory iface,
IWICStream **  stream 
)
static

Definition at line 1161 of file imgfactory.c.

1162{
1164 return IWICImagingFactory2_CreateStream(&This->IWICImagingFactory2_iface, stream);
1165}

◆ ComponentFactory_QueryInterface()

static HRESULT WINAPI ComponentFactory_QueryInterface ( IWICComponentFactory iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 1068 of file imgfactory.c.

1069{
1071 return IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, ppv);
1072}
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ ComponentFactory_Release()

static ULONG WINAPI ComponentFactory_Release ( IWICComponentFactory iface)
static

Definition at line 1080 of file imgfactory.c.

1081{
1083 return IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
1084}

◆ create_bitmap_from_source_rect()

static HRESULT create_bitmap_from_source_rect ( IWICBitmapSource piBitmapSource,
const WICRect rect,
WICBitmapCreateCacheOption  option,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 495 of file imgfactory.c.

497{
503 HRESULT hr;
504 WICRect rc;
505 double dpix, dpiy;
507 IWICPixelFormatInfo2 *formatinfo;
509
511
512 if (!piBitmapSource || !ppIBitmap)
513 return E_INVALIDARG;
514
515 if (option == WICBitmapNoCache && SUCCEEDED(IWICBitmapSource_QueryInterface(piBitmapSource,
516 &IID_IWICBitmap, (void **)&result)))
517 {
518 *ppIBitmap = result;
519 return S_OK;
520 }
521
522 hr = IWICBitmapSource_GetSize(piBitmapSource, &width, &height);
523
524 if (SUCCEEDED(hr) && rect)
525 {
526 if (rect->X >= width || rect->Y >= height || rect->Width == 0 || rect->Height == 0)
527 return E_INVALIDARG;
528
529 width = min(width - rect->X, rect->Width);
530 height = min(height - rect->Y, rect->Height);
531 }
532
533 if (SUCCEEDED(hr))
534 hr = IWICBitmapSource_GetPixelFormat(piBitmapSource, &pixelformat);
535
536 if (SUCCEEDED(hr))
538
539 if (SUCCEEDED(hr))
540 {
541 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo2, (void**)&formatinfo);
542
543 if (SUCCEEDED(hr))
544 {
545 hr = IWICPixelFormatInfo2_GetNumericRepresentation(formatinfo, &format_type);
546
547 IWICPixelFormatInfo2_Release(formatinfo);
548 }
549
550 IWICComponentInfo_Release(info);
551 }
552
553 if (SUCCEEDED(hr))
555
556 if (SUCCEEDED(hr))
557 {
558 hr = IWICBitmap_Lock(result, NULL, WICBitmapLockWrite, &lock);
559 if (SUCCEEDED(hr))
560 {
561 UINT stride, buffersize;
562 BYTE *buffer;
563
564 if (rect)
565 {
566 rc.X = rect->X;
567 rc.Y = rect->Y;
568 }
569 else
570 rc.X = rc.Y = 0;
571 rc.Width = width;
572 rc.Height = height;
573
574 hr = IWICBitmapLock_GetStride(lock, &stride);
575
576 if (SUCCEEDED(hr))
577 hr = IWICBitmapLock_GetDataPointer(lock, &buffersize, &buffer);
578
579 if (SUCCEEDED(hr))
580 hr = IWICBitmapSource_CopyPixels(piBitmapSource, &rc, stride,
581 buffersize, buffer);
582
583 IWICBitmapLock_Release(lock);
584 }
585
588 {
590
591 if (SUCCEEDED(hr))
592 {
593 hr = IWICBitmapSource_CopyPalette(piBitmapSource, palette);
594
595 if (SUCCEEDED(hr))
596 hr = IWICBitmap_SetPalette(result, palette);
597 else
598 hr = S_OK;
599
600 IWICPalette_Release(palette);
601 }
602 }
603
604 if (SUCCEEDED(hr))
605 {
606 hr = IWICBitmapSource_GetResolution(piBitmapSource, &dpix, &dpiy);
607
608 if (SUCCEEDED(hr))
609 hr = IWICBitmap_SetResolution(result, dpix, dpiy);
610 else
611 hr = S_OK;
612 }
613
614 if (SUCCEEDED(hr))
615 *ppIBitmap = result;
616 else
617 IWICBitmap_Release(result);
618 }
619
620 return hr;
621}
format_type
Definition: d3dx9_private.h:49
HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasize, void *view, UINT offset, REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
Definition: bitmap.c:793
pixelformat
Definition: converter.c:40
HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo)
Definition: info.c:2075
HRESULT PaletteImpl_Create(IWICPalette **palette)
Definition: palette.c:899
#define assert(x)
Definition: debug.h:53
GLuint64EXT * result
Definition: glext.h:11304
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
& rect
Definition: startmenu.cpp:1413
INT Height
Definition: wincodec.idl:301
INT Width
Definition: wincodec.idl:300
rwlock_t lock
Definition: tcpcore.h:0
@ WICBitmapLockWrite
Definition: wincodec.idl:86
@ WICBitmapNoCache
Definition: wincodec.idl:34
@ WICBitmapCacheOnLoad
Definition: wincodec.idl:36
WICPixelFormatNumericRepresentation
Definition: wincodec.idl:157
@ WICPixelFormatNumericRepresentationUnspecified
Definition: wincodec.idl:158
@ WICPixelFormatNumericRepresentationIndexed
Definition: wincodec.idl:159
unsigned char BYTE
Definition: xxhash.c:193

Referenced by ImagingFactory_CreateBitmapFromSource(), and ImagingFactory_CreateBitmapFromSourceRect().

◆ find_decoder()

static HRESULT find_decoder ( IStream pIStream,
const GUID pguidVendor,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  decoder 
)
static

Definition at line 134 of file imgfactory.c.

136{
137 IEnumUnknown *enumdecoders;
138 IUnknown *unkdecoderinfo;
139 IWICBitmapDecoderInfo *decoderinfo;
140 GUID vendor;
141 HRESULT res;
142 ULONG num_fetched;
144
145 *decoder = NULL;
146
148 if (FAILED(res)) return res;
149
150 while (!*decoder)
151 {
152 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
153
154 if (res == S_OK)
155 {
156 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void**)&decoderinfo);
157
158 if (SUCCEEDED(res))
159 {
160 if (pguidVendor)
161 {
162 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
163 if (FAILED(res) || !IsEqualIID(&vendor, pguidVendor))
164 {
165 IWICBitmapDecoderInfo_Release(decoderinfo);
166 IUnknown_Release(unkdecoderinfo);
167 continue;
168 }
169 }
170
171 res = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, pIStream, &matches);
172
173 if (SUCCEEDED(res) && matches)
174 {
175 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, decoder);
176
177 /* FIXME: should use QueryCapability to choose a decoder */
178
179 if (SUCCEEDED(res))
180 {
181 res = IWICBitmapDecoder_Initialize(*decoder, pIStream, metadataOptions);
182
183 if (FAILED(res))
184 {
185 IWICBitmapDecoder_Release(*decoder);
186 IWICBitmapDecoderInfo_Release(decoderinfo);
187 IUnknown_Release(unkdecoderinfo);
188 IEnumUnknown_Release(enumdecoders);
189 *decoder = NULL;
190 return res;
191 }
192 }
193 }
194
195 IWICBitmapDecoderInfo_Release(decoderinfo);
196 }
197
198 IUnknown_Release(unkdecoderinfo);
199 }
200 else
201 break;
202 }
203
204 IEnumUnknown_Release(enumdecoders);
205
207}
GLuint res
Definition: glext.h:9613
@ WICDecoder
Definition: wincodec.idl:125

Referenced by ImagingFactory_CreateDecoderFromStream().

◆ get_16bpp_format()

static BOOL get_16bpp_format ( HBITMAP  hbm,
WICPixelFormatGUID format 
)
static

Definition at line 685 of file imgfactory.c.

686{
687 BOOL ret = TRUE;
688 BITMAPV4HEADER bmh;
689 HDC hdc;
690
692
693 memset(&bmh, 0, sizeof(bmh));
694 bmh.bV4Size = sizeof(bmh);
695 bmh.bV4Width = 1;
696 bmh.bV4Height = 1;
698 bmh.bV4BitCount = 16;
699
700 GetDIBits(hdc, hbm, 0, 0, NULL, (BITMAPINFO *)&bmh, DIB_RGB_COLORS);
701
702 if (bmh.bV4RedMask == 0x7c00 &&
703 bmh.bV4GreenMask == 0x3e0 &&
704 bmh.bV4BlueMask == 0x1f)
705 {
706 *format = GUID_WICPixelFormat16bppBGR555;
707 }
708 else if (bmh.bV4RedMask == 0xf800 &&
709 bmh.bV4GreenMask == 0x7e0 &&
710 bmh.bV4BlueMask == 0x1f)
711 {
712 *format = GUID_WICPixelFormat16bppBGR565;
713 }
714 else
715 {
716 FIXME("unrecognized bitfields %x,%x,%x\n", bmh.bV4RedMask,
717 bmh.bV4GreenMask, bmh.bV4BlueMask);
718 ret = FALSE;
719 }
720
721 DeleteDC(hdc);
722 return ret;
723}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define BI_BITFIELDS
Definition: mmreg.h:507
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define memset(x, y, z)
Definition: compat.h:39
DWORD bV4GreenMask
Definition: wingdi.h:1504
DWORD bV4V4Compression
Definition: wingdi.h:1497
LONG bV4Height
Definition: wingdi.h:1494
DWORD bV4RedMask
Definition: wingdi.h:1503
LONG bV4Width
Definition: wingdi.h:1493
WORD bV4BitCount
Definition: wingdi.h:1496
DWORD bV4BlueMask
Definition: wingdi.h:1505
DWORD bV4Size
Definition: wingdi.h:1492
int ret
#define DIB_RGB_COLORS
Definition: wingdi.h:367
int WINAPI GetDIBits(_In_ HDC hdc, _In_ HBITMAP hbm, _In_ UINT start, _In_ UINT cLines, _Out_opt_ LPVOID lpvBits, _At_((LPBITMAPINFOHEADER) lpbmi, _Inout_) LPBITMAPINFO lpbmi, _In_ UINT usage)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by ImagingFactory_CreateBitmapFromHBITMAP().

◆ ImagingFactory_AddRef()

static ULONG WINAPI ImagingFactory_AddRef ( IWICImagingFactory2 iface)
static

Definition at line 83 of file imgfactory.c.

84{
87
88 TRACE("(%p) refcount=%u\n", iface, ref);
89
90 return ref;
91}
#define InterlockedIncrement
Definition: armddk.h:53
static ImagingFactory * impl_from_IWICImagingFactory2(IWICImagingFactory2 *iface)
Definition: imgfactory.c:50
Definition: send.c:48

◆ ImagingFactory_CreateBitmap()

static HRESULT WINAPI ImagingFactory_CreateBitmap ( IWICImagingFactory2 iface,
UINT  uiWidth,
UINT  uiHeight,
REFWICPixelFormatGUID  pixelFormat,
WICBitmapCreateCacheOption  option,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 486 of file imgfactory.c.

489{
490 TRACE("(%p,%u,%u,%s,%u,%p)\n", iface, uiWidth, uiHeight,
491 debugstr_guid(pixelFormat), option, ppIBitmap);
492 return BitmapImpl_Create(uiWidth, uiHeight, 0, 0, NULL, 0, pixelFormat, option, ppIBitmap);
493}

◆ ImagingFactory_CreateBitmapClipper()

static HRESULT WINAPI ImagingFactory_CreateBitmapClipper ( IWICImagingFactory2 iface,
IWICBitmapClipper **  ppIBitmapClipper 
)
static

Definition at line 451 of file imgfactory.c.

453{
454 TRACE("(%p,%p)\n", iface, ppIBitmapClipper);
455 return BitmapClipper_Create(ppIBitmapClipper);
456}
HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper)
Definition: clipper.c:243

◆ ImagingFactory_CreateBitmapFlipRotator()

static HRESULT WINAPI ImagingFactory_CreateBitmapFlipRotator ( IWICImagingFactory2 iface,
IWICBitmapFlipRotator **  ppIBitmapFlipRotator 
)
static

Definition at line 458 of file imgfactory.c.

460{
461 TRACE("(%p,%p)\n", iface, ppIBitmapFlipRotator);
462 return FlipRotator_Create(ppIBitmapFlipRotator);
463}
HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator)
Definition: fliprotate.c:268

◆ ImagingFactory_CreateBitmapFromHBITMAP()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromHBITMAP ( IWICImagingFactory2 iface,
HBITMAP  hbm,
HPALETTE  hpal,
WICBitmapAlphaChannelOption  option,
IWICBitmap **  bitmap 
)
static

Definition at line 725 of file imgfactory.c.

727{
728 BITMAP bm;
729 HRESULT hr;
732 UINT size, num_palette_entries = 0;
733 PALETTEENTRY entry[256];
734
735 TRACE("(%p,%p,%p,%u,%p)\n", iface, hbm, hpal, option, bitmap);
736
737 if (!bitmap) return E_INVALIDARG;
738
739 if (GetObjectW(hbm, sizeof(bm), &bm) != sizeof(bm))
741
742 if (hpal)
743 {
744 num_palette_entries = GetPaletteEntries(hpal, 0, 256, entry);
745 if (!num_palette_entries)
747 }
748
749 /* TODO: Figure out the correct format for 16, 32, 64 bpp */
750 switch(bm.bmBitsPixel)
751 {
752 case 1:
753 format = GUID_WICPixelFormat1bppIndexed;
754 break;
755 case 4:
756 format = GUID_WICPixelFormat4bppIndexed;
757 break;
758 case 8:
759 format = GUID_WICPixelFormat8bppIndexed;
760 break;
761 case 16:
763 return E_INVALIDARG;
764 break;
765 case 24:
766 format = GUID_WICPixelFormat24bppBGR;
767 break;
768 case 32:
769 switch (option)
770 {
772 format = GUID_WICPixelFormat32bppBGRA;
773 break;
775 format = GUID_WICPixelFormat32bppPBGRA;
776 break;
778 format = GUID_WICPixelFormat32bppBGR;
779 break;
780 default:
781 return E_INVALIDARG;
782 }
783 break;
784 case 48:
785 format = GUID_WICPixelFormat48bppRGB;
786 break;
787 default:
788 FIXME("unsupported %d bpp\n", bm.bmBitsPixel);
789 return E_INVALIDARG;
790 }
791
792 hr = BitmapImpl_Create(bm.bmWidth, bm.bmHeight, bm.bmWidthBytes, 0, NULL, 0, &format,
794 if (hr != S_OK) return hr;
795
796 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
797 if (hr == S_OK)
798 {
799 BYTE *buffer;
800 HDC hdc;
801 char bmibuf[FIELD_OFFSET(BITMAPINFO, bmiColors) + 256 * sizeof(RGBQUAD)];
802 BITMAPINFO *bmi = (BITMAPINFO *)bmibuf;
803
804 IWICBitmapLock_GetDataPointer(lock, &size, &buffer);
805
807
808 bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
809 bmi->bmiHeader.biBitCount = 0;
810 GetDIBits(hdc, hbm, 0, 0, NULL, bmi, DIB_RGB_COLORS);
811 bmi->bmiHeader.biHeight = -bm.bmHeight;
812 GetDIBits(hdc, hbm, 0, bm.bmHeight, buffer, bmi, DIB_RGB_COLORS);
813
814 DeleteDC(hdc);
815 IWICBitmapLock_Release(lock);
816
817 if (num_palette_entries)
818 {
820 WICColor colors[256];
821 UINT i;
822
824 if (hr == S_OK)
825 {
826 for (i = 0; i < num_palette_entries; i++)
827 colors[i] = 0xff000000 | entry[i].peRed << 16 |
828 entry[i].peGreen << 8 | entry[i].peBlue;
829
830 hr = IWICPalette_InitializeCustom(palette, colors, num_palette_entries);
831 if (hr == S_OK)
832 hr = IWICBitmap_SetPalette(*bitmap, palette);
833
834 IWICPalette_Release(palette);
835 }
836 }
837 }
838
839 if (hr != S_OK)
840 {
841 IWICBitmap_Release(*bitmap);
842 *bitmap = NULL;
843 }
844
845 return hr;
846}
ULONG RGBQUAD
Definition: precomp.h:59
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL get_16bpp_format(HBITMAP hbm, WICPixelFormatGUID *format)
Definition: imgfactory.c:685
uint32_t entry
Definition: isohybrid.c:63
Definition: bl.h:1331
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
UINT32 WICColor
Definition: wincodec.idl:312
@ WICBitmapIgnoreAlpha
Definition: wincodec.idl:43
@ WICBitmapUseAlpha
Definition: wincodec.idl:41
@ WICBitmapUsePremultipliedAlpha
Definition: wincodec.idl:42
#define WINCODEC_ERR_WIN32ERROR
Definition: winerror.h:3319
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

◆ ImagingFactory_CreateBitmapFromHICON()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON ( IWICImagingFactory2 iface,
HICON  hicon,
IWICBitmap **  bitmap 
)
static

Definition at line 848 of file imgfactory.c.

850{
853 BITMAP bm;
854 int width, height, x, y;
856 BYTE *buffer;
857 DWORD *bits;
858 BITMAPINFO bi;
859 HDC hdc;
860 BOOL has_alpha;
861 HRESULT hr;
862
863 TRACE("(%p,%p,%p)\n", iface, hicon, bitmap);
864
865 if (!bitmap) return E_INVALIDARG;
866
867 if (!GetIconInfo(hicon, &info))
869
870 GetObjectW(info.hbmColor ? info.hbmColor : info.hbmMask, sizeof(bm), &bm);
871
872 width = bm.bmWidth;
873 height = info.hbmColor ? abs(bm.bmHeight) : abs(bm.bmHeight) / 2;
874 stride = width * 4;
875 size = stride * height;
876
878 &GUID_WICPixelFormat32bppBGRA, WICBitmapCacheOnLoad, bitmap);
879 if (hr != S_OK) goto failed;
880
881 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
882 if (hr != S_OK)
883 {
884 IWICBitmap_Release(*bitmap);
885 goto failed;
886 }
887 IWICBitmapLock_GetDataPointer(lock, &size, &buffer);
888
890
891 memset(&bi, 0, sizeof(bi));
892 bi.bmiHeader.biSize = sizeof(bi.bmiHeader);
894 bi.bmiHeader.biHeight = info.hbmColor ? -height: -height * 2;
895 bi.bmiHeader.biPlanes = 1;
896 bi.bmiHeader.biBitCount = 32;
898
899 has_alpha = FALSE;
900
901 if (info.hbmColor)
902 {
903 GetDIBits(hdc, info.hbmColor, 0, height, buffer, &bi, DIB_RGB_COLORS);
904
905 if (bm.bmBitsPixel == 32)
906 {
907 /* If any pixel has a non-zero alpha, ignore hbmMask */
908 bits = (DWORD *)buffer;
909 for (x = 0; x < width && !has_alpha; x++, bits++)
910 {
911 for (y = 0; y < height; y++)
912 {
913 if (*bits & 0xff000000)
914 {
915 has_alpha = TRUE;
916 break;
917 }
918 }
919 }
920 }
921 }
922 else
923 GetDIBits(hdc, info.hbmMask, 0, height, buffer, &bi, DIB_RGB_COLORS);
924
925 if (!has_alpha)
926 {
927 DWORD *rgba;
928
929 if (info.hbmMask)
930 {
931 BYTE *mask;
932
934 if (!mask)
935 {
936 IWICBitmapLock_Release(lock);
937 IWICBitmap_Release(*bitmap);
938 DeleteDC(hdc);
940 goto failed;
941 }
942
943 /* read alpha data from the mask */
944 GetDIBits(hdc, info.hbmMask, info.hbmColor ? 0 : height, height, mask, &bi, DIB_RGB_COLORS);
945
946 for (y = 0; y < height; y++)
947 {
948 rgba = (DWORD *)(buffer + y * stride);
949 bits = (DWORD *)(mask + y * stride);
950
951 for (x = 0; x < width; x++, rgba++, bits++)
952 {
953 if (*bits)
954 *rgba = 0;
955 else
956 *rgba |= 0xff000000;
957 }
958 }
959
961 }
962 else
963 {
964 /* set constant alpha of 255 */
965 for (y = 0; y < height; y++)
966 {
967 rgba = (DWORD *)(buffer + y * stride);
968 for (x = 0; x < width; x++, rgba++)
969 *rgba |= 0xff000000;
970 }
971 }
972
973 }
974
975 IWICBitmapLock_Release(lock);
976 DeleteDC(hdc);
977
978failed:
979 DeleteObject(info.hbmColor);
980 DeleteObject(info.hbmMask);
981
982 return hr;
983}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define BI_RGB
Definition: precomp.h:56
#define abs(i)
Definition: fconv.c:206
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15
USHORT biBitCount
Definition: precomp.h:46
ULONG biCompression
Definition: precomp.h:47
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
BOOL WINAPI GetIconInfo(_In_ HICON, _Out_ PICONINFO)
Definition: cursoricon.c:2097

◆ ImagingFactory_CreateBitmapFromMemory()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromMemory ( IWICImagingFactory2 iface,
UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
UINT  stride,
UINT  size,
BYTE buffer,
IWICBitmap **  bitmap 
)
static

Definition at line 649 of file imgfactory.c.

652{
653 HRESULT hr;
654
655 TRACE("(%p,%u,%u,%s,%u,%u,%p,%p\n", iface, width, height,
657
658 if (!stride || !size || !buffer || !bitmap) return E_INVALIDARG;
659
661 if (SUCCEEDED(hr))
662 {
664
665 hr = IWICBitmap_Lock(*bitmap, NULL, WICBitmapLockWrite, &lock);
666 if (SUCCEEDED(hr))
667 {
668 UINT buffersize;
669 BYTE *data;
670
671 IWICBitmapLock_GetDataPointer(lock, &buffersize, &data);
672 memcpy(data, buffer, buffersize);
673
674 IWICBitmapLock_Release(lock);
675 }
676 else
677 {
678 IWICBitmap_Release(*bitmap);
679 *bitmap = NULL;
680 }
681 }
682 return hr;
683}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

◆ ImagingFactory_CreateBitmapFromSource()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromSource ( IWICImagingFactory2 iface,
IWICBitmapSource piBitmapSource,
WICBitmapCreateCacheOption  option,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 623 of file imgfactory.c.

626{
627 TRACE("(%p,%p,%u,%p)\n", iface, piBitmapSource, option, ppIBitmap);
628
629 return create_bitmap_from_source_rect(piBitmapSource, NULL, option, ppIBitmap);
630}
static HRESULT create_bitmap_from_source_rect(IWICBitmapSource *piBitmapSource, const WICRect *rect, WICBitmapCreateCacheOption option, IWICBitmap **ppIBitmap)
Definition: imgfactory.c:495

◆ ImagingFactory_CreateBitmapFromSourceRect()

static HRESULT WINAPI ImagingFactory_CreateBitmapFromSourceRect ( IWICImagingFactory2 iface,
IWICBitmapSource piBitmapSource,
UINT  x,
UINT  y,
UINT  width,
UINT  height,
IWICBitmap **  ppIBitmap 
)
static

Definition at line 632 of file imgfactory.c.

635{
637
638 TRACE("(%p,%p,%u,%u,%u,%u,%p)\n", iface, piBitmapSource, x, y, width,
639 height, ppIBitmap);
640
641 rect.X = x;
642 rect.Y = y;
643 rect.Width = width;
644 rect.Height = height;
645
646 return create_bitmap_from_source_rect(piBitmapSource, &rect, WICBitmapCacheOnLoad, ppIBitmap);
647}

◆ ImagingFactory_CreateBitmapScaler()

static HRESULT WINAPI ImagingFactory_CreateBitmapScaler ( IWICImagingFactory2 iface,
IWICBitmapScaler **  ppIBitmapScaler 
)
static

Definition at line 443 of file imgfactory.c.

445{
446 TRACE("(%p,%p)\n", iface, ppIBitmapScaler);
447
448 return BitmapScaler_Create(ppIBitmapScaler);
449}
HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler)
Definition: scaler.c:515

◆ ImagingFactory_CreateColorContext()

static HRESULT WINAPI ImagingFactory_CreateColorContext ( IWICImagingFactory2 iface,
IWICColorContext **  ppIColorContext 
)
static

Definition at line 472 of file imgfactory.c.

474{
475 TRACE("(%p,%p)\n", iface, ppIColorContext);
476 return ColorContext_Create(ppIColorContext);
477}
HRESULT ColorContext_Create(IWICColorContext **colorcontext)
Definition: colorcontext.c:258

◆ ImagingFactory_CreateColorTransformer()

static HRESULT WINAPI ImagingFactory_CreateColorTransformer ( IWICImagingFactory2 iface,
IWICColorTransform **  ppIColorTransform 
)
static

Definition at line 479 of file imgfactory.c.

481{
482 TRACE("(%p,%p)\n", iface, ppIColorTransform);
483 return ColorTransform_Create(ppIColorTransform);
484}
HRESULT ColorTransform_Create(IWICColorTransform **colortransform)

◆ ImagingFactory_CreateComponentEnumerator()

static HRESULT WINAPI ImagingFactory_CreateComponentEnumerator ( IWICImagingFactory2 iface,
DWORD  componentTypes,
DWORD  options,
IEnumUnknown **  ppIEnumUnknown 
)
static

Definition at line 985 of file imgfactory.c.

987{
988 TRACE("(%p,%u,%u,%p)\n", iface, componentTypes, options, ppIEnumUnknown);
989 return CreateComponentEnumerator(componentTypes, options, ppIEnumUnknown);
990}

◆ ImagingFactory_CreateComponentInfo()

static HRESULT WINAPI ImagingFactory_CreateComponentInfo ( IWICImagingFactory2 iface,
REFCLSID  clsidComponent,
IWICComponentInfo **  ppIInfo 
)
static

Definition at line 275 of file imgfactory.c.

277{
278 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(clsidComponent), ppIInfo);
279 return CreateComponentInfo(clsidComponent, ppIInfo);
280}

◆ ImagingFactory_CreateDecoder()

static HRESULT WINAPI ImagingFactory_CreateDecoder ( IWICImagingFactory2 iface,
REFGUID  guidContainerFormat,
const GUID pguidVendor,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 282 of file imgfactory.c.

285{
286 IEnumUnknown *enumdecoders;
287 IUnknown *unkdecoderinfo;
288 IWICBitmapDecoderInfo *decoderinfo;
289 IWICBitmapDecoder *decoder = NULL, *preferred_decoder = NULL;
290 GUID vendor;
291 HRESULT res;
292 ULONG num_fetched;
293
294 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
295 debugstr_guid(pguidVendor), ppIDecoder);
296
297 if (!guidContainerFormat || !ppIDecoder) return E_INVALIDARG;
298
300 if (FAILED(res)) return res;
301
302 while (!preferred_decoder)
303 {
304 res = IEnumUnknown_Next(enumdecoders, 1, &unkdecoderinfo, &num_fetched);
305 if (res != S_OK) break;
306
307 res = IUnknown_QueryInterface(unkdecoderinfo, &IID_IWICBitmapDecoderInfo, (void **)&decoderinfo);
308 if (SUCCEEDED(res))
309 {
310 GUID container_guid;
311
312 res = IWICBitmapDecoderInfo_GetContainerFormat(decoderinfo, &container_guid);
313 if (SUCCEEDED(res) && IsEqualIID(&container_guid, guidContainerFormat))
314 {
315 IWICBitmapDecoder *new_decoder;
316
317 res = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &new_decoder);
318 if (SUCCEEDED(res))
319 {
320 if (pguidVendor)
321 {
322 res = IWICBitmapDecoderInfo_GetVendorGUID(decoderinfo, &vendor);
323 if (SUCCEEDED(res) && IsEqualIID(&vendor, pguidVendor))
324 {
325 preferred_decoder = new_decoder;
326 new_decoder = NULL;
327 }
328 }
329
330 if (new_decoder && !decoder)
331 {
332 decoder = new_decoder;
333 new_decoder = NULL;
334 }
335
336 if (new_decoder) IWICBitmapDecoder_Release(new_decoder);
337 }
338 }
339
340 IWICBitmapDecoderInfo_Release(decoderinfo);
341 }
342
343 IUnknown_Release(unkdecoderinfo);
344 }
345
346 IEnumUnknown_Release(enumdecoders);
347
348 if (preferred_decoder)
349 {
350 *ppIDecoder = preferred_decoder;
351 if (decoder) IWICBitmapDecoder_Release(decoder);
352 return S_OK;
353 }
354
355 if (decoder)
356 {
357 *ppIDecoder = decoder;
358 return S_OK;
359 }
360
361 *ppIDecoder = NULL;
363}

◆ ImagingFactory_CreateDecoderFromFileHandle()

static HRESULT WINAPI ImagingFactory_CreateDecoderFromFileHandle ( IWICImagingFactory2 iface,
ULONG_PTR  hFile,
const GUID pguidVendor,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 251 of file imgfactory.c.

254{
256 HRESULT hr;
257
258 TRACE("(%p,%lx,%s,%u,%p)\n", iface, hFile, debugstr_guid(pguidVendor),
259 metadataOptions, ppIDecoder);
260
262 if (SUCCEEDED(hr))
263 {
265 if (SUCCEEDED(hr))
266 {
267 hr = IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream,
268 pguidVendor, metadataOptions, ppIDecoder);
269 }
270 IWICStream_Release(stream);
271 }
272 return hr;
273}
HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE file)
Definition: stream.c:1039
HRESULT StreamImpl_Create(IWICStream **stream)
Definition: stream.c:1150

◆ ImagingFactory_CreateDecoderFromFilename()

static HRESULT WINAPI ImagingFactory_CreateDecoderFromFilename ( IWICImagingFactory2 iface,
LPCWSTR  wzFilename,
const GUID pguidVendor,
DWORD  dwDesiredAccess,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 106 of file imgfactory.c.

110{
112 HRESULT hr;
113
114 TRACE("(%p,%s,%s,%u,%u,%p)\n", iface, debugstr_w(wzFilename),
115 debugstr_guid(pguidVendor), dwDesiredAccess, metadataOptions, ppIDecoder);
116
118 if (SUCCEEDED(hr))
119 {
120 hr = IWICStream_InitializeFromFilename(stream, wzFilename, dwDesiredAccess);
121
122 if (SUCCEEDED(hr))
123 {
124 hr = IWICImagingFactory2_CreateDecoderFromStream(iface, (IStream*)stream,
125 pguidVendor, metadataOptions, ppIDecoder);
126 }
127
128 IWICStream_Release(stream);
129 }
130
131 return hr;
132}
#define debugstr_w
Definition: kernel32.h:32

◆ ImagingFactory_CreateDecoderFromStream()

static HRESULT WINAPI ImagingFactory_CreateDecoderFromStream ( IWICImagingFactory2 iface,
IStream pIStream,
const GUID pguidVendor,
WICDecodeOptions  metadataOptions,
IWICBitmapDecoder **  ppIDecoder 
)
static

Definition at line 209 of file imgfactory.c.

212{
213 HRESULT res;
214 IWICBitmapDecoder *decoder = NULL;
215
216 TRACE("(%p,%p,%s,%u,%p)\n", iface, pIStream, debugstr_guid(pguidVendor),
217 metadataOptions, ppIDecoder);
218
219 if (pguidVendor)
220 res = find_decoder(pIStream, pguidVendor, metadataOptions, &decoder);
221 if (!decoder)
222 res = find_decoder(pIStream, NULL, metadataOptions, &decoder);
223
224 if (decoder)
225 {
226 *ppIDecoder = decoder;
227 return S_OK;
228 }
229 else
230 {
231 if (WARN_ON(wincodecs))
232 {
234 BYTE data[4];
235 ULONG bytesread;
236
237 WARN("failed to load from a stream %#x\n", res);
238
239 seek.QuadPart = 0;
240 if (IStream_Seek(pIStream, seek, STREAM_SEEK_SET, NULL) == S_OK)
241 {
242 if (IStream_Read(pIStream, data, 4, &bytesread) == S_OK)
243 WARN("first %i bytes of stream=%x %x %x %x\n", bytesread, data[0], data[1], data[2], data[3]);
244 }
245 }
246 *ppIDecoder = NULL;
247 return res;
248 }
249}
#define WARN(fmt,...)
Definition: precomp.h:61
static HRESULT find_decoder(IStream *pIStream, const GUID *pguidVendor, WICDecodeOptions metadataOptions, IWICBitmapDecoder **decoder)
Definition: imgfactory.c:134
#define WARN_ON(c)
Definition: module.h:257
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51

◆ ImagingFactory_CreateEncoder()

static HRESULT WINAPI ImagingFactory_CreateEncoder ( IWICImagingFactory2 iface,
REFGUID  guidContainerFormat,
const GUID pguidVendor,
IWICBitmapEncoder **  ppIEncoder 
)
static

Definition at line 365 of file imgfactory.c.

368{
369 static int fixme=0;
370 IEnumUnknown *enumencoders;
371 IUnknown *unkencoderinfo;
372 IWICBitmapEncoderInfo *encoderinfo;
373 IWICBitmapEncoder *encoder=NULL;
375 ULONG num_fetched;
376 GUID actual_containerformat;
377
378 TRACE("(%p,%s,%s,%p)\n", iface, debugstr_guid(guidContainerFormat),
379 debugstr_guid(pguidVendor), ppIEncoder);
380
381 if (pguidVendor && !fixme++)
382 FIXME("ignoring vendor GUID\n");
383
385 if (FAILED(res)) return res;
386
387 while (!encoder)
388 {
389 res = IEnumUnknown_Next(enumencoders, 1, &unkencoderinfo, &num_fetched);
390
391 if (res == S_OK)
392 {
393 res = IUnknown_QueryInterface(unkencoderinfo, &IID_IWICBitmapEncoderInfo, (void**)&encoderinfo);
394
395 if (SUCCEEDED(res))
396 {
397 res = IWICBitmapEncoderInfo_GetContainerFormat(encoderinfo, &actual_containerformat);
398
399 if (SUCCEEDED(res) && IsEqualGUID(guidContainerFormat, &actual_containerformat))
400 {
401 res = IWICBitmapEncoderInfo_CreateInstance(encoderinfo, &encoder);
402 if (FAILED(res))
403 encoder = NULL;
404 }
405
406 IWICBitmapEncoderInfo_Release(encoderinfo);
407 }
408
409 IUnknown_Release(unkencoderinfo);
410 }
411 else
412 break;
413 }
414
415 IEnumUnknown_Release(enumencoders);
416
417 if (encoder)
418 {
419 *ppIEncoder = encoder;
420 return S_OK;
421 }
422 else
423 {
424 WARN("failed to create encoder\n");
425 *ppIEncoder = NULL;
427 }
428}
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
@ WICEncoder
Definition: wincodec.idl:126

◆ ImagingFactory_CreateFastMetadataEncoderFromDecoder()

static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromDecoder ( IWICImagingFactory2 iface,
IWICBitmapDecoder pIDecoder,
IWICFastMetadataEncoder **  ppIFastEncoder 
)
static

Definition at line 992 of file imgfactory.c.

995{
996 FIXME("(%p,%p,%p): stub\n", iface, pIDecoder, ppIFastEncoder);
997 return E_NOTIMPL;
998}

◆ ImagingFactory_CreateFastMetadataEncoderFromFrameDecode()

static HRESULT WINAPI ImagingFactory_CreateFastMetadataEncoderFromFrameDecode ( IWICImagingFactory2 iface,
IWICBitmapFrameDecode pIFrameDecoder,
IWICFastMetadataEncoder **  ppIFastEncoder 
)
static

Definition at line 1000 of file imgfactory.c.

1003{
1004 FIXME("(%p,%p,%p): stub\n", iface, pIFrameDecoder, ppIFastEncoder);
1005 return E_NOTIMPL;
1006}

◆ ImagingFactory_CreateFormatConverter()

static HRESULT WINAPI ImagingFactory_CreateFormatConverter ( IWICImagingFactory2 iface,
IWICFormatConverter **  ppIFormatConverter 
)
static

Definition at line 437 of file imgfactory.c.

439{
440 return FormatConverter_CreateInstance(&IID_IWICFormatConverter, (void**)ppIFormatConverter);
441}
HRESULT FormatConverter_CreateInstance(REFIID iid, void **ppv)
Definition: converter.c:1835

◆ ImagingFactory_CreateImageEncoder()

static HRESULT WINAPI ImagingFactory_CreateImageEncoder ( IWICImagingFactory2 iface,
ID2D1Device *  device,
IWICImageEncoder **  encoder 
)
static

Definition at line 1027 of file imgfactory.c.

1028{
1029 FIXME("%p,%p,%p stub.\n", iface, device, encoder);
1030 return E_NOTIMPL;
1031}
Definition: devices.h:37

◆ ImagingFactory_CreateInstance()

HRESULT ImagingFactory_CreateInstance ( REFIID  iid,
void **  ppv 
)

Definition at line 1470 of file imgfactory.c.

1471{
1473 HRESULT ret;
1474
1475 TRACE("(%s,%p)\n", debugstr_guid(iid), ppv);
1476
1477 *ppv = NULL;
1478
1479 This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1480 if (!This) return E_OUTOFMEMORY;
1481
1482 This->IWICImagingFactory2_iface.lpVtbl = &ImagingFactory_Vtbl;
1483 This->IWICComponentFactory_iface.lpVtbl = &ComponentFactory_Vtbl;
1484 This->ref = 1;
1485
1486 ret = IWICImagingFactory2_QueryInterface(&This->IWICImagingFactory2_iface, iid, ppv);
1487 IWICImagingFactory2_Release(&This->IWICImagingFactory2_iface);
1488
1489 return ret;
1490}
static const IWICImagingFactory2Vtbl ImagingFactory_Vtbl
Definition: imgfactory.c:1034
static const IWICComponentFactoryVtbl ComponentFactory_Vtbl
Definition: imgfactory.c:1432

Referenced by PaletteImpl_InitializeFromBitmap(), and WICCreateImagingFactory_Proxy().

◆ ImagingFactory_CreatePalette()

static HRESULT WINAPI ImagingFactory_CreatePalette ( IWICImagingFactory2 iface,
IWICPalette **  ppIPalette 
)
static

Definition at line 430 of file imgfactory.c.

432{
433 TRACE("(%p,%p)\n", iface, ppIPalette);
434 return PaletteImpl_Create(ppIPalette);
435}

◆ ImagingFactory_CreateQueryWriter()

static HRESULT WINAPI ImagingFactory_CreateQueryWriter ( IWICImagingFactory2 iface,
REFGUID  guidMetadataFormat,
const GUID pguidVendor,
IWICMetadataQueryWriter **  ppIQueryWriter 
)
static

Definition at line 1008 of file imgfactory.c.

1011{
1012 FIXME("(%p,%s,%s,%p): stub\n", iface, debugstr_guid(guidMetadataFormat),
1013 debugstr_guid(pguidVendor), ppIQueryWriter);
1014 return E_NOTIMPL;
1015}

◆ ImagingFactory_CreateQueryWriterFromReader()

static HRESULT WINAPI ImagingFactory_CreateQueryWriterFromReader ( IWICImagingFactory2 iface,
IWICMetadataQueryReader pIQueryReader,
const GUID pguidVendor,
IWICMetadataQueryWriter **  ppIQueryWriter 
)
static

Definition at line 1017 of file imgfactory.c.

1020{
1021 FIXME("(%p,%p,%s,%p): stub\n", iface, pIQueryReader, debugstr_guid(pguidVendor),
1022 ppIQueryWriter);
1023 return E_NOTIMPL;
1024}

◆ ImagingFactory_CreateStream()

static HRESULT WINAPI ImagingFactory_CreateStream ( IWICImagingFactory2 iface,
IWICStream **  ppIWICStream 
)
static

Definition at line 465 of file imgfactory.c.

467{
468 TRACE("(%p,%p)\n", iface, ppIWICStream);
469 return StreamImpl_Create(ppIWICStream);
470}

◆ ImagingFactory_QueryInterface()

static HRESULT WINAPI ImagingFactory_QueryInterface ( IWICImagingFactory2 iface,
REFIID  iid,
void **  ppv 
)
static

Definition at line 55 of file imgfactory.c.

57{
59 TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
60
61 if (!ppv) return E_INVALIDARG;
62
63 if (IsEqualIID(&IID_IUnknown, iid) ||
64 IsEqualIID(&IID_IWICImagingFactory, iid) ||
65 IsEqualIID(&IID_IWICComponentFactory, iid))
66 {
67 *ppv = &This->IWICComponentFactory_iface;
68 }
69 else if (IsEqualIID(&IID_IWICImagingFactory2, iid))
70 {
71 *ppv = &This->IWICImagingFactory2_iface;
72 }
73 else
74 {
75 *ppv = NULL;
76 return E_NOINTERFACE;
77 }
78
79 IUnknown_AddRef((IUnknown*)*ppv);
80 return S_OK;
81}
const GUID IID_IUnknown
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ImagingFactory_Release()

static ULONG WINAPI ImagingFactory_Release ( IWICImagingFactory2 iface)
static

Definition at line 93 of file imgfactory.c.

94{
97
98 TRACE("(%p) refcount=%u\n", iface, ref);
99
100 if (ref == 0)
102
103 return ref;
104}
#define InterlockedDecrement
Definition: armddk.h:52

◆ impl_from_IWICComponentFactory()

◆ impl_from_IWICImagingFactory2()

static ImagingFactory * impl_from_IWICImagingFactory2 ( IWICImagingFactory2 iface)
inlinestatic

Definition at line 50 of file imgfactory.c.

51{
52 return CONTAINING_RECORD(iface, ImagingFactory, IWICImagingFactory2_iface);
53}

Referenced by ImagingFactory_AddRef(), ImagingFactory_QueryInterface(), and ImagingFactory_Release().

◆ WICCreateBitmapFromSection()

HRESULT WINAPI WICCreateBitmapFromSection ( UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
HANDLE  section,
UINT  stride,
UINT  offset,
IWICBitmap **  bitmap 
)

Definition at line 1541 of file imgfactory.c.

1544{
1545 TRACE("%u,%u,%s,%p,%u,%u,%p\n", width, height, debugstr_guid(format),
1547
1550}
GLintptr offset
Definition: glext.h:5920
HRESULT WINAPI WICCreateBitmapFromSectionEx(UINT width, UINT height, REFWICPixelFormatGUID format, HANDLE section, UINT stride, UINT offset, WICSectionAccessLevel wicaccess, IWICBitmap **bitmap)
Definition: imgfactory.c:1492
Definition: parser.c:56
@ WICSectionAccessLevelRead
Definition: wincodec.idl:191

◆ WICCreateBitmapFromSectionEx()

HRESULT WINAPI WICCreateBitmapFromSectionEx ( UINT  width,
UINT  height,
REFWICPixelFormatGUID  format,
HANDLE  section,
UINT  stride,
UINT  offset,
WICSectionAccessLevel  wicaccess,
IWICBitmap **  bitmap 
)

Definition at line 1492 of file imgfactory.c.

1495{
1497 UINT bpp, access, size, view_offset, view_size;
1498 void *view;
1499 HRESULT hr;
1500
1501 TRACE("%u,%u,%s,%p,%u,%u,%#x,%p\n", width, height, debugstr_guid(format),
1502 section, stride, offset, wicaccess, bitmap);
1503
1504 if (!width || !height || !section || !bitmap) return E_INVALIDARG;
1505
1507 if (FAILED(hr)) return hr;
1508
1509 switch (wicaccess)
1510 {
1513 break;
1514
1517 break;
1518
1519 default:
1520 FIXME("unsupported access %#x\n", wicaccess);
1521 return E_INVALIDARG;
1522 }
1523
1524 if (!stride) stride = (((bpp * width) + 31) / 32) * 4;
1525 size = stride * height;
1526 if (size / height != stride) return E_INVALIDARG;
1527
1529 view_offset = offset - (offset % sysinfo.dwAllocationGranularity);
1530 view_size = size + (offset - view_offset);
1531
1532 view = MapViewOfFile(section, access, 0, view_offset, view_size);
1533 if (!view) return HRESULT_FROM_WIN32(GetLastError());
1534
1535 offset -= view_offset;
1538 return hr;
1539}
DWORD bpp
Definition: surface.c:185
#define UnmapViewOfFile
Definition: compat.h:746
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
SYSTEM_INFO sysinfo
Definition: dbghelp.c:76
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
Definition: main.c:252
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
DWORD dwAllocationGranularity
Definition: winbase.h:1204
#define FILE_MAP_WRITE
Definition: winbase.h:155
@ WICSectionAccessLevelReadWrite
Definition: wincodec.idl:192

Referenced by WICCreateBitmapFromSection().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wincodecs  )

Variable Documentation

◆ ComponentFactory_Vtbl

const IWICComponentFactoryVtbl ComponentFactory_Vtbl
static

Definition at line 1432 of file imgfactory.c.

Referenced by ImagingFactory_CreateInstance().

◆ ImagingFactory_Vtbl

const IWICImagingFactory2Vtbl ImagingFactory_Vtbl
static

Definition at line 1034 of file imgfactory.c.

Referenced by ImagingFactory_CreateInstance().