34DEFINE_GUID(IID_CMetaBitmapRenderTarget, 0x0ccd7824,0xdc16,0x4d09,0xbc,0xa8,0x6b,0x09,0xc4,0xef,0x55,0x35);
38DEFINE_GUID(
IID_IMILBitmap,0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a);
39DEFINE_GUID(
IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe);
40DEFINE_GUID(
IID_IMILBitmapLock,0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd);
41DEFINE_GUID(
IID_IMILBitmapScaler,0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb);
42DEFINE_GUID(
IID_IMILFormatConverter,0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0);
43DEFINE_GUID(
IID_IMILPalette,0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f);
54#define INTERFACE IMILBitmapSource
69#define INTERFACE IMILBitmap
91#define INTERFACE IMILBitmapScaler
150 double *dpiX,
double *dpiY)
193 memset(bmibuf, 0,
sizeof(bmibuf));
217 ok(hdib != 0,
"CreateDIBSection(%dx%d,%d bpp) failed\n",
width,
height,
bpp);
220 ok(bm.bmWidth ==
width,
"expected %d, got %ld\n",
width, bm.bmWidth);
221 ok(bm.bmHeight ==
height,
"expected %d, got %ld\n",
height, bm.bmHeight);
222 ok(bm.bmPlanes == 1,
"expected 1, got %d\n", bm.bmPlanes);
223 ok(bm.bmBitsPixel ==
bpp,
"expected %d, got %d\n",
bpp, bm.bmBitsPixel);
240 128,128,255, 128,128,128, 128,255,128,
241 128,128,128, 128,128,128, 255,255,255,
242 255,128,128, 255,255,255, 255,255,255};
243 BYTE returned_data[27] = {0};
245 UINT lock_buffer_size=0;
246 UINT lock_buffer_stride=0;
249 double dpix=10.0, dpiy=10.0;
250 int can_lock_null = 1;
252 hr = IWICImagingFactory_CreateBitmap(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
254 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmap failed hr=%lx\n",
hr);
260 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%lx\n",
hr);
267 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%lx\n",
hr);
270 ok(
hr ==
S_OK,
"IWICBitmap_SetPalette failed hr=%lx\n",
hr);
273 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%lx\n",
hr);
276 ok(
hr ==
S_OK,
"IWICBitmap_CopyPalette failed hr=%lx\n",
hr);
278 hr = IWICPalette_GetType(
palette, &palettetype);
279 ok(
hr ==
S_OK,
"IWICPalette_GetType failed hr=%lx\n",
hr);
281 "expected WICBitmapPaletteTypeFixedGray256, got %x\n", palettetype);
286 hr = IWICBitmap_CopyPixels(
bitmap,
NULL, 9, 27, returned_data);
287 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels failed hr=%lx\n",
hr);
290 ok(returned_data[
i] == 0,
"returned_data[%i] == %i\n",
i, returned_data[
i]);
326 ok(
hr ==
S_OK,
"IWICBitmapLock_GetSize failed hr=%lx\n",
hr);
330 IWICBitmapLock_Release(
lock);
338 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%lx\n",
hr);
341 hr = IWICBitmapLock_GetStride(
lock, &lock_buffer_stride);
342 ok(
hr ==
S_OK,
"IWICBitmapLock_GetStride failed hr=%lx\n",
hr);
344 ok(lock_buffer_stride == 12,
"got %i, expected 12\n", lock_buffer_stride);
347 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%lx\n",
hr);
349 ok(lock_buffer_size == 33,
"got %i, expected 33\n", lock_buffer_size);
354 ok(
hr ==
S_OK,
"IWICBitmapLock_GetPixelFormat failed hr=%lx\n",
hr);
358 ok(
hr ==
S_OK,
"IWICBitmapLock_GetSize failed hr=%lx\n",
hr);
364 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%lx\n",
hr);
368 hr = IWICBitmapLock_GetDataPointer(lock2, &lock_buffer_size, &
lock_buffer);
369 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%lx\n",
hr);
370 ok(lock_buffer_size == 33,
"got %i, expected 33\n", lock_buffer_size);
373 IWICBitmapLock_Release(lock2);
384 if (base_lock_buffer)
390 IWICBitmapLock_Release(
lock);
394 hr = IWICBitmap_CopyPixels(
bitmap,
NULL, 9, 27, returned_data);
395 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels failed hr=%lx\n",
hr);
398 ok(returned_data[
i] ==
bitmap_data[
i],
"returned_data[%i] == %i\n",
i, returned_data[
i]);
406 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%lx\n",
hr);
420 hr = IWICBitmapLock_GetStride(
lock, &lock_buffer_stride);
421 ok(
hr ==
S_OK,
"IWICBitmapLock_GetStride failed hr=%lx\n",
hr);
422 ok(lock_buffer_stride == 12,
"got %i, expected 12\n", lock_buffer_stride);
425 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%lx\n",
hr);
426 ok(lock_buffer_size == 15,
"got %i, expected 15\n", lock_buffer_size);
430 ok(
hr ==
S_OK,
"IWICBitmapLock_GetPixelFormat failed hr=%lx\n",
hr);
434 ok(
hr ==
S_OK,
"IWICBitmapLock_GetSize failed hr=%lx\n",
hr);
438 IWICBitmapLock_Release(
lock);
442 ok(
hr ==
S_OK,
"IWICBitmap_GetPixelFormat failed hr=%lx\n",
hr);
445 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
446 ok(
hr ==
S_OK,
"IWICBitmap_GetResolution failed hr=%lx\n",
hr);
447 ok(dpix == 0.0,
"got %f, expected 0.0\n", dpix);
448 ok(dpiy == 0.0,
"got %f, expected 0.0\n", dpiy);
450 hr = IWICBitmap_SetResolution(
bitmap, 12.0, 34.0);
451 ok(
hr ==
S_OK,
"IWICBitmap_SetResolution failed hr=%lx\n",
hr);
453 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
454 ok(
hr ==
S_OK,
"IWICBitmap_GetResolution failed hr=%lx\n",
hr);
455 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
456 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
459 ok(
hr ==
S_OK,
"IWICBitmap_GetSize failed hr=%lx\n",
hr);
463 IWICBitmap_Release(
bitmap);
475 128,128,255, 128,128,128, 128,255,128,
476 128,128,128, 128,128,128, 255,255,255,
477 255,128,128, 255,255,255, 255,255,255};
478 BYTE returned_data[27] = {0};
480 UINT lock_buffer_stride=0;
481 UINT lock_buffer_size=0;
484 double dpix=10.0, dpiy=10.0;
488 hr = IWICImagingFactory_CreateBitmap(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
490 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmap failed hr=%lx\n",
hr);
496 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%lx\n",
hr);
499 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%lx\n",
hr);
502 ok(
hr ==
S_OK,
"IWICBitmap_SetPalette failed hr=%lx\n",
hr);
510 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%lx\n",
hr);
513 hr = IWICBitmapLock_GetStride(
lock, &lock_buffer_stride);
514 ok(
hr ==
S_OK,
"IWICBitmapLock_GetStride failed hr=%lx\n",
hr);
515 ok(lock_buffer_stride == 12,
"got %i, expected 12\n", lock_buffer_stride);
518 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%lx\n",
hr);
519 ok(lock_buffer_size == 33,
"got %i, expected 33\n", lock_buffer_size);
525 IWICBitmapLock_Release(
lock);
528 hr = IWICBitmap_SetResolution(
bitmap, 12.0, 34.0);
529 ok(
hr ==
S_OK,
"IWICBitmap_SetResolution failed hr=%lx\n",
hr);
534 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%lx\n",
hr);
546 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%lx\n",
hr);
548 IWICBitmap_Release(
bitmap);
553 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%lx\n",
hr);
561 hr = IWICBitmap_CopyPixels(
bitmap2,
NULL, 9, 27, returned_data);
562 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels failed hr=%lx\n",
hr);
565 ok(returned_data[
i] ==
bitmap_data[
i],
"returned_data[%i] == %i\n",
i, returned_data[
i]);
568 ok(
hr ==
S_OK,
"IWICBitmap_GetPixelFormat failed hr=%lx\n",
hr);
571 hr = IWICBitmap_GetResolution(
bitmap2, &dpix, &dpiy);
572 ok(
hr ==
S_OK,
"IWICBitmap_GetResolution failed hr=%lx\n",
hr);
573 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
574 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
577 ok(
hr ==
S_OK,
"IWICBitmap_GetSize failed hr=%lx\n",
hr);
584 hr = IWICImagingFactory_CreateBitmap(
factory, 3, 3, &GUID_WICPixelFormat4bppIndexed,
586 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmap failed hr=%lx\n",
hr);
589 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%lx\n",
hr);
592 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%lx\n",
hr);
595 ok(
hr ==
S_OK,
"IWICBitmap_SetPalette failed hr=%lx\n",
hr);
601 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%lx\n",
hr);
603 IWICBitmap_Release(
bitmap);
606 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%lx\n",
hr);
609 ok(
hr ==
S_OK,
"IWICBitmap_CopyPalette failed hr=%lx\n",
hr);
612 ok(
hr ==
S_OK,
"IWICPalette_GetColorCount failed hr=%lx\n",
hr);
616 ok(
hr ==
S_OK,
"IWICPalette_GetType failed hr=%lx\n",
hr);
622 ok(
hr ==
S_OK,
"IWICBitmap_GetPixelFormat failed hr=%lx\n",
hr);
626 ok(
hr ==
S_OK,
"IWICBitmap_GetSize failed hr=%lx\n",
hr);
632 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#lx.\n",
hr);
634 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#lx.\n",
hr);
637 IWICBitmap_Release(
bitmap);
640 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#lx.\n",
hr);
642 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#lx.\n",
hr);
645 IWICBitmap_Release(
bitmap);
648 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#lx.\n",
hr);
650 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#lx.\n",
hr);
653 IWICBitmap_Release(
bitmap);
672 BYTE orig_data3x3[27] = {
673 128,128,255, 128,128,128, 128,255,128,
674 128,128,128, 128,128,128, 255,255,255,
675 255,128,128, 255,255,255, 255,255,255 };
678 128,128,255, 128,128,128, 128,255,128,
679 0,0,0, 0,128,128, 255,255,255,
680 255,128,128, 255,0,0, 0,0,0 };
686 memcpy(data3x3, orig_data3x3,
sizeof(data3x3));
688 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
692 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
693 0,
sizeof(data3x3), data3x3, &
bitmap);
696 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
697 6,
sizeof(data3x3), data3x3, &
bitmap);
700 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
701 12,
sizeof(data3x3), data3x3, &
bitmap);
704 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
705 9,
sizeof(data3x3) - 1, data3x3, &
bitmap);
708 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
709 9,
sizeof(data3x3), data3x3, &
bitmap);
710 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromMemory error %#lx\n",
hr);
713 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
721 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#lx\n",
hr);
722 for (
i = 0;
i <
sizeof(
data);
i++)
723 ok(
data[
i] == orig_data3x3[
i],
"%u: expected %u, got %u\n",
i,
data[
i], data3x3[
i]);
725 IWICBitmap_Release(
bitmap);
727 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 2, &GUID_WICPixelFormat24bppBGR,
728 13,
sizeof(orig_data3x3), orig_data3x3, &
bitmap);
729 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromMemory error %#lx\n",
hr);
732 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
738 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#lx\n",
hr);
739 for (
i = 0;
i <
sizeof(
data);
i++)
740 ok(
data[
i] == data3x2[
i],
"%u: expected %u, got %u\n",
i, data3x2[
i],
data[
i]);
742 IWICBitmap_Release(
bitmap);
747 static const char bits[4096];
761 ok(
info.hbmMask != 0,
"CreateBitmap failed\n");
763 ok(icon != 0,
"CreateIconIndirect failed\n");
766 hr = IWICImagingFactory_CreateBitmapFromHICON(
factory, 0,
NULL);
772 hr = IWICImagingFactory_CreateBitmapFromHICON(
factory, icon,
NULL);
776 ok(
hr ==
S_OK,
"CreateBitmapFromHICON error %#lx\n",
hr);
785 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
789 IWICBitmap_Release(
bitmap);
796 ok(
info.hbmColor != 0,
"CreateBitmap failed\n");
798 ok(
info.hbmMask != 0,
"CreateBitmap failed\n");
800 ok(icon != 0,
"CreateIconIndirect failed\n");
805 ok(
hr ==
S_OK,
"CreateBitmapFromHICON error %#lx\n",
hr);
813 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
817 IWICBitmap_Release(
bitmap);
823 static const BYTE data_8bpp_pal_dib[12] = { 0,1,2,0, 1,2,0,0, 2,1,0,0 };
824 static const BYTE data_8bpp_rgb_dib[12] = { 0xf0,0x0f,0xff,0, 0x0f,0xff,0xf0,0, 0xf0,0x0f,0xff,0 };
825 static const BYTE data_8bpp_pal_wic[12] = { 0xd,0xe,0x10,0, 0xe,0x10,0xd,0, 0x10,0xe,0xd,0 };
826 static const PALETTEENTRY pal_data[3] = { {0xff,0,0,0}, {0,0xff,0,0}, {0,0,0xff,0} };
841 ok(
hbmp != 0,
"failed to create bitmap\n");
850 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#lx\n",
hr);
857 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
863 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#lx\n",
hr);
864 for (
i = 0;
i <
sizeof(
data);
i++)
865 ok(
data[
i] == data_8bpp_rgb_dib[
i],
"%u: expected %#x, got %#x\n",
i, data_8bpp_rgb_dib[
i],
data[
i]);
867 IWICBitmap_Release(
bitmap);
871 memset(pal_buf, 0,
sizeof(pal_buf));
874 memcpy(pal->palPalEntry, pal_data,
sizeof(pal_data));
876 ok(hpal != 0,
"CreatePalette failed\n");
880 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#lx\n",
hr);
888 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
893 ok(
hr ==
S_OK,
"CreatePalette error %#lx\n",
hr);
895 ok(
hr ==
S_OK,
"CopyPalette error %#lx\n",
hr);
902 ok(
hr ==
S_OK,
"GetColorCount error %#lx\n",
hr);
908 IWICBitmap_Release(
bitmap);
913 memset(pal_buf, 0,
sizeof(pal_buf));
916 memcpy(pal->palPalEntry, pal_data,
sizeof(pal_data));
918 ok(hpal != 0,
"CreatePalette failed\n");
922 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#lx\n",
hr);
929 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#lx\n",
hr);
934 ok(
hr ==
S_OK,
"CreatePalette error %#lx\n",
hr);
936 ok(
hr ==
S_OK,
"CopyPalette error %#lx\n",
hr);
943 ok(
hr ==
S_OK,
"GetColorCount error %#lx\n",
hr);
950 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#lx\n",
hr);
951 for (
i = 0;
i <
sizeof(
data);
i++)
953 ok(
data[
i] == data_8bpp_pal_wic[
i],
"%u: expected %#x, got %#x\n",
i, data_8bpp_pal_wic[
i],
data[
i]);
955 IWICBitmap_Release(
bitmap);
962 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#lx\n",
hr);
965 ok(
hr ==
S_OK,
"GetPixelFormat error %#lx\n",
hr);
969 IWICBitmap_Release(
bitmap);
973 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#lx\n",
hr);
976 ok(
hr ==
S_OK,
"GetPixelFormat error %#lx\n",
hr);
980 IWICBitmap_Release(
bitmap);
984 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#lx\n",
hr);
987 ok(
hr ==
S_OK,
"GetPixelFormat error %#lx\n",
hr);
991 IWICBitmap_Release(
bitmap);
1004 hr = IWICImagingFactory_CreateBitmap(
factory, 10, 10, &GUID_WICPixelFormat24bppBGR,
1008 hr = IWICImagingFactory_CreateBitmapClipper(
factory, &clipper);
1032 IWICBitmapClipper_Release(clipper);
1033 IWICBitmap_Release(
bitmap);
1036 hr = IWICImagingFactory_CreateBitmapClipper(
factory, &clipper);
1098 IWICBitmapClipper_Release(clipper);
1113 pWICCreateBitmapFromSectionEx =
1116 if (!pWICCreateBitmapFromSectionEx)
1118 win_skip(
"WICCreateBitmapFromSectionEx not available\n");
1128 info.bmiHeader.biSize =
sizeof(
info.bmiHeader);
1129 info.bmiHeader.biWidth = 3;
1130 info.bmiHeader.biHeight = -3;
1131 info.bmiHeader.biBitCount = 24;
1132 info.bmiHeader.biPlanes = 1;
1136 ok(hdib !=
NULL,
"CreateDIBSection failed\n");
1138 hr = pWICCreateBitmapFromSectionEx(3, 3, &GUID_WICPixelFormat24bppBGR, hsection, 0, 0,
1140 ok(
hr ==
S_OK,
"WICCreateBitmapFromSectionEx returned %#lx\n",
hr);
1141 IWICBitmap_Release(
bitmap);
1144 hr = pWICCreateBitmapFromSectionEx(3, 3, &GUID_WICPixelFormat24bppBGR, hsection, 0, 0x100,
1146 ok(
hr ==
S_OK,
"WICCreateBitmapFromSectionEx returned %#lx\n",
hr);
1147 IWICBitmap_Release(
bitmap);
1150 hr = pWICCreateBitmapFromSectionEx(3, 3, &GUID_WICPixelFormat24bppBGR, hsection, 0,
1153 ok(
hr ==
S_OK,
"WICCreateBitmapFromSectionEx returned %#lx\n",
hr);
1154 IWICBitmap_Release(
bitmap);
1164 double res_x, res_y;
1171 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#lx.\n",
hr);
1174 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#lx.\n",
hr);
1178 hr = IWICBitmap_GetResolution(
bitmap, &res_x, &res_y);
1179 ok(
hr ==
S_OK,
"Failed to get bitmap resolution, hr %#lx.\n",
hr);
1180 ok(res_x == 0.0 && res_y == 0.0,
"Unexpected resolution %f x %f.\n", res_x, res_y);
1182 hr = IWICImagingFactory_CreateBitmapScaler(
factory, &scaler);
1183 ok(
hr ==
S_OK,
"Failed to create bitmap scaler, hr %#lx.\n",
hr);
1185 hr = IWICBitmapScaler_Initialize(scaler,
NULL, 0, 0,
1196 hr = IWICBitmapScaler_GetSize(scaler, &
width,
NULL);
1199 hr = IWICBitmapScaler_GetResolution(scaler,
NULL,
NULL);
1203 hr = IWICBitmapScaler_GetResolution(scaler, &res_x,
NULL);
1205 ok(res_x == 0.1,
"Unexpected resolution %f.\n", res_x);
1207 hr = IWICBitmapScaler_GetResolution(scaler,
NULL, &res_y);
1210 hr = IWICBitmapScaler_GetResolution(scaler, &res_x, &res_y);
1213 hr = IWICBitmapScaler_GetPixelFormat(scaler,
NULL);
1218 ok(
hr ==
S_OK,
"Failed to get pixel format, hr %#lx.\n",
hr);
1229 hr = IWICBitmapScaler_CopyPalette(scaler,
NULL);
1233 ok(
hr ==
S_OK,
"Failed to create a palette, hr %#lx.\n",
hr);
1234 hr = IWICBitmapScaler_CopyPalette(scaler,
palette);
1245 hr = IWICBitmapScaler_CopyPixels(scaler,
NULL, 1,
sizeof(
buf),
buf);
1255 hr = IWICBitmapScaler_Initialize(scaler,
NULL, 8, 4,
1261 ok(
hr ==
S_OK,
"Failed to initialize bitmap scaler, hr %#lx.\n",
hr);
1279 ok(
hr ==
S_OK,
"Failed to get scaler size, hr %#lx.\n",
hr);
1286 hr = IWICBitmapScaler_GetSize(scaler, &
width,
NULL);
1289 hr = IWICBitmapScaler_GetSize(scaler,
NULL,
NULL);
1292 hr = IWICBitmapScaler_GetPixelFormat(scaler,
NULL);
1297 ok(
hr ==
S_OK,
"Failed to get pixel format, hr %#lx.\n",
hr);
1301 hr = IWICBitmapScaler_GetResolution(scaler,
NULL,
NULL);
1305 hr = IWICBitmapScaler_GetResolution(scaler, &res_x,
NULL);
1307 ok(res_x == 0.1,
"Unexpected resolution %f.\n", res_x);
1309 hr = IWICBitmapScaler_GetResolution(scaler,
NULL, &res_y);
1312 res_x = res_y = 1.0;
1313 hr = IWICBitmapScaler_GetResolution(scaler, &res_x, &res_y);
1314 ok(
hr ==
S_OK,
"Failed to get scaler resolution, hr %#lx.\n",
hr);
1315 ok(res_x == 0.0 && res_y == 0.0,
"Unexpected resolution %f x %f.\n", res_x, res_y);
1318 ok(
hr ==
S_OK,
"Failed to create a palette, hr %#lx.\n",
hr);
1319 hr = IWICBitmapScaler_CopyPalette(scaler,
palette);
1323 hr = IWICBitmapScaler_CopyPixels(scaler,
NULL, 24,
sizeof(
buf),
buf);
1326 IWICBitmapScaler_Release(scaler);
1328 IWICBitmap_Release(
bitmap);
1342 IMILBitmap *mil_bitmap;
1343 IMILBitmapSource *mil_source;
1344 IMILBitmapScaler *mil_scaler;
1345 IUnknown *wic_unknown, *mil_unknown;
1353 hr = IWICImagingFactory_CreateBitmap(
factory, 1, 1, &GUID_WICPixelFormat24bppBGR,
1355 ok(
hr ==
S_OK,
"CreateBitmap error %#lx\n",
hr);
1360 ok(
hr ==
S_OK,
"GetPixelFormat error %#lx\n",
hr);
1363 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
1364 ok(
hr ==
S_OK,
"GetResolution error %#lx\n",
hr);
1365 ok(dpix == 0.0,
"got %f, expected 0.0\n", dpix);
1366 ok(dpiy == 0.0,
"got %f, expected 0.0\n", dpiy);
1368 hr = IWICBitmap_SetResolution(
bitmap, 12.0, 34.0);
1369 ok(
hr ==
S_OK,
"SetResolution error %#lx\n",
hr);
1371 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
1372 ok(
hr ==
S_OK,
"GetResolution error %#lx\n",
hr);
1373 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
1374 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
1382 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1388 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1391 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1392 ok((
void *)wic_unknown->lpVtbl == (
void *)mil_unknown->lpVtbl,
"wrong lpVtbl ptrs %p != %p\n", wic_unknown->lpVtbl, mil_unknown->lpVtbl);
1394 IUnknown_Release(wic_unknown);
1395 IUnknown_Release(mil_unknown);
1398 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1399 ok((
void *)mil_source->lpVtbl == (
void *)mil_bitmap->lpVtbl,
"IMILBitmap->lpVtbl should be equal to IMILBitmapSource->lpVtbl\n");
1405 hr = mil_source->lpVtbl->GetPixelFormat(mil_source, &MIL_format);
1406 ok(
hr ==
S_OK,
"GetPixelFormat error %#lx\n",
hr);
1407 ok(MIL_format == 0x0c,
"wrong format %d\n", MIL_format);
1409 hr = mil_source->lpVtbl->GetResolution(mil_source, &dpix, &dpiy);
1410 ok(
hr ==
S_OK,
"GetResolution error %#lx\n",
hr);
1411 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
1412 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
1414 hr = mil_source->lpVtbl->GetSize(mil_source, &
width, &
height);
1420 hr = IWICImagingFactory_CreateBitmapScaler(
factory, &scaler);
1421 ok(
hr ==
S_OK,
"CreateBitmapScaler error %#lx\n",
hr);
1426 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1431 hr = IWICBitmapScaler_QueryInterface(scaler, &
IID_IUnknown, (
void **)&wic_unknown);
1432 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1435 ok(
hr ==
S_OK,
"QueryInterface error %#lx\n",
hr);
1436 ok((
void *)wic_unknown->lpVtbl == (
void *)mil_unknown->lpVtbl,
"wrong lpVtbl ptrs %p != %p\n", wic_unknown->lpVtbl, mil_unknown->lpVtbl);
1438 IUnknown_Release(wic_unknown);
1439 IUnknown_Release(mil_unknown);
1441 hr = mil_scaler->lpVtbl->GetPixelFormat(mil_scaler, &MIL_format);
1444 hr = mil_scaler->lpVtbl->GetResolution(mil_scaler, &dpix, &dpiy);
1447 hr = mil_scaler->lpVtbl->GetSize(mil_scaler, &
width, &
height);
1451 hr = mil_scaler->lpVtbl->CopyPixels(mil_scaler,
NULL, 3,
sizeof(
buf),
buf);
1454 hr = mil_scaler->lpVtbl->Initialize(mil_scaler, mil_source, 1, 1, 1);
1455 ok(
hr ==
S_OK,
"Initialize error %#lx\n",
hr);
1457 hr = mil_scaler->lpVtbl->GetPixelFormat(mil_scaler, &MIL_format);
1458 ok(
hr ==
S_OK,
"GetPixelFormat error %#lx\n",
hr);
1459 ok(MIL_format == 0x0c,
"wrong format %d\n", MIL_format);
1461 hr = mil_scaler->lpVtbl->GetResolution(mil_scaler, &dpix, &dpiy);
1462 ok(
hr ==
S_OK,
"GetResolution error %#lx\n",
hr);
1463 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
1464 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
1466 hr = mil_scaler->lpVtbl->GetSize(mil_scaler, &
width, &
height);
1472 hr = mil_scaler->lpVtbl->CopyPixels(mil_scaler,
NULL, 3,
sizeof(
buf),
buf);
1473 ok(
hr ==
S_OK,
"CopyPixels error %#lx\n",
hr);
1474 ok(
buf[0] == 0 &&
buf[1] == 0 &&
buf[2] == 0 &&
buf[3] == 0xde,
"wrong data: %02x %02x %02x %02x\n",
buf[0],
buf[1],
buf[2],
buf[3]);
1476 mil_scaler->lpVtbl->Release(mil_scaler);
1477 IWICBitmapScaler_Release(scaler);
1478 mil_source->lpVtbl->Release(mil_source);
1479 mil_bitmap->lpVtbl->Release(mil_bitmap);
1481 mil_unknown = (
void *)0xdeadbeef;
1482 hr = IWICBitmap_QueryInterface(
bitmap, &IID_CMetaBitmapRenderTarget, (
void **)&mil_unknown);
1484 ok(!mil_unknown,
"got %p\n", mil_unknown);
1486 IWICBitmap_Release(
bitmap);
1496 &IID_IWICImagingFactory, (
void**)&
factory);
1508 IWICImagingFactory_Release(
factory);
#define DECLARE_INTERFACE_(i, b)
DWORD WINAPI GetSize(LPVOID)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileMappingW(a, b, c, d, e, f)
WICBitmapPaletteType palette_type
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
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)
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLenum GLuint GLenum GLsizei const GLchar * buf
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
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
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define memcpy(s1, s2, n)
static void lock_buffer(struct buffer_head *bh)
static HRESULT QueryInterface(REFIID, void **)
#define todo_wine_if(is_todo)
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
static ULONG WINAPI AddRef(IStream *iface)
static HRESULT WINAPI bitmapsource_QueryInterface(IWICBitmapSource *iface, REFIID iid, void **ppv)
static void test_bitmap_scaler(void)
static WICSectionAccessLevel
static HRESULT WINAPI bitmapsource_CopyPalette(IWICBitmapSource *iface, IWICPalette *palette)
static HRESULT WINAPI bitmapsource_GetPixelFormat(IWICBitmapSource *iface, WICPixelFormatGUID *format)
static REFWICPixelFormatGUID
static void test_CreateBitmapFromMemory(void)
static void test_CreateBitmapFromHICON(void)
static ULONG WINAPI bitmapsource_AddRef(IWICBitmapSource *iface)
static HRESULT WINAPI bitmapsource_GetSize(IWICBitmapSource *iface, UINT *width, UINT *height)
static HRESULT WINAPI bitmapsource_GetResolution(IWICBitmapSource *iface, double *dpiX, double *dpiY)
static IWICImagingFactory * factory
static IWICBitmapSource bitmapsource
static ULONG WINAPI bitmapsource_Release(IWICBitmapSource *iface)
static BOOL called_CopyPixels
static void test_CreateBitmapFromHBITMAP(void)
static HRESULT WINAPI bitmapsource_CopyPixels(IWICBitmapSource *iface, const WICRect *rc, UINT stride, UINT buffer_size, BYTE *buffer)
static IWICBitmap **static void test_WICCreateBitmapFromSectionEx(void)
static void test_createbitmap(void)
static void test_IMILBitmap(void)
static void test_clipper(void)
static const IWICBitmapSourceVtbl sourcevtbl
static void test_createbitmapfromsource(void)
static HBITMAP create_dib(int width, int height, int bpp, LOGPALETTE *pal, const void *data)
static LONG obj_refcount(void *obj)
@ COINIT_APARTMENTTHREADED
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
static __inline const char * wine_dbgstr_guid(const GUID *id)
wchar_t const *const size_t const buffer_size
DWORD dwAllocationGranularity
BITMAPINFOHEADER bmiHeader
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
DWORD WINAPI GetLastError(void)
@ WICSectionAccessLevelReadWrite
WICBitmapInterpolationMode
@ WICBitmapInterpolationModeNearestNeighbor
@ WICBitmapPaletteTypeCustom
@ WICBitmapPaletteTypeFixedGray256
@ WICBitmapPaletteTypeFixedGray4
@ WICBitmapUsePremultipliedAlpha
IID IID_IMILFormatConverter
#define WINCODEC_ERR_WRONGSTATE
#define WINCODEC_ERR_ALREADYLOCKED
#define WINCODEC_ERR_WIN32ERROR
#define WINCODEC_ERR_NOTINITIALIZED
#define WINCODEC_ERR_PALETTEUNAVAILABLE
#define HRESULT_FROM_WIN32(x)
#define ERROR_INVALID_CURSOR_HANDLE
#define WINCODEC_ERR_INSUFFICIENTBUFFER
int WINAPI GetPixelFormat(_In_ HDC)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
struct tagLOGPALETTE LOGPALETTE
struct tagBITMAPINFO BITMAPINFO
HICON WINAPI CreateIconIndirect(_In_ PICONINFO)
BOOL WINAPI DestroyIcon(_In_ HICON)
_In_ BOOLEAN SetResolution