28#include "wincodecsdk.h"
51 255,0,0, 255,255,0, 0,0,
52 255,0,255, 255,255,255, 0,0
70 BYTE imagedata[36] = {1};
71 const BYTE expected_imagedata[36] = {
72 255,0,255, 255,255,255,
78 &IID_IWICBitmapDecoder, (
void**)&decoder);
83 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
98 win_skip(
"BMP decoder failed to initialize\n");
100 IWICBitmapDecoder_Release(decoder);
104 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
106 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
108 hr = IWICBitmapDecoder_GetMetadataQueryReader(decoder, &queryreader);
111 hr = IWICBitmapDecoder_GetColorContexts(decoder, 1, &colorcontext, &
count);
114 hr = IWICBitmapDecoder_GetThumbnail(decoder, &thumbnail);
117 hr = IWICBitmapDecoder_GetPreview(decoder, &thumbnail);
120 hr = IWICBitmapDecoder_GetFrameCount(decoder, &
count);
124 hr = IWICBitmapDecoder_GetFrame(decoder, 1, &framedecode);
127 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
134 hr = IWICBitmapFrameDecode_GetSize(framedecode, &
width, &
height);
139 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
141 ok(dpiX == 96.0,
"expected dpiX=96.0, got %f\n", dpiX);
142 ok(dpiY == 96.0,
"expected dpiY=96.0, got %f\n", dpiY);
144 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
146 ok(
IsEqualGUID(&guidresult, &GUID_WICPixelFormat24bppBGR),
"unexpected pixel format\n");
148 hr = IWICBitmapFrameDecode_GetMetadataQueryReader(framedecode, &queryreader);
151 hr = IWICBitmapFrameDecode_GetColorContexts(framedecode, 1, &colorcontext, &
count);
154 hr = IWICBitmapFrameDecode_GetThumbnail(framedecode, &thumbnail);
158 &IID_IWICImagingFactory, (
void**)&
factory);
166 hr = IWICBitmapDecoder_CopyPalette(decoder,
palette);
169 hr = IWICBitmapFrameDecode_CopyPalette(framedecode,
palette);
175 IWICImagingFactory_Release(
factory);
182 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 6,
sizeof(imagedata), imagedata);
189 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 6,
sizeof(imagedata), imagedata);
196 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 4,
sizeof(imagedata), imagedata);
203 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 4, 5, imagedata);
210 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 6,
sizeof(imagedata), imagedata);
212 ok(!
memcmp(imagedata, expected_imagedata,
sizeof(imagedata)),
"unexpected image data\n");
214 hr = IWICBitmapFrameDecode_CopyPixels(framedecode,
NULL, 6,
sizeof(imagedata), imagedata);
216 ok(!
memcmp(imagedata, expected_imagedata,
sizeof(imagedata)),
"unexpected image data\n");
218 IWICBitmapFrameDecode_Release(framedecode);
226 hr = IWICBitmapDecoder_QueryCapability(decoder, bmpstream, &capability);
230 &IID_IWICBitmapDecoder, (
void**)&decoder2);
234 hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
235 ok(
hr ==
S_OK,
"QueryCapability failed, hr=%x\n",
hr);
237 "unexpected capabilities: %x\n", capability);
244 hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
247 IWICBitmapDecoder_Release(decoder2);
250 IStream_Release(bmpstream);
256 IWICBitmapDecoder_Release(decoder);
291 BYTE imagedata[2] = {1};
292 const BYTE expected_imagedata[2] = {0x80,0xc0};
294 const WICColor expected_palettedata[2] = {0xff0000ff,0xff00ff00};
298 &IID_IWICBitmapDecoder, (
void**)&decoder);
303 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
315 ok(
hr ==
S_OK,
"Initialize failed, hr=%x\n",
hr);
317 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
319 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
321 hr = IWICBitmapDecoder_GetFrameCount(decoder, &
count);
325 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
332 hr = IWICBitmapFrameDecode_GetSize(framedecode, &
width, &
height);
337 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
339 ok(dpiX == 96.0,
"expected dpiX=96.0, got %f\n", dpiX);
340 ok(dpiY == 96.0,
"expected dpiY=96.0, got %f\n", dpiY);
342 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
344 ok(
IsEqualGUID(&guidresult, &GUID_WICPixelFormat1bppIndexed),
"unexpected pixel format\n");
347 &IID_IWICImagingFactory, (
void**)&
factory);
355 hr = IWICBitmapDecoder_CopyPalette(decoder,
palette);
358 hr = IWICBitmapFrameDecode_CopyPalette(framedecode,
palette);
368 ok(!
memcmp(palettedata, expected_palettedata,
sizeof(palettedata)),
"unexpected palette data\n");
373 IWICImagingFactory_Release(
factory);
380 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 1,
sizeof(imagedata), imagedata);
382 ok(!
memcmp(imagedata, expected_imagedata,
sizeof(imagedata)),
"unexpected image data\n");
384 IWICBitmapFrameDecode_Release(framedecode);
388 &IID_IWICBitmapDecoder, (
void**)&decoder2);
392 hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
393 ok(
hr ==
S_OK,
"QueryCapability failed, hr=%x\n",
hr);
395 "unexpected capabilities: %x\n", capability);
396 IWICBitmapDecoder_Release(decoder2);
399 IStream_Release(bmpstream);
405 IWICBitmapDecoder_Release(decoder);
449 BYTE imagedata[2] = {1};
450 const BYTE expected_imagedata[2] = {0x01,0x23};
452 const WICColor expected_palettedata[5] =
453 {0xff0000ff,0xff00ff00,0xffff0000,0xff800080,0xffffffff};
457 &IID_IWICBitmapDecoder, (
void**)&decoder);
462 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
474 ok(
hr ==
S_OK,
"Initialize failed, hr=%x\n",
hr);
476 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
478 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
480 hr = IWICBitmapDecoder_GetFrameCount(decoder, &
count);
484 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
491 hr = IWICBitmapFrameDecode_GetSize(framedecode, &
width, &
height);
496 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
498 ok(
fabs(dpiX - 254.0) < 0.01,
"expected dpiX=96.0, got %f\n", dpiX);
499 ok(
fabs(dpiY - 508.0) < 0.01,
"expected dpiY=96.0, got %f\n", dpiY);
501 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
503 ok(
IsEqualGUID(&guidresult, &GUID_WICPixelFormat4bppIndexed),
"unexpected pixel format\n");
506 &IID_IWICImagingFactory, (
void**)&
factory);
514 hr = IWICBitmapDecoder_CopyPalette(decoder,
palette);
517 hr = IWICBitmapFrameDecode_CopyPalette(framedecode,
palette);
527 ok(!
memcmp(palettedata, expected_palettedata,
sizeof(palettedata)),
"unexpected palette data\n");
532 IWICImagingFactory_Release(
factory);
539 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 1,
sizeof(imagedata), imagedata);
541 ok(!
memcmp(imagedata, expected_imagedata,
sizeof(imagedata)),
"unexpected image data\n");
543 IWICBitmapFrameDecode_Release(framedecode);
547 &IID_IWICBitmapDecoder, (
void**)&decoder2);
551 hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
552 ok(
hr ==
S_OK,
"QueryCapability failed, hr=%x\n",
hr);
554 "unexpected capabilities: %x\n", capability);
555 IWICBitmapDecoder_Release(decoder2);
558 IStream_Release(bmpstream);
564 IWICBitmapDecoder_Release(decoder);
604 4,15,0,4,11,9,9,0,0,0,4,14,0,4,3,10,10,7,0,0,4,13,0,4,3,10,10,7,0,0,4,12,0,4,0,1,1,11,0,0,0,4,16,2,16,2,4,4,0,0,0,4,2,16,2,16,4,5,0,0,0,4,16,2,16,2,4,6,0,0,0,4,2,16,2,16,4,8,0,1
619 DWORD imagedata[64] = {1};
620 const DWORD expected_imagedata[64] = {
621 0x0000ff,0xffffff,0x0000ff,0xffffff,0xff0000,0xff0000,0xff0000,0xff0000,
622 0xffffff,0x0000ff,0xffffff,0x0000ff,0xee0000,0xee0000,0xee0000,0xee0000,
623 0x0000ff,0xffffff,0x0000ff,0xffffff,0xdd0000,0xdd0000,0xdd0000,0xdd0000,
624 0xffffff,0x0000ff,0xffffff,0x0000ff,0xcc0000,0xcc0000,0xcc0000,0xcc0000,
625 0x00cc00,0x00cc00,0x00cc00,0x00cc00,0x000000,0x111111,0x111111,0x555555,
626 0x00dd00,0x00dd00,0x00dd00,0x00dd00,0x222222,0xff00ff,0xff00ff,0x333333,
627 0x00ee00,0x00ee00,0x00ee00,0x00ee00,0x222222,0xff00ff,0xff00ff,0x333333,
628 0x00ff00,0x00ff00,0x00ff00,0x00ff00,0x555555,0x444444,0x444444,0x000000};
630 const WICColor expected_palettedata[17] = {
631 0xff000000,0xff111111,0xff0000ff,0xff222222,0xffcc0000,0xffdd0000,
632 0xffee0000,0xff333333,0xffff0000,0xff444444,0xffff00ff,0xff555555,
633 0xff00cc00,0xff00dd00,0xff00ee00,0xff00ff00,0xffffffff};
637 &IID_IWICBitmapDecoder, (
void**)&decoder);
642 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
654 ok(
hr ==
S_OK,
"Initialize failed, hr=%x\n",
hr);
656 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
658 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
660 hr = IWICBitmapDecoder_GetFrameCount(decoder, &
count);
664 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
671 hr = IWICBitmapFrameDecode_GetSize(framedecode, &
width, &
height);
676 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
678 ok(
fabs(dpiX - 72.0) < 0.01,
"expected dpiX=96.0, got %f\n", dpiX);
679 ok(
fabs(dpiY - 72.0) < 0.01,
"expected dpiY=96.0, got %f\n", dpiY);
681 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
683 ok(
IsEqualGUID(&guidresult, &GUID_WICPixelFormat32bppBGR),
"unexpected pixel format\n");
686 &IID_IWICImagingFactory, (
void**)&
factory);
694 hr = IWICBitmapDecoder_CopyPalette(decoder,
palette);
697 hr = IWICBitmapFrameDecode_CopyPalette(framedecode,
palette);
707 ok(!
memcmp(palettedata, expected_palettedata,
sizeof(palettedata)),
"unexpected palette data\n");
712 IWICImagingFactory_Release(
factory);
719 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 32,
sizeof(imagedata), (
BYTE*)imagedata);
721 ok(!
memcmp(imagedata, expected_imagedata,
sizeof(imagedata)),
"unexpected image data\n");
723 IWICBitmapFrameDecode_Release(framedecode);
727 &IID_IWICBitmapDecoder, (
void**)&decoder2);
731 hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
732 ok(
hr ==
S_OK,
"QueryCapability failed, hr=%x\n",
hr);
734 "unexpected capabilities: %x\n", capability);
735 IWICBitmapDecoder_Release(decoder2);
738 IStream_Release(bmpstream);
744 IWICBitmapDecoder_Release(decoder);
773 0,8,68,68,0,0,0,0,0,8,68,68,3,48,0,0,0,8,68,68,3,48,0,0,0,8,68,68,0,0,0,0,0,8,81,81,34,34,0,0,0,8,21,21,34,34,0,0,0,8,81,81,34,34,0,0,0,8,21,21,34,34,0,1
788 DWORD imagedata[64] = {1};
789 const DWORD expected_imagedata[64] = {
790 0x0000ff,0xffffff,0x0000ff,0xffffff,0xff0000,0xff0000,0xff0000,0xff0000,
791 0xffffff,0x0000ff,0xffffff,0x0000ff,0xff0000,0xff0000,0xff0000,0xff0000,
792 0x0000ff,0xffffff,0x0000ff,0xffffff,0xff0000,0xff0000,0xff0000,0xff0000,
793 0xffffff,0x0000ff,0xffffff,0x0000ff,0xff0000,0xff0000,0xff0000,0xff0000,
794 0x00ff00,0x00ff00,0x00ff00,0x00ff00,0x000000,0x000000,0x000000,0x000000,
795 0x00ff00,0x00ff00,0x00ff00,0x00ff00,0x000000,0xff00ff,0xff00ff,0x000000,
796 0x00ff00,0x00ff00,0x00ff00,0x00ff00,0x000000,0xff00ff,0xff00ff,0x000000,
797 0x00ff00,0x00ff00,0x00ff00,0x00ff00,0x000000,0x000000,0x000000,0x000000};
799 const WICColor expected_palettedata[6] = {
800 0xff000000,0xff0000ff,0xffff0000,0xffff00ff,0xff00ff00,0xffffffff};
804 &IID_IWICBitmapDecoder, (
void**)&decoder);
809 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
821 ok(
hr ==
S_OK,
"Initialize failed, hr=%x\n",
hr);
823 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
825 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
827 hr = IWICBitmapDecoder_GetFrameCount(decoder, &
count);
831 hr = IWICBitmapDecoder_GetFrame(decoder, 0, &framedecode);
838 hr = IWICBitmapFrameDecode_GetSize(framedecode, &
width, &
height);
843 hr = IWICBitmapFrameDecode_GetResolution(framedecode, &dpiX, &dpiY);
845 ok(
fabs(dpiX - 72.0) < 0.01,
"expected dpiX=96.0, got %f\n", dpiX);
846 ok(
fabs(dpiY - 72.0) < 0.01,
"expected dpiY=96.0, got %f\n", dpiY);
848 hr = IWICBitmapFrameDecode_GetPixelFormat(framedecode, &guidresult);
850 ok(
IsEqualGUID(&guidresult, &GUID_WICPixelFormat32bppBGR),
"unexpected pixel format\n");
853 &IID_IWICImagingFactory, (
void**)&
factory);
861 hr = IWICBitmapDecoder_CopyPalette(decoder,
palette);
864 hr = IWICBitmapFrameDecode_CopyPalette(framedecode,
palette);
874 ok(!
memcmp(palettedata, expected_palettedata,
sizeof(palettedata)),
"unexpected palette data\n");
879 IWICImagingFactory_Release(
factory);
886 hr = IWICBitmapFrameDecode_CopyPixels(framedecode, &rc, 32,
sizeof(imagedata), (
BYTE*)imagedata);
888 ok(!
memcmp(imagedata, expected_imagedata,
sizeof(imagedata)),
"unexpected image data\n");
890 IWICBitmapFrameDecode_Release(framedecode);
894 &IID_IWICBitmapDecoder, (
void**)&decoder2);
898 hr = IWICBitmapDecoder_QueryCapability(decoder2, bmpstream, &capability);
899 ok(
hr ==
S_OK,
"QueryCapability failed, hr=%x\n",
hr);
901 "unexpected capabilities: %x\n", capability);
902 IWICBitmapDecoder_Release(decoder2);
905 IStream_Release(bmpstream);
911 IWICBitmapDecoder_Release(decoder);
922 UINT pattern_count, pattern_size;
931 &IID_IWICImagingFactory, (
void**)&
factory);
935 hr = IWICImagingFactory_CreateComponentInfo(
factory, &CLSID_WICBmpDecoder, &
info);
939 hr = IWICComponentInfo_GetComponentType(
info, &
type);
943 hr = IWICComponentInfo_QueryInterface(
info, &IID_IWICBitmapDecoderInfo, (
void**)&decoderinfo);
949 hr = IWICBitmapDecoderInfo_GetPatterns(decoderinfo, 0,
NULL, &pattern_count, &pattern_size);
951 ok(pattern_count != 0,
"pattern count is 0\n");
952 ok(pattern_size > pattern_count *
sizeof(
WICBitmapPattern),
"size=%i, count=%i\n", pattern_size, pattern_count);
955 hr = IWICBitmapDecoderInfo_GetPatterns(decoderinfo, pattern_size, patterns, &pattern_count, &pattern_size);
957 ok(pattern_count != 0,
"pattern count is 0\n");
958 ok(pattern_size > pattern_count *
sizeof(
WICBitmapPattern),
"size=%i, count=%i\n", pattern_size, pattern_count);
959 ok(patterns[0].
Length != 0,
"pattern length is 0\n");
960 ok(patterns[0].Pattern !=
NULL,
"pattern is NULL\n");
961 ok(patterns[0].
Mask !=
NULL,
"mask is NULL\n");
964 hr = IWICBitmapDecoderInfo_GetPatterns(decoderinfo, pattern_size, patterns, &pattern_count, &pattern_size);
969 hr = IWICBitmapDecoderInfo_CreateInstance(decoderinfo, &decoder);
973 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
975 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
977 IWICBitmapDecoder_Release(decoder);
981 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
993 hr = IWICBitmapDecoderInfo_MatchesPattern(decoderinfo, bmpstream, &boolresult);
995 ok(boolresult,
"pattern not matched\n");
997 IStream_Release(bmpstream);
1003 IWICBitmapDecoderInfo_Release(decoderinfo);
1006 IWICComponentInfo_Release(
info);
1009 IWICImagingFactory_Release(
factory);
1024 &IID_IWICImagingFactory, (
void**)&
factory);
1029 ok(hbmpdata != 0,
"GlobalAlloc failed\n");
1040 hr = IWICImagingFactory_CreateDecoderFromStream(
factory, bmpstream,
1045 hr = IWICBitmapDecoder_GetContainerFormat(decoder, &guidresult);
1047 ok(
IsEqualGUID(&guidresult, &GUID_ContainerFormatBmp),
"unexpected container format\n");
1049 IWICBitmapDecoder_Release(decoder);
1052 IStream_Release(bmpstream);
1058 IWICImagingFactory_Release(
factory);
1068 &IID_IWICImagingFactory, (
void **)&
factory);
1069 ok(
hr ==
S_OK,
"CoCreateInstance error %#x\n",
hr);
1077 hr = IWICImagingFactory_CreateDecoder(
factory, &GUID_ContainerFormatBmp,
NULL, &decoder);
1078 ok(
hr ==
S_OK,
"CreateDecoder error %#x\n",
hr);
1079 IWICBitmapDecoder_Release(decoder);
1081 hr = IWICImagingFactory_CreateDecoder(
factory, &GUID_ContainerFormatBmp, &GUID_VendorMicrosoft, &decoder);
1082 ok(
hr ==
S_OK,
"CreateDecoder error %#x\n",
hr);
1083 IWICBitmapDecoder_Release(decoder);
1085 IWICImagingFactory_Release(
factory);
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define HeapFree(x, y, z)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
#define memcpy(s1, s2, n)
_In_ ULONG _In_ ULONG _In_ ULONG Length
@ COINIT_APARTMENTTHREADED
#define IsEqualGUID(rguid1, rguid2)
@ WICDecodeMetadataCacheOnDemand
@ WICDecodeMetadataCacheOnLoad
@ WICBitmapDecoderCapabilityCanDecodeAllImages
#define WINCODEC_ERR_WRONGSTATE
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
#define WINCODEC_ERR_BADIMAGE
#define WINCODEC_ERR_PALETTEUNAVAILABLE
#define WINCODEC_ERR_CODECNOTHUMBNAIL
#define WINCODEC_ERR_FRAMEMISSING
#define WINCODEC_ERR_INSUFFICIENTBUFFER