34DEFINE_GUID(IID_IMILUnknown,0x0ccd7824,0xdc16,0x4d09,0xbc,0xa8,0x6b,0x09,0xc4,0xef,0x55,0x35);
35DEFINE_GUID(IID_IMILBitmap,0xb1784d3f,0x8115,0x4763,0x13,0xaa,0x32,0xed,0xdb,0x68,0x29,0x4a);
36DEFINE_GUID(IID_IMILBitmapSource,0x7543696a,0xbc8d,0x46b0,0x5f,0x81,0x8d,0x95,0x72,0x89,0x72,0xbe);
37DEFINE_GUID(IID_IMILBitmapLock,0xa67b2b53,0x8fa1,0x4155,0x8f,0x64,0x0c,0x24,0x7a,0x8f,0x84,0xcd);
38DEFINE_GUID(IID_IMILBitmapScaler,0xa767b0f0,0x1c8c,0x4aef,0x56,0x8f,0xad,0xf9,0x6d,0xcf,0xd5,0xcb);
39DEFINE_GUID(IID_IMILFormatConverter,0x7e2a746f,0x25c5,0x4851,0xb3,0xaf,0x44,0x3b,0x79,0x63,0x9e,0xc0);
40DEFINE_GUID(IID_IMILPalette,0xca8e206f,0xf22c,0x4af7,0x6f,0xba,0x7b,0xed,0x5e,0xb1,0xc9,0x2f);
43#define INTERFACE IMILBitmapSource
58#define INTERFACE IMILBitmap
80#define INTERFACE IMILBitmapScaler
139 double *dpiX,
double *dpiY)
182 memset(bmibuf, 0,
sizeof(bmibuf));
206 ok(hdib != 0,
"CreateDIBSection(%dx%d,%d bpp) failed\n",
width,
height,
bpp);
209 ok(bm.bmWidth ==
width,
"expected %d, got %d\n",
width, bm.bmWidth);
210 ok(bm.bmHeight ==
height,
"expected %d, got %d\n",
height, bm.bmHeight);
211 ok(bm.bmPlanes == 1,
"expected 1, got %d\n", bm.bmPlanes);
212 ok(bm.bmBitsPixel ==
bpp,
"expected %d, got %d\n",
bpp, bm.bmBitsPixel);
229 128,128,255, 128,128,128, 128,255,128,
230 128,128,128, 128,128,128, 255,255,255,
231 255,128,128, 255,255,255, 255,255,255};
232 BYTE returned_data[27] = {0};
234 UINT lock_buffer_size=0;
235 UINT lock_buffer_stride=0;
238 double dpix=10.0, dpiy=10.0;
239 int can_lock_null = 1;
241 hr = IWICImagingFactory_CreateBitmap(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
243 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmap failed hr=%x\n",
hr);
249 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%x\n",
hr);
256 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%x\n",
hr);
259 ok(
hr ==
S_OK,
"IWICBitmap_SetPalette failed hr=%x\n",
hr);
262 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%x\n",
hr);
265 ok(
hr ==
S_OK,
"IWICBitmap_CopyPalette failed hr=%x\n",
hr);
267 hr = IWICPalette_GetType(
palette, &palettetype);
268 ok(
hr ==
S_OK,
"IWICPalette_GetType failed hr=%x\n",
hr);
270 "expected WICBitmapPaletteTypeFixedGray256, got %x\n", palettetype);
275 hr = IWICBitmap_CopyPixels(
bitmap,
NULL, 9, 27, returned_data);
276 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels failed hr=%x\n",
hr);
279 ok(returned_data[
i] == 0,
"returned_data[%i] == %i\n",
i, returned_data[
i]);
315 ok(
hr ==
S_OK,
"IWICBitmapLock_GetSize failed hr=%x\n",
hr);
319 IWICBitmapLock_Release(
lock);
327 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%x\n",
hr);
330 hr = IWICBitmapLock_GetStride(
lock, &lock_buffer_stride);
331 ok(
hr ==
S_OK,
"IWICBitmapLock_GetStride failed hr=%x\n",
hr);
333 ok(lock_buffer_stride == 12,
"got %i, expected 12\n", lock_buffer_stride);
336 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%x\n",
hr);
338 ok(lock_buffer_size == 33,
"got %i, expected 33\n", lock_buffer_size);
343 ok(
hr ==
S_OK,
"IWICBitmapLock_GetPixelFormat failed hr=%x\n",
hr);
347 ok(
hr ==
S_OK,
"IWICBitmapLock_GetSize failed hr=%x\n",
hr);
353 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%x\n",
hr);
357 hr = IWICBitmapLock_GetDataPointer(lock2, &lock_buffer_size, &
lock_buffer);
358 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%x\n",
hr);
359 ok(lock_buffer_size == 33,
"got %i, expected 33\n", lock_buffer_size);
362 IWICBitmapLock_Release(lock2);
373 if (base_lock_buffer)
379 IWICBitmapLock_Release(
lock);
383 hr = IWICBitmap_CopyPixels(
bitmap,
NULL, 9, 27, returned_data);
384 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels failed hr=%x\n",
hr);
387 ok(returned_data[
i] ==
bitmap_data[
i],
"returned_data[%i] == %i\n",
i, returned_data[
i]);
395 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%x\n",
hr);
409 hr = IWICBitmapLock_GetStride(
lock, &lock_buffer_stride);
410 ok(
hr ==
S_OK,
"IWICBitmapLock_GetStride failed hr=%x\n",
hr);
411 ok(lock_buffer_stride == 12,
"got %i, expected 12\n", lock_buffer_stride);
414 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%x\n",
hr);
415 ok(lock_buffer_size == 15,
"got %i, expected 15\n", lock_buffer_size);
419 ok(
hr ==
S_OK,
"IWICBitmapLock_GetPixelFormat failed hr=%x\n",
hr);
423 ok(
hr ==
S_OK,
"IWICBitmapLock_GetSize failed hr=%x\n",
hr);
427 IWICBitmapLock_Release(
lock);
431 ok(
hr ==
S_OK,
"IWICBitmap_GetPixelFormat failed hr=%x\n",
hr);
434 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
435 ok(
hr ==
S_OK,
"IWICBitmap_GetResolution failed hr=%x\n",
hr);
436 ok(dpix == 0.0,
"got %f, expected 0.0\n", dpix);
437 ok(dpiy == 0.0,
"got %f, expected 0.0\n", dpiy);
439 hr = IWICBitmap_SetResolution(
bitmap, 12.0, 34.0);
440 ok(
hr ==
S_OK,
"IWICBitmap_SetResolution failed hr=%x\n",
hr);
442 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
443 ok(
hr ==
S_OK,
"IWICBitmap_GetResolution failed hr=%x\n",
hr);
444 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
445 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
448 ok(
hr ==
S_OK,
"IWICBitmap_GetSize failed hr=%x\n",
hr);
452 IWICBitmap_Release(
bitmap);
464 128,128,255, 128,128,128, 128,255,128,
465 128,128,128, 128,128,128, 255,255,255,
466 255,128,128, 255,255,255, 255,255,255};
467 BYTE returned_data[27] = {0};
469 UINT lock_buffer_stride=0;
470 UINT lock_buffer_size=0;
473 double dpix=10.0, dpiy=10.0;
477 hr = IWICImagingFactory_CreateBitmap(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
479 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmap failed hr=%x\n",
hr);
485 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%x\n",
hr);
488 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%x\n",
hr);
491 ok(
hr ==
S_OK,
"IWICBitmap_SetPalette failed hr=%x\n",
hr);
499 ok(
hr ==
S_OK,
"IWICBitmap_Lock failed hr=%x\n",
hr);
502 hr = IWICBitmapLock_GetStride(
lock, &lock_buffer_stride);
503 ok(
hr ==
S_OK,
"IWICBitmapLock_GetStride failed hr=%x\n",
hr);
504 ok(lock_buffer_stride == 12,
"got %i, expected 12\n", lock_buffer_stride);
507 ok(
hr ==
S_OK,
"IWICBitmapLock_GetDataPointer failed hr=%x\n",
hr);
508 ok(lock_buffer_size == 33,
"got %i, expected 33\n", lock_buffer_size);
514 IWICBitmapLock_Release(
lock);
517 hr = IWICBitmap_SetResolution(
bitmap, 12.0, 34.0);
518 ok(
hr ==
S_OK,
"IWICBitmap_SetResolution failed hr=%x\n",
hr);
523 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%x\n",
hr);
535 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%x\n",
hr);
537 IWICBitmap_Release(
bitmap);
542 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%x\n",
hr);
550 hr = IWICBitmap_CopyPixels(
bitmap2,
NULL, 9, 27, returned_data);
551 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels failed hr=%x\n",
hr);
554 ok(returned_data[
i] ==
bitmap_data[
i],
"returned_data[%i] == %i\n",
i, returned_data[
i]);
557 ok(
hr ==
S_OK,
"IWICBitmap_GetPixelFormat failed hr=%x\n",
hr);
560 hr = IWICBitmap_GetResolution(
bitmap2, &dpix, &dpiy);
561 ok(
hr ==
S_OK,
"IWICBitmap_GetResolution failed hr=%x\n",
hr);
562 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
563 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
566 ok(
hr ==
S_OK,
"IWICBitmap_GetSize failed hr=%x\n",
hr);
573 hr = IWICImagingFactory_CreateBitmap(
factory, 3, 3, &GUID_WICPixelFormat4bppIndexed,
575 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmap failed hr=%x\n",
hr);
578 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%x\n",
hr);
581 ok(
hr ==
S_OK,
"IWICPalette_InitializePredefined failed hr=%x\n",
hr);
584 ok(
hr ==
S_OK,
"IWICBitmap_SetPalette failed hr=%x\n",
hr);
590 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromSource failed hr=%x\n",
hr);
592 IWICBitmap_Release(
bitmap);
595 ok(
hr ==
S_OK,
"IWICImagingFactory_CreatePalette failed hr=%x\n",
hr);
598 ok(
hr ==
S_OK,
"IWICBitmap_CopyPalette failed hr=%x\n",
hr);
601 ok(
hr ==
S_OK,
"IWICPalette_GetColorCount failed hr=%x\n",
hr);
605 ok(
hr ==
S_OK,
"IWICPalette_GetType failed hr=%x\n",
hr);
611 ok(
hr ==
S_OK,
"IWICBitmap_GetPixelFormat failed hr=%x\n",
hr);
615 ok(
hr ==
S_OK,
"IWICBitmap_GetSize failed hr=%x\n",
hr);
621 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#x.\n",
hr);
623 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#x.\n",
hr);
626 IWICBitmap_Release(
bitmap);
629 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#x.\n",
hr);
631 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#x.\n",
hr);
634 IWICBitmap_Release(
bitmap);
637 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#x.\n",
hr);
639 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#x.\n",
hr);
642 IWICBitmap_Release(
bitmap);
661 BYTE orig_data3x3[27] = {
662 128,128,255, 128,128,128, 128,255,128,
663 128,128,128, 128,128,128, 255,255,255,
664 255,128,128, 255,255,255, 255,255,255 };
667 128,128,255, 128,128,128, 128,255,128,
668 0,0,0, 0,128,128, 255,255,255,
669 255,128,128, 255,0,0, 0,0,0 };
675 memcpy(data3x3, orig_data3x3,
sizeof(data3x3));
677 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
681 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
682 0,
sizeof(data3x3), data3x3, &
bitmap);
685 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
686 6,
sizeof(data3x3), data3x3, &
bitmap);
689 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
690 12,
sizeof(data3x3), data3x3, &
bitmap);
693 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
694 9,
sizeof(data3x3) - 1, data3x3, &
bitmap);
697 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 3, &GUID_WICPixelFormat24bppBGR,
698 9,
sizeof(data3x3), data3x3, &
bitmap);
699 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromMemory error %#x\n",
hr);
702 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
710 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#x\n",
hr);
711 for (
i = 0;
i <
sizeof(
data);
i++)
712 ok(
data[
i] == orig_data3x3[
i],
"%u: expected %u, got %u\n",
i,
data[
i], data3x3[
i]);
714 IWICBitmap_Release(
bitmap);
716 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory, 3, 2, &GUID_WICPixelFormat24bppBGR,
717 13,
sizeof(orig_data3x3), orig_data3x3, &
bitmap);
718 ok(
hr ==
S_OK,
"IWICImagingFactory_CreateBitmapFromMemory error %#x\n",
hr);
721 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
727 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#x\n",
hr);
728 for (
i = 0;
i <
sizeof(
data);
i++)
729 ok(
data[
i] == data3x2[
i],
"%u: expected %u, got %u\n",
i, data3x2[
i],
data[
i]);
731 IWICBitmap_Release(
bitmap);
736 static const char bits[4096];
750 ok(
info.hbmMask != 0,
"CreateBitmap failed\n");
752 ok(icon != 0,
"CreateIconIndirect failed\n");
755 hr = IWICImagingFactory_CreateBitmapFromHICON(
factory, 0,
NULL);
761 hr = IWICImagingFactory_CreateBitmapFromHICON(
factory, icon,
NULL);
765 ok(
hr ==
S_OK,
"CreateBitmapFromHICON error %#x\n",
hr);
774 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
778 IWICBitmap_Release(
bitmap);
785 ok(
info.hbmColor != 0,
"CreateBitmap failed\n");
787 ok(
info.hbmMask != 0,
"CreateBitmap failed\n");
789 ok(icon != 0,
"CreateIconIndirect failed\n");
794 ok(
hr ==
S_OK,
"CreateBitmapFromHICON error %#x\n",
hr);
802 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
806 IWICBitmap_Release(
bitmap);
812 static const BYTE data_8bpp_pal_dib[12] = { 0,1,2,0, 1,2,0,0, 2,1,0,0 };
813 static const BYTE data_8bpp_rgb_dib[12] = { 0xf0,0x0f,0xff,0, 0x0f,0xff,0xf0,0, 0xf0,0x0f,0xff,0 };
814 static const BYTE data_8bpp_pal_wic[12] = { 0xd,0xe,0x10,0, 0xe,0x10,0xd,0, 0x10,0xe,0xd,0 };
815 static const PALETTEENTRY pal_data[3] = { {0xff,0,0,0}, {0,0xff,0,0}, {0,0,0xff,0} };
830 ok(
hbmp != 0,
"failed to create bitmap\n");
839 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#x\n",
hr);
846 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
852 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#x\n",
hr);
853 for (
i = 0;
i <
sizeof(
data);
i++)
854 ok(
data[
i] == data_8bpp_rgb_dib[
i],
"%u: expected %#x, got %#x\n",
i, data_8bpp_rgb_dib[
i],
data[
i]);
856 IWICBitmap_Release(
bitmap);
860 memset(pal_buf, 0,
sizeof(pal_buf));
863 memcpy(pal->palPalEntry, pal_data,
sizeof(pal_data));
865 ok(hpal != 0,
"CreatePalette failed\n");
869 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#x\n",
hr);
877 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
882 ok(
hr ==
S_OK,
"CreatePalette error %#x\n",
hr);
884 ok(
hr ==
S_OK,
"CopyPalette error %#x\n",
hr);
891 ok(
hr ==
S_OK,
"GetColorCount error %#x\n",
hr);
897 IWICBitmap_Release(
bitmap);
902 memset(pal_buf, 0,
sizeof(pal_buf));
905 memcpy(pal->palPalEntry, pal_data,
sizeof(pal_data));
907 ok(hpal != 0,
"CreatePalette failed\n");
911 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#x\n",
hr);
918 ok(
hr ==
S_OK,
"IWICBitmap_GetSize error %#x\n",
hr);
923 ok(
hr ==
S_OK,
"CreatePalette error %#x\n",
hr);
925 ok(
hr ==
S_OK,
"CopyPalette error %#x\n",
hr);
932 ok(
hr ==
S_OK,
"GetColorCount error %#x\n",
hr);
939 ok(
hr ==
S_OK,
"IWICBitmap_CopyPixels error %#x\n",
hr);
940 for (
i = 0;
i <
sizeof(
data);
i++)
942 ok(
data[
i] == data_8bpp_pal_wic[
i],
"%u: expected %#x, got %#x\n",
i, data_8bpp_pal_wic[
i],
data[
i]);
944 IWICBitmap_Release(
bitmap);
951 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#x\n",
hr);
954 ok(
hr ==
S_OK,
"GetPixelFormat error %#x\n",
hr);
958 IWICBitmap_Release(
bitmap);
962 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#x\n",
hr);
965 ok(
hr ==
S_OK,
"GetPixelFormat error %#x\n",
hr);
969 IWICBitmap_Release(
bitmap);
973 ok(
hr ==
S_OK,
"CreateBitmapFromHBITMAP error %#x\n",
hr);
976 ok(
hr ==
S_OK,
"GetPixelFormat error %#x\n",
hr);
980 IWICBitmap_Release(
bitmap);
993 hr = IWICImagingFactory_CreateBitmap(
factory, 10, 10, &GUID_WICPixelFormat24bppBGR,
997 hr = IWICImagingFactory_CreateBitmapClipper(
factory, &clipper);
1021 IWICBitmapClipper_Release(clipper);
1022 IWICBitmap_Release(
bitmap);
1025 hr = IWICImagingFactory_CreateBitmapClipper(
factory, &clipper);
1087 IWICBitmapClipper_Release(clipper);
1102 pWICCreateBitmapFromSectionEx =
1105 if (!pWICCreateBitmapFromSectionEx)
1107 win_skip(
"WICCreateBitmapFromSectionEx not available\n");
1117 info.bmiHeader.biSize =
sizeof(
info.bmiHeader);
1118 info.bmiHeader.biWidth = 3;
1119 info.bmiHeader.biHeight = -3;
1120 info.bmiHeader.biBitCount = 24;
1121 info.bmiHeader.biPlanes = 1;
1125 ok(hdib !=
NULL,
"CreateDIBSection failed\n");
1127 hr = pWICCreateBitmapFromSectionEx(3, 3, &GUID_WICPixelFormat24bppBGR, hsection, 0, 0,
1129 ok(
hr ==
S_OK,
"WICCreateBitmapFromSectionEx returned %#x\n",
hr);
1130 IWICBitmap_Release(
bitmap);
1133 hr = pWICCreateBitmapFromSectionEx(3, 3, &GUID_WICPixelFormat24bppBGR, hsection, 0, 0x100,
1135 ok(
hr ==
S_OK,
"WICCreateBitmapFromSectionEx returned %#x\n",
hr);
1136 IWICBitmap_Release(
bitmap);
1139 hr = pWICCreateBitmapFromSectionEx(3, 3, &GUID_WICPixelFormat24bppBGR, hsection, 0,
1142 ok(
hr ==
S_OK,
"WICCreateBitmapFromSectionEx returned %#x\n",
hr);
1143 IWICBitmap_Release(
bitmap);
1153 double res_x, res_y;
1160 ok(
hr ==
S_OK,
"Failed to create a bitmap, hr %#x.\n",
hr);
1163 ok(
hr ==
S_OK,
"Failed to get bitmap size, hr %#x.\n",
hr);
1167 hr = IWICBitmap_GetResolution(
bitmap, &res_x, &res_y);
1168 ok(
hr ==
S_OK,
"Failed to get bitmap resolution, hr %#x.\n",
hr);
1169 ok(res_x == 0.0 && res_y == 0.0,
"Unexpected resolution %f x %f.\n", res_x, res_y);
1171 hr = IWICImagingFactory_CreateBitmapScaler(
factory, &scaler);
1172 ok(
hr ==
S_OK,
"Failed to create bitmap scaler, hr %#x.\n",
hr);
1174 hr = IWICBitmapScaler_Initialize(scaler,
NULL, 0, 0,
1185 hr = IWICBitmapScaler_GetSize(scaler, &
width,
NULL);
1188 hr = IWICBitmapScaler_GetResolution(scaler,
NULL,
NULL);
1192 hr = IWICBitmapScaler_GetResolution(scaler, &res_x,
NULL);
1194 ok(res_x == 0.1,
"Unexpected resolution %f.\n", res_x);
1196 hr = IWICBitmapScaler_GetResolution(scaler,
NULL, &res_y);
1199 hr = IWICBitmapScaler_GetResolution(scaler, &res_x, &res_y);
1202 hr = IWICBitmapScaler_GetPixelFormat(scaler,
NULL);
1207 ok(
hr ==
S_OK,
"Failed to get pixel format, hr %#x.\n",
hr);
1218 hr = IWICBitmapScaler_CopyPalette(scaler,
NULL);
1222 ok(
hr ==
S_OK,
"Failed to create a palette, hr %#x.\n",
hr);
1223 hr = IWICBitmapScaler_CopyPalette(scaler,
palette);
1234 hr = IWICBitmapScaler_CopyPixels(scaler,
NULL, 1,
sizeof(
buf),
buf);
1244 hr = IWICBitmapScaler_Initialize(scaler,
NULL, 8, 4,
1250 ok(
hr ==
S_OK,
"Failed to initialize bitmap scaler, hr %#x.\n",
hr);
1268 ok(
hr ==
S_OK,
"Failed to get scaler size, hr %#x.\n",
hr);
1275 hr = IWICBitmapScaler_GetSize(scaler, &
width,
NULL);
1278 hr = IWICBitmapScaler_GetSize(scaler,
NULL,
NULL);
1281 hr = IWICBitmapScaler_GetPixelFormat(scaler,
NULL);
1286 ok(
hr ==
S_OK,
"Failed to get pixel format, hr %#x.\n",
hr);
1290 hr = IWICBitmapScaler_GetResolution(scaler,
NULL,
NULL);
1294 hr = IWICBitmapScaler_GetResolution(scaler, &res_x,
NULL);
1296 ok(res_x == 0.1,
"Unexpected resolution %f.\n", res_x);
1298 hr = IWICBitmapScaler_GetResolution(scaler,
NULL, &res_y);
1301 res_x = res_y = 1.0;
1302 hr = IWICBitmapScaler_GetResolution(scaler, &res_x, &res_y);
1303 ok(
hr ==
S_OK,
"Failed to get scaler resolution, hr %#x.\n",
hr);
1304 ok(res_x == 0.0 && res_y == 0.0,
"Unexpected resolution %f x %f.\n", res_x, res_y);
1307 ok(
hr ==
S_OK,
"Failed to create a palette, hr %#x.\n",
hr);
1308 hr = IWICBitmapScaler_CopyPalette(scaler,
palette);
1312 IWICBitmapScaler_Release(scaler);
1314 IWICBitmap_Release(
bitmap);
1328 IMILBitmap *mil_bitmap;
1329 IMILBitmapSource *mil_source;
1330 IMILBitmapScaler *mil_scaler;
1331 IUnknown *wic_unknown, *mil_unknown;
1339 hr = IWICImagingFactory_CreateBitmap(
factory, 1, 1, &GUID_WICPixelFormat24bppBGR,
1341 ok(
hr ==
S_OK,
"CreateBitmap error %#x\n",
hr);
1346 ok(
hr ==
S_OK,
"GetPixelFormat error %#x\n",
hr);
1349 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
1350 ok(
hr ==
S_OK,
"GetResolution error %#x\n",
hr);
1351 ok(dpix == 0.0,
"got %f, expected 0.0\n", dpix);
1352 ok(dpiy == 0.0,
"got %f, expected 0.0\n", dpiy);
1354 hr = IWICBitmap_SetResolution(
bitmap, 12.0, 34.0);
1355 ok(
hr ==
S_OK,
"SetResolution error %#x\n",
hr);
1357 hr = IWICBitmap_GetResolution(
bitmap, &dpix, &dpiy);
1358 ok(
hr ==
S_OK,
"GetResolution error %#x\n",
hr);
1359 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
1360 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
1367 hr = IWICBitmap_QueryInterface(
bitmap, &IID_IMILBitmap, (
void **)&mil_bitmap);
1368 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1374 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1377 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1378 ok((
void *)wic_unknown->lpVtbl == (
void *)mil_unknown->lpVtbl,
"wrong lpVtbl ptrs %p != %p\n", wic_unknown->lpVtbl, mil_unknown->lpVtbl);
1380 IUnknown_Release(wic_unknown);
1381 IUnknown_Release(mil_unknown);
1383 hr = IWICBitmap_QueryInterface(
bitmap, &IID_IMILBitmapSource, (
void **)&mil_source);
1384 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1385 ok((
void *)mil_source->lpVtbl == (
void *)mil_bitmap->lpVtbl,
"IMILBitmap->lpVtbl should be equal to IMILBitmapSource->lpVtbl\n");
1391 hr = mil_source->lpVtbl->GetPixelFormat(mil_source, &MIL_format);
1392 ok(
hr ==
S_OK,
"GetPixelFormat error %#x\n",
hr);
1393 ok(MIL_format == 0x0c,
"wrong format %d\n", MIL_format);
1395 hr = mil_source->lpVtbl->GetResolution(mil_source, &dpix, &dpiy);
1396 ok(
hr ==
S_OK,
"GetResolution error %#x\n",
hr);
1397 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
1398 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
1400 hr = mil_source->lpVtbl->GetSize(mil_source, &
width, &
height);
1406 hr = IWICImagingFactory_CreateBitmapScaler(
factory, &scaler);
1407 ok(
hr ==
S_OK,
"CreateBitmapScaler error %#x\n",
hr);
1411 hr = IWICBitmapScaler_QueryInterface(scaler, &IID_IMILBitmapScaler, (
void **)&mil_scaler);
1412 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1417 hr = IWICBitmapScaler_QueryInterface(scaler, &
IID_IUnknown, (
void **)&wic_unknown);
1418 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1421 ok(
hr ==
S_OK,
"QueryInterface error %#x\n",
hr);
1422 ok((
void *)wic_unknown->lpVtbl == (
void *)mil_unknown->lpVtbl,
"wrong lpVtbl ptrs %p != %p\n", wic_unknown->lpVtbl, mil_unknown->lpVtbl);
1424 IUnknown_Release(wic_unknown);
1425 IUnknown_Release(mil_unknown);
1427 hr = mil_scaler->lpVtbl->GetPixelFormat(mil_scaler, &MIL_format);
1430 hr = mil_scaler->lpVtbl->GetResolution(mil_scaler, &dpix, &dpiy);
1433 hr = mil_scaler->lpVtbl->GetSize(mil_scaler, &
width, &
height);
1437 hr = mil_scaler->lpVtbl->CopyPixels(mil_scaler,
NULL, 3,
sizeof(
buf),
buf);
1440 hr = mil_scaler->lpVtbl->Initialize(mil_scaler, mil_source, 1, 1, 1);
1441 ok(
hr ==
S_OK,
"Initialize error %#x\n",
hr);
1443 hr = mil_scaler->lpVtbl->GetPixelFormat(mil_scaler, &MIL_format);
1444 ok(
hr ==
S_OK,
"GetPixelFormat error %#x\n",
hr);
1445 ok(MIL_format == 0x0c,
"wrong format %d\n", MIL_format);
1447 hr = mil_scaler->lpVtbl->GetResolution(mil_scaler, &dpix, &dpiy);
1448 ok(
hr ==
S_OK,
"GetResolution error %#x\n",
hr);
1449 ok(dpix == 12.0,
"got %f, expected 12.0\n", dpix);
1450 ok(dpiy == 34.0,
"got %f, expected 34.0\n", dpiy);
1452 hr = mil_scaler->lpVtbl->GetSize(mil_scaler, &
width, &
height);
1458 hr = mil_scaler->lpVtbl->CopyPixels(mil_scaler,
NULL, 3,
sizeof(
buf),
buf);
1459 ok(
hr ==
S_OK,
"CopyPixels error %#x\n",
hr);
1460 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]);
1462 mil_scaler->lpVtbl->Release(mil_scaler);
1463 IWICBitmapScaler_Release(scaler);
1464 mil_source->lpVtbl->Release(mil_source);
1465 mil_bitmap->lpVtbl->Release(mil_bitmap);
1466 IWICBitmap_Release(
bitmap);
1476 &IID_IWICImagingFactory, (
void**)&
factory);
1488 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 GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
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)
DWORD dwAllocationGranularity
BITMAPINFOHEADER bmiHeader
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
_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
#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