38 const WICColor initcolors[4]={0xff000000,0xff0000ff,0xffffff00,0xffffffff};
62 memcpy(colors, initcolors,
sizeof(initcolors));
63 hr = IWICPalette_InitializeCustom(
palette, colors, 4);
74 memset(colors, 0,
sizeof(colors));
79 ok(!
memcmp(colors, initcolors,
sizeof(colors)),
"got unexpected palette data\n");
81 memset(colors, 0,
sizeof(colors));
86 ok(!
memcmp(colors, initcolors,
sizeof(
WICColor)*2),
"got unexpected palette data\n");
93 hr = IWICPalette_HasAlpha(
palette, &boolresult);
95 ok(!boolresult,
"expected FALSE, got TRUE\n");
97 hr = IWICPalette_IsBlackWhite(
palette, &boolresult);
99 ok(!boolresult,
"expected FALSE, got TRUE\n");
101 hr = IWICPalette_IsGrayscale(
palette, &boolresult);
103 ok(!boolresult,
"expected FALSE, got TRUE\n");
105 hr = IWICImagingFactory_CreatePalette(
factory, &palette2);
108 hr = IWICPalette_InitializeFromPalette(palette2,
palette);
112 hr = IWICPalette_GetType(palette2, &
type);
117 hr = IWICPalette_GetColorCount(palette2, &
count);
121 memset(colors, 0,
sizeof(colors));
123 hr = IWICPalette_GetColors(palette2, 4, colors, &
count);
126 ok(!
memcmp(colors, initcolors,
sizeof(colors)),
"got unexpected palette data\n");
129 colors[2] = 0x80ffffff;
130 hr = IWICPalette_InitializeCustom(
palette, colors, 4);
133 hr = IWICPalette_HasAlpha(
palette, &boolresult);
135 ok(boolresult,
"expected TRUE, got FALSE\n");
156 hr = IWICPalette_InitializeFromPalette(palette2,
palette);
160 hr = IWICPalette_GetType(palette2, &
type);
165 hr = IWICPalette_GetColorCount(palette2, &
count);
169 memset(colors, 0,
sizeof(colors));
171 hr = IWICPalette_GetColors(palette2, 4, colors, &
count);
203 IWICPalette_Release(palette2);
214 for (
i = 0;
i < 16;
i++)
216 entries[
i] = 0xff000000;
217 entries[
i] |= (
i << 20) | (
i << 16) | (
i << 12) | (
i << 8) | (
i << 4) |
i;
227 for (
i = 0;
i < 256;
i++)
229 entries[
i] = 0xff000000;
230 entries[
i] |= (
i << 16) | (
i << 8) |
i;
243 for (
i = 0;
i < 8;
i++)
245 entries[
i] = 0xff000000;
246 if (
i & 1) entries[
i] |= 0xff;
247 if (
i & 2) entries[
i] |= 0xff00;
248 if (
i & 4) entries[
i] |= 0xff0000;
251 for (
i = 8;
i < 16;
i++)
253 static const DWORD halftone[8] = { 0xc0c0c0, 0x808080, 0x800000, 0x008000,
254 0x000080, 0x808000, 0x800080, 0x008080 };
255 entries[
i] = 0xff000000;
256 entries[
i] |= halftone[
i-8];
265 static const BYTE halftone_values[4] = { 0x00,0x80,0xff };
273 for (
i = 0;
i < 27;
i++)
275 entries[
i] = 0xff000000;
276 entries[
i] |= halftone_values[
i%3];
277 entries[
i] |= halftone_values[(
i/3)%3] << 8;
278 entries[
i] |= halftone_values[(
i/9)%3] << 16;
281 entries[
i++] = 0xffc0c0c0;
288 static const BYTE halftone_values[4] = { 0x00,0x55,0xaa,0xff };
296 for (
i = 0;
i < 64;
i++)
298 entries[
i] = 0xff000000;
299 entries[
i] |= halftone_values[
i%4];
300 entries[
i] |= halftone_values[(
i/4)%4] << 8;
301 entries[
i] |= halftone_values[(
i/16)%4] << 16;
304 for (
i = 64;
i < 72;
i++)
306 static const DWORD halftone[8] = { 0xc0c0c0, 0x808080, 0x800000, 0x008000,
307 0x000080, 0x808000, 0x800080, 0x008080 };
308 entries[
i] = 0xff000000;
309 entries[
i] |= halftone[
i-64];
318 static const BYTE halftone_values[5] = { 0x00, 0x40, 0x80, 0xbf, 0xff };
326 for (
i = 0;
i < 125;
i++)
328 entries[
i] = 0xff000000;
329 entries[
i] |= halftone_values[
i%5];
330 entries[
i] |= halftone_values[(
i/5)%5] << 8;
331 entries[
i] |= halftone_values[(
i/25)%5] << 16;
334 entries[
i++] = 0xffc0c0c0;
341 static const BYTE halftone_values[6] = { 0x00,0x33,0x66,0x99,0xcc,0xff };
349 for (
i = 0;
i < 216;
i++)
351 entries[
i] = 0xff000000;
352 entries[
i] |= halftone_values[
i%6];
353 entries[
i] |= halftone_values[(
i/6)%6] << 8;
354 entries[
i] |= halftone_values[(
i/36)%6] << 16;
357 for (
i = 216;
i < 224;
i++)
359 static const DWORD halftone[8] = { 0xc0c0c0, 0x808080, 0x800000, 0x008000,
360 0x000080, 0x808000, 0x800080, 0x008080 };
361 entries[
i] = 0xff000000;
362 entries[
i] |= halftone[
i-216];
371 static const BYTE halftone_values_rb[6] = { 0x00,0x33,0x66,0x99,0xcc,0xff };
372 static const BYTE halftone_values_g[7] = { 0x00,0x2b,0x55,0x80,0xaa,0xd5,0xff };
380 for (
i = 0;
i < 252;
i++)
382 entries[
i] = 0xff000000;
383 entries[
i] |= halftone_values_rb[
i%6];
384 entries[
i] |= halftone_values_g[(
i/6)%7] << 8;
385 entries[
i] |= halftone_values_rb[(
i/42)%6] << 16;
394 static const BYTE halftone_values_b[4] = { 0x00,0x55,0xaa,0xff };
395 static const BYTE halftone_values_gr[8] = { 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff };
400 for (
i = 0;
i < 256;
i++)
402 entries[
i] = 0xff000000;
403 entries[
i] |= halftone_values_b[
i%4];
404 entries[
i] |= halftone_values_gr[(
i/4)%8] << 8;
405 entries[
i] |= halftone_values_gr[(
i/32)%8] << 16;
420 BOOL add_transparent;
426 { 0xff000000, 0xff555555, 0xffaaaaaa, 0xffffffff } },
428 { 0xff000000, 0xff555555, 0xffaaaaaa, 0xffffffff }, 1 },
456 ok(
hr ==
S_OK,
"CreatePalette error %#x\n",
hr);
468 ok(
hr ==
S_OK,
"%u: CreatePalette error %#x\n",
i,
hr);
470 hr = IWICPalette_InitializePredefined(
palette, td[
i].
type, td[
i].add_transparent);
471 ok(
hr ==
S_OK,
"%u: InitializePredefined error %#x\n",
i,
hr);
474 hr = IWICPalette_IsBlackWhite(
palette, &bret);
475 ok(
hr ==
S_OK,
"%u: IsBlackWhite error %#x\n",
i,
hr);
476 ok(bret == td[
i].is_bw ||
478 "%u: expected %d, got %d\n",
i, td[
i].is_bw, bret);
481 hr = IWICPalette_IsGrayscale(
palette, &bret);
482 ok(
hr ==
S_OK,
"%u: IsGrayscale error %#x\n",
i,
hr);
483 ok(bret == td[
i].is_gray,
"%u: expected %d, got %d\n",
i, td[
i].is_gray, bret);
492 ok(
hr ==
S_OK,
"%u: GetColorCount error %#x\n",
i,
hr);
496 ok(
hr ==
S_OK,
"%u: GetColors error %#x\n",
i,
hr);
572 hr = IWICImagingFactory_CreateBitmapFromMemory(
factory,
width,
height, &GUID_WICPixelFormat24bppRGB,
574 ok(
hr ==
S_OK,
"CreateBitmapFromMemory error %#x\n",
hr);
577 ok(
hr ==
S_OK,
"CreatePalette error %#x\n",
hr);
592 ok(
hr ==
S_OK,
"InitializeFromBitmap error %#x\n",
hr);
595 ok(
hr ==
S_OK,
"GetColorCount error %#x\n",
hr);
599 ok(
hr ==
S_OK,
"InitializeFromBitmap error %#x\n",
hr);
602 ok(
hr ==
S_OK,
"GetColorCount error %#x\n",
hr);
607 ok(
hr ==
S_OK,
"InitializeFromBitmap error %#x\n",
hr);
614 ok(
hr ==
S_OK,
"GetColorCount error %#x\n",
hr);
624 ok(
hr ==
S_OK,
"InitializeFromBitmap error %#x\n",
hr);
631 ok(
hr ==
S_OK,
"GetColorCount error %#x\n",
hr);
640 IWICBitmap_Release(
bitmap);
652 &IID_IWICImagingFactory, (
void **)&
factory);
653 ok(
hr ==
S_OK,
"CoCreateInstance error %#x\n",
hr);
659 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)
static WICColor * generate_halftone125_palette(UINT *count, BOOL add_transparent)
static WICColor * generate_halftone8_palette(UINT *count, BOOL add_transparent)
static WICColor * generate_gray256_palette(UINT *count)
static WICColor * generate_halftone256_palette(UINT *count, BOOL add_transparent)
static WICColor * generate_gray16_palette(UINT *count)
static WICColor * generate_halftone252_palette(UINT *count, BOOL add_transparent)
static WICColor * generate_halftone216_palette(UINT *count, BOOL add_transparent)
static WICColor * generate_halftone64_palette(UINT *count, BOOL add_transparent)
static WICColor * generate_halftone27_palette(UINT *count, BOOL add_transparent)
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLenum GLenum GLenum GLenum GLenum scale
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
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 GLint GLint j
#define memcpy(s1, s2, n)
static void test_custom_palette(void)
static BYTE * init_bitmap(UINT *width, UINT *height, UINT *stride)
static void test_predefined_palette(void)
static IWICImagingFactory * factory
static void test_palette_from_bitmap(void)
@ COINIT_APARTMENTTHREADED
@ WICBitmapPaletteTypeFixedHalftone256
@ WICBitmapPaletteTypeCustom
@ WICBitmapPaletteTypeFixedGray256
@ WICBitmapPaletteTypeFixedBW
@ WICBitmapPaletteTypeFixedHalftone64
@ WICBitmapPaletteTypeFixedGray16
@ WICBitmapPaletteTypeFixedGray4
@ WICBitmapPaletteTypeFixedHalftone216
@ WICBitmapPaletteTypeFixedHalftone27
@ WICBitmapPaletteTypeMedianCut
@ WICBitmapPaletteTypeFixedHalftone125
@ WICBitmapPaletteTypeFixedHalftone8
@ WICBitmapPaletteTypeFixedHalftone252