Commit fb356a3e authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

windowscodecs: Add stub TIFF encoder.

parent 562267a7
......@@ -53,6 +53,7 @@ static classinfo wic_classes[] = {
{&CLSID_WICIcoDecoder, IcoDecoder_CreateInstance},
{&CLSID_WICJpegDecoder, JpegDecoder_CreateInstance},
{&CLSID_WICTiffDecoder, TiffDecoder_CreateInstance},
{&CLSID_WICTiffEncoder, TiffEncoder_CreateInstance},
{&CLSID_WICIcnsEncoder, IcnsEncoder_CreateInstance},
{&CLSID_WICDefaultFormatConverter, FormatConverter_CreateInstance},
{&CLSID_WineTgaDecoder, TgaDecoder_CreateInstance},
......
......@@ -761,12 +761,13 @@ static struct decoder_pattern const png_patterns[] = {
static const BYTE tiff_magic_le[] = {0x49,0x49,42,0};
static const BYTE tiff_magic_be[] = {0x4d,0x4d,0,42};
static GUID const * const tiff_formats[] = {
static GUID const * const tiff_decode_formats[] = {
&GUID_WICPixelFormatBlackWhite,
&GUID_WICPixelFormat4bppGray,
&GUID_WICPixelFormat8bppGray,
&GUID_WICPixelFormat4bppIndexed,
&GUID_WICPixelFormat8bppIndexed,
&GUID_WICPixelFormat24bppBGR,
&GUID_WICPixelFormat32bppBGR,
&GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat32bppPBGRA,
......@@ -870,7 +871,7 @@ static struct regsvr_decoder const decoder_list[] = {
&GUID_VendorMicrosoft,
"image/tiff",
".tif;.tiff",
tiff_formats,
tiff_decode_formats,
tiff_patterns
},
{ &CLSID_WineTgaDecoder,
......@@ -908,6 +909,19 @@ static GUID const * const png_encode_formats[] = {
NULL
};
static GUID const * const tiff_encode_formats[] = {
&GUID_WICPixelFormatBlackWhite,
&GUID_WICPixelFormat4bppGray,
&GUID_WICPixelFormat8bppGray,
&GUID_WICPixelFormat24bppBGR,
&GUID_WICPixelFormat32bppBGRA,
&GUID_WICPixelFormat32bppPBGRA,
&GUID_WICPixelFormat48bppRGB,
&GUID_WICPixelFormat64bppRGBA,
&GUID_WICPixelFormat64bppPRGBA,
NULL
};
static GUID const * const icns_encode_formats[] = {
&GUID_WICPixelFormat32bppBGRA,
NULL
......@@ -932,6 +946,15 @@ static struct regsvr_encoder const encoder_list[] = {
".png",
png_encode_formats
},
{ &CLSID_WICTiffEncoder,
"The Wine Project",
"TIFF Encoder",
"1.0.0.0",
&GUID_VendorMicrosoft,
"image/tiff",
".tif;.tiff",
tiff_encode_formats
},
{ &CLSID_WICIcnsEncoder,
"The Wine Project",
"ICNS Encoder",
......
......@@ -1114,6 +1114,175 @@ HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
return ret;
}
typedef struct TiffEncoder {
IWICBitmapEncoder IWICBitmapEncoder_iface;
LONG ref;
} TiffEncoder;
static inline TiffEncoder *impl_from_IWICBitmapEncoder(IWICBitmapEncoder *iface)
{
return CONTAINING_RECORD(iface, TiffEncoder, IWICBitmapEncoder_iface);
}
static HRESULT WINAPI TiffEncoder_QueryInterface(IWICBitmapEncoder *iface, REFIID iid,
void **ppv)
{
TiffEncoder *This = impl_from_IWICBitmapEncoder(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapEncoder, iid))
{
*ppv = This;
}
else
{
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI TiffEncoder_AddRef(IWICBitmapEncoder *iface)
{
TiffEncoder *This = impl_from_IWICBitmapEncoder(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
return ref;
}
static ULONG WINAPI TiffEncoder_Release(IWICBitmapEncoder *iface)
{
TiffEncoder *This = impl_from_IWICBitmapEncoder(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", iface, ref);
if (ref == 0)
{
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI TiffEncoder_Initialize(IWICBitmapEncoder *iface,
IStream *pIStream, WICBitmapEncoderCacheOption cacheOption)
{
FIXME("(%p,%p,%u): stub\n", iface, pIStream, cacheOption);
return E_NOTIMPL;
}
static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
GUID *pguidContainerFormat)
{
FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
return E_NOTIMPL;
}
static HRESULT WINAPI TiffEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
IWICBitmapEncoderInfo **ppIEncoderInfo)
{
FIXME("(%p,%p): stub\n", iface, ppIEncoderInfo);
return E_NOTIMPL;
}
static HRESULT WINAPI TiffEncoder_SetColorContexts(IWICBitmapEncoder *iface,
UINT cCount, IWICColorContext **ppIColorContext)
{
FIXME("(%p,%u,%p): stub\n", iface, cCount, ppIColorContext);
return E_NOTIMPL;
}
static HRESULT WINAPI TiffEncoder_SetPalette(IWICBitmapEncoder *iface, IWICPalette *pIPalette)
{
TRACE("(%p,%p)\n", iface, pIPalette);
return WINCODEC_ERR_UNSUPPORTEDOPERATION;
}
static HRESULT WINAPI TiffEncoder_SetThumbnail(IWICBitmapEncoder *iface, IWICBitmapSource *pIThumbnail)
{
TRACE("(%p,%p)\n", iface, pIThumbnail);
return WINCODEC_ERR_UNSUPPORTEDOPERATION;
}
static HRESULT WINAPI TiffEncoder_SetPreview(IWICBitmapEncoder *iface, IWICBitmapSource *pIPreview)
{
TRACE("(%p,%p)\n", iface, pIPreview);
return WINCODEC_ERR_UNSUPPORTEDOPERATION;
}
static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
IWICBitmapFrameEncode **ppIFrameEncode, IPropertyBag2 **ppIEncoderOptions)
{
FIXME("(%p,%p,%p): stub\n", iface, ppIFrameEncode, ppIEncoderOptions);
return E_NOTIMPL;
}
static HRESULT WINAPI TiffEncoder_Commit(IWICBitmapEncoder *iface)
{
FIXME("(%p): stub\n", iface);
return E_NOTIMPL;
}
static HRESULT WINAPI TiffEncoder_GetMetadataQueryWriter(IWICBitmapEncoder *iface,
IWICMetadataQueryWriter **ppIMetadataQueryWriter)
{
FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryWriter);
return E_NOTIMPL;
}
static const IWICBitmapEncoderVtbl TiffEncoder_Vtbl = {
TiffEncoder_QueryInterface,
TiffEncoder_AddRef,
TiffEncoder_Release,
TiffEncoder_Initialize,
TiffEncoder_GetContainerFormat,
TiffEncoder_GetEncoderInfo,
TiffEncoder_SetColorContexts,
TiffEncoder_SetPalette,
TiffEncoder_SetThumbnail,
TiffEncoder_SetPreview,
TiffEncoder_CreateNewFrame,
TiffEncoder_Commit,
TiffEncoder_GetMetadataQueryWriter
};
HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
{
TiffEncoder *This;
HRESULT ret;
TRACE("(%p,%s,%p)\n", pUnkOuter, debugstr_guid(iid), ppv);
*ppv = NULL;
if (pUnkOuter) return CLASS_E_NOAGGREGATION;
if (!load_libtiff())
{
ERR("Failed writing TIFF because unable to load %s\n",SONAME_LIBTIFF);
return E_FAIL;
}
This = HeapAlloc(GetProcessHeap(), 0, sizeof(TiffEncoder));
if (!This) return E_OUTOFMEMORY;
This->IWICBitmapEncoder_iface.lpVtbl = &TiffEncoder_Vtbl;
This->ref = 1;
ret = IUnknown_QueryInterface((IUnknown*)This, iid, ppv);
IUnknown_Release((IUnknown*)This);
return ret;
}
#else /* !SONAME_LIBTIFF */
HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
......@@ -1122,4 +1291,10 @@ HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
return E_FAIL;
}
HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
{
ERR("Trying to save TIFF picture, but Wine was compiled without TIFF support.\n");
return E_FAIL;
}
#endif
......@@ -38,6 +38,7 @@ extern HRESULT GifDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID riid, void*
extern HRESULT IcoDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
extern HRESULT JpegDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
extern HRESULT TiffDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
extern HRESULT TiffEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
extern HRESULT IcnsEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
extern HRESULT TgaDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv);
......
......@@ -82,6 +82,13 @@ coclass WICJpegDecoder { interface IWICBitmapDecoder; }
coclass WICTiffDecoder { interface IWICBitmapDecoder; }
[
helpstring("WIC TIFF Encoder"),
threading(both),
uuid(0131be10-2001-4c5f-a9b0-cc88fab64ce8)
]
coclass WICTiffEncoder { interface IWICBitmapEncoder; }
[
helpstring("WIC ICNS Encoder"),
threading(both),
uuid(312fb6f1-b767-409d-8a6d-0fc154d4f05c)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment