2 * Copyright 2009 Vincent Povirk for CodeWeavers
3 * Copyright 2012 Dmitry Timoshkov
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "wine/test.h"
30 static void test_custom_palette(void)
32 IWICImagingFactory
*factory
;
33 IWICPalette
*palette
, *palette2
;
35 WICBitmapPaletteType type
=0xffffffff;
37 const WICColor initcolors
[4]={0xff000000,0xff0000ff,0xffffff00,0xffffffff};
41 hr
= CoCreateInstance(&CLSID_WICImagingFactory
, NULL
, CLSCTX_INPROC_SERVER
,
42 &IID_IWICImagingFactory
, (void**)&factory
);
43 ok(SUCCEEDED(hr
), "CoCreateInstance failed, hr=%x\n", hr
);
44 if (FAILED(hr
)) return;
46 hr
= IWICImagingFactory_CreatePalette(factory
, &palette
);
47 ok(SUCCEEDED(hr
), "CreatePalette failed, hr=%x\n", hr
);
50 hr
= IWICPalette_GetType(palette
, &type
);
51 ok(SUCCEEDED(hr
), "GetType failed, hr=%x\n", hr
);
52 ok(type
== WICBitmapPaletteTypeCustom
, "expected WICBitmapPaletteTypeCustom, got %x\n", type
);
54 hr
= IWICPalette_GetColorCount(palette
, &count
);
55 ok(SUCCEEDED(hr
), "GetColorCount failed, hr=%x\n", hr
);
56 ok(count
== 0, "expected 0, got %u\n", count
);
58 hr
= IWICPalette_GetColors(palette
, 0, colors
, &count
);
59 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
60 ok(count
== 0, "expected 0, got %u\n", count
);
62 hr
= IWICPalette_GetColors(palette
, 4, colors
, &count
);
63 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
64 ok(count
== 0, "expected 0, got %u\n", count
);
66 memcpy(colors
, initcolors
, sizeof(initcolors
));
67 hr
= IWICPalette_InitializeCustom(palette
, colors
, 4);
68 ok(SUCCEEDED(hr
), "InitializeCustom failed, hr=%x\n", hr
);
70 hr
= IWICPalette_GetType(palette
, &type
);
71 ok(SUCCEEDED(hr
), "GetType failed, hr=%x\n", hr
);
72 ok(type
== WICBitmapPaletteTypeCustom
, "expected WICBitmapPaletteTypeCustom, got %x\n", type
);
74 hr
= IWICPalette_GetColorCount(palette
, &count
);
75 ok(SUCCEEDED(hr
), "GetColorCount failed, hr=%x\n", hr
);
76 ok(count
== 4, "expected 4, got %u\n", count
);
78 memset(colors
, 0, sizeof(colors
));
80 hr
= IWICPalette_GetColors(palette
, 4, colors
, &count
);
81 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
82 ok(count
== 4, "expected 4, got %u\n", count
);
83 ok(!memcmp(colors
, initcolors
, sizeof(colors
)), "got unexpected palette data\n");
85 memset(colors
, 0, sizeof(colors
));
87 hr
= IWICPalette_GetColors(palette
, 2, colors
, &count
);
88 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
89 ok(count
== 2, "expected 2, got %u\n", count
);
90 ok(!memcmp(colors
, initcolors
, sizeof(WICColor
)*2), "got unexpected palette data\n");
93 hr
= IWICPalette_GetColors(palette
, 6, colors
, &count
);
94 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
95 ok(count
== 4, "expected 4, got %u\n", count
);
97 hr
= IWICPalette_HasAlpha(palette
, &boolresult
);
98 ok(SUCCEEDED(hr
), "HasAlpha failed, hr=%x\n", hr
);
99 ok(!boolresult
, "expected FALSE, got TRUE\n");
101 hr
= IWICPalette_IsBlackWhite(palette
, &boolresult
);
102 ok(SUCCEEDED(hr
), "IsBlackWhite failed, hr=%x\n", hr
);
103 ok(!boolresult
, "expected FALSE, got TRUE\n");
105 hr
= IWICPalette_IsGrayscale(palette
, &boolresult
);
106 ok(SUCCEEDED(hr
), "IsGrayscale failed, hr=%x\n", hr
);
107 ok(!boolresult
, "expected FALSE, got TRUE\n");
109 hr
= IWICImagingFactory_CreatePalette(factory
, &palette2
);
110 ok(SUCCEEDED(hr
), "CreatePalette failed, hr=%x\n", hr
);
112 hr
= IWICPalette_InitializeFromPalette(palette2
, palette
);
113 ok(SUCCEEDED(hr
), "InitializeFromPalette failed, hr=%x\n", hr
);
116 hr
= IWICPalette_GetType(palette2
, &type
);
117 ok(SUCCEEDED(hr
), "GetType failed, hr=%x\n", hr
);
118 ok(type
== WICBitmapPaletteTypeCustom
, "expected WICBitmapPaletteTypeCustom, got %x\n", type
);
121 hr
= IWICPalette_GetColorCount(palette2
, &count
);
122 ok(SUCCEEDED(hr
), "GetColorCount failed, hr=%x\n", hr
);
123 ok(count
== 4, "expected 4, got %u\n", count
);
125 memset(colors
, 0, sizeof(colors
));
127 hr
= IWICPalette_GetColors(palette2
, 4, colors
, &count
);
128 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
129 ok(count
== 4, "expected 4, got %u\n", count
);
130 ok(!memcmp(colors
, initcolors
, sizeof(colors
)), "got unexpected palette data\n");
132 /* try a palette with some alpha in it */
133 colors
[2] = 0x80ffffff;
134 hr
= IWICPalette_InitializeCustom(palette
, colors
, 4);
135 ok(SUCCEEDED(hr
), "InitializeCustom failed, hr=%x\n", hr
);
137 hr
= IWICPalette_HasAlpha(palette
, &boolresult
);
138 ok(SUCCEEDED(hr
), "HasAlpha failed, hr=%x\n", hr
);
139 ok(boolresult
, "expected TRUE, got FALSE\n");
141 /* setting to a 0-color palette is acceptable */
142 hr
= IWICPalette_InitializeCustom(palette
, NULL
, 0);
143 ok(SUCCEEDED(hr
), "InitializeCustom failed, hr=%x\n", hr
);
146 hr
= IWICPalette_GetType(palette
, &type
);
147 ok(SUCCEEDED(hr
), "GetType failed, hr=%x\n", hr
);
148 ok(type
== WICBitmapPaletteTypeCustom
, "expected WICBitmapPaletteTypeCustom, got %x\n", type
);
151 hr
= IWICPalette_GetColorCount(palette
, &count
);
152 ok(SUCCEEDED(hr
), "GetColorCount failed, hr=%x\n", hr
);
153 ok(count
== 0, "expected 0, got %u\n", count
);
156 hr
= IWICPalette_GetColors(palette
, 4, colors
, &count
);
157 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
158 ok(count
== 0, "expected 0, got %u\n", count
);
160 hr
= IWICPalette_InitializeFromPalette(palette2
, palette
);
161 ok(SUCCEEDED(hr
), "InitializeFromPalette failed, hr=%x\n", hr
);
164 hr
= IWICPalette_GetType(palette2
, &type
);
165 ok(SUCCEEDED(hr
), "GetType failed, hr=%x\n", hr
);
166 ok(type
== WICBitmapPaletteTypeCustom
, "expected WICBitmapPaletteTypeCustom, got %x\n", type
);
169 hr
= IWICPalette_GetColorCount(palette2
, &count
);
170 ok(SUCCEEDED(hr
), "GetColorCount failed, hr=%x\n", hr
);
171 ok(count
== 0, "expected 0, got %u\n", count
);
173 memset(colors
, 0, sizeof(colors
));
175 hr
= IWICPalette_GetColors(palette2
, 4, colors
, &count
);
176 ok(SUCCEEDED(hr
), "GetColors failed, hr=%x\n", hr
);
177 ok(count
== 0, "expected 0, got %u\n", count
);
179 /* IWICPalette is paranoid about NULL pointers */
180 hr
= IWICPalette_GetType(palette
, NULL
);
181 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
183 hr
= IWICPalette_GetColorCount(palette
, NULL
);
184 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
186 hr
= IWICPalette_InitializeCustom(palette
, NULL
, 4);
187 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
189 hr
= IWICPalette_GetColors(palette
, 4, NULL
, &count
);
190 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
192 hr
= IWICPalette_GetColors(palette
, 4, colors
, NULL
);
193 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
195 hr
= IWICPalette_HasAlpha(palette
, NULL
);
196 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
198 hr
= IWICPalette_IsBlackWhite(palette
, NULL
);
199 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
201 hr
= IWICPalette_IsGrayscale(palette
, NULL
);
202 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
204 hr
= IWICPalette_InitializeFromPalette(palette
, NULL
);
205 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %x\n", hr
);
207 IWICPalette_Release(palette2
);
208 IWICPalette_Release(palette
);
211 IWICImagingFactory_Release(factory
);
214 static void generate_gray16_palette(DWORD
*entries
, UINT count
)
220 for (i
= 0; i
< 16; i
++)
222 entries
[i
] = 0xff000000;
223 entries
[i
] |= (i
<< 20) | (i
<< 16) | (i
<< 12) | (i
<< 8) | (i
<< 4) | i
;
227 static void generate_gray256_palette(DWORD
*entries
, UINT count
)
231 assert(count
== 256);
233 for (i
= 0; i
< 256; i
++)
235 entries
[i
] = 0xff000000;
236 entries
[i
] |= (i
<< 16) | (i
<< 8) | i
;
240 static void generate_halftone8_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
245 ok(count
== 17, "expected 17, got %u\n", count
);
247 ok(count
== 16, "expected 16, got %u\n", count
);
249 for (i
= 0; i
< 8; i
++)
251 entries
[i
] = 0xff000000;
252 if (i
& 1) entries
[i
] |= 0xff;
253 if (i
& 2) entries
[i
] |= 0xff00;
254 if (i
& 4) entries
[i
] |= 0xff0000;
257 for (i
= 8; i
< 16; i
++)
259 static const DWORD halftone
[8] = { 0xc0c0c0, 0x808080, 0x800000, 0x008000,
260 0x000080, 0x808000, 0x800080, 0x008080 };
261 entries
[i
] = 0xff000000;
262 entries
[i
] |= halftone
[i
-8];
269 static void generate_halftone27_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
271 static const BYTE halftone_values
[4] = { 0x00,0x80,0xff };
275 ok(count
== 29, "expected 29, got %u\n", count
);
277 ok(count
== 28, "expected 28, got %u\n", count
);
279 for (i
= 0; i
< 27; i
++)
281 entries
[i
] = 0xff000000;
282 entries
[i
] |= halftone_values
[i
%3];
283 entries
[i
] |= halftone_values
[(i
/3)%3] << 8;
284 entries
[i
] |= halftone_values
[(i
/9)%3] << 16;
287 entries
[i
++] = 0xffc0c0c0;
292 static void generate_halftone64_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
294 static const BYTE halftone_values
[4] = { 0x00,0x55,0xaa,0xff };
298 ok(count
== 73, "expected 73, got %u\n", count
);
300 ok(count
== 72, "expected 72, got %u\n", count
);
302 for (i
= 0; i
< 64; i
++)
304 entries
[i
] = 0xff000000;
305 entries
[i
] |= halftone_values
[i
%4];
306 entries
[i
] |= halftone_values
[(i
/4)%4] << 8;
307 entries
[i
] |= halftone_values
[(i
/16)%4] << 16;
310 for (i
= 64; i
< 72; i
++)
312 static const DWORD halftone
[8] = { 0xc0c0c0, 0x808080, 0x800000, 0x008000,
313 0x000080, 0x808000, 0x800080, 0x008080 };
314 entries
[i
] = 0xff000000;
315 entries
[i
] |= halftone
[i
-64];
322 static void generate_halftone125_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
324 static const BYTE halftone_values
[5] = { 0x00, 0x40, 0x80, 0xbf, 0xff };
328 ok(count
== 127, "expected 127, got %u\n", count
);
330 ok(count
== 126, "expected 126, got %u\n", count
);
332 for (i
= 0; i
< 125; i
++)
334 entries
[i
] = 0xff000000;
335 entries
[i
] |= halftone_values
[i
%5];
336 entries
[i
] |= halftone_values
[(i
/5)%5] << 8;
337 entries
[i
] |= halftone_values
[(i
/25)%5] << 16;
340 entries
[i
++] = 0xffc0c0c0;
345 static void generate_halftone216_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
347 static const BYTE halftone_values
[6] = { 0x00,0x33,0x66,0x99,0xcc,0xff };
351 ok(count
== 225, "expected 225, got %u\n", count
);
353 ok(count
== 224, "expected 224, got %u\n", count
);
355 for (i
= 0; i
< 216; i
++)
357 entries
[i
] = 0xff000000;
358 entries
[i
] |= halftone_values
[i
%6];
359 entries
[i
] |= halftone_values
[(i
/6)%6] << 8;
360 entries
[i
] |= halftone_values
[(i
/36)%6] << 16;
363 for (i
= 216; i
< 224; i
++)
365 static const DWORD halftone
[8] = { 0xc0c0c0, 0x808080, 0x800000, 0x008000,
366 0x000080, 0x808000, 0x800080, 0x008080 };
367 entries
[i
] = 0xff000000;
368 entries
[i
] |= halftone
[i
-216];
375 static void generate_halftone252_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
377 static const BYTE halftone_values_rb
[6] = { 0x00,0x33,0x66,0x99,0xcc,0xff };
378 static const BYTE halftone_values_g
[7] = { 0x00,0x2b,0x55,0x80,0xaa,0xd5,0xff };
382 ok(count
== 253, "expected 253, got %u\n", count
);
384 ok(count
== 252, "expected 252, got %u\n", count
);
386 for (i
= 0; i
< 252; i
++)
388 entries
[i
] = 0xff000000;
389 entries
[i
] |= halftone_values_rb
[i
%6];
390 entries
[i
] |= halftone_values_g
[(i
/6)%7] << 8;
391 entries
[i
] |= halftone_values_rb
[(i
/42)%6] << 16;
398 static void generate_halftone256_palette(DWORD
*entries
, UINT count
, BOOL add_transparent
)
400 static const BYTE halftone_values_b
[4] = { 0x00,0x55,0xaa,0xff };
401 static const BYTE halftone_values_gr
[8] = { 0x00,0x24,0x49,0x6d,0x92,0xb6,0xdb,0xff };
404 assert(count
== 256);
406 for (i
= 0; i
< 256; i
++)
408 entries
[i
] = 0xff000000;
409 entries
[i
] |= halftone_values_b
[i
%4];
410 entries
[i
] |= halftone_values_gr
[(i
/4)%8] << 8;
411 entries
[i
] |= halftone_values_gr
[(i
/32)%8] << 16;
418 static void test_predefined_palette(void)
420 static struct test_data
422 WICBitmapPaletteType type
;
426 BOOL add_transparent
;
429 { WICBitmapPaletteTypeFixedBW
, 1, 1, 2, { 0xff000000, 0xffffffff } },
430 { WICBitmapPaletteTypeFixedBW
, 1, 1, 2, { 0xff000000, 0xffffffff }, 1 },
431 { WICBitmapPaletteTypeFixedGray4
, 0, 1, 4,
432 { 0xff000000, 0xff555555, 0xffaaaaaa, 0xffffffff } },
433 { WICBitmapPaletteTypeFixedGray4
, 0, 1, 4,
434 { 0xff000000, 0xff555555, 0xffaaaaaa, 0xffffffff }, 1 },
435 { WICBitmapPaletteTypeFixedGray16
, 0, 1, 16, { 0 } },
436 { WICBitmapPaletteTypeFixedGray16
, 0, 1, 16, { 0 }, 1 },
437 { WICBitmapPaletteTypeFixedGray256
, 0, 1, 256, { 0 } },
438 { WICBitmapPaletteTypeFixedGray256
, 0, 1, 256, { 0 }, 1 },
439 { WICBitmapPaletteTypeFixedHalftone8
, 0, 0, 16, { 0 } },
440 { WICBitmapPaletteTypeFixedHalftone8
, 0, 0, 17, { 0 }, 1 },
441 { WICBitmapPaletteTypeFixedHalftone27
, 0, 0, 28, { 0 } },
442 { WICBitmapPaletteTypeFixedHalftone27
, 0, 0, 29, { 0 }, 1 },
443 { WICBitmapPaletteTypeFixedHalftone64
, 0, 0, 72, { 0 } },
444 { WICBitmapPaletteTypeFixedHalftone64
, 0, 0, 73, { 0 }, 1 },
445 { WICBitmapPaletteTypeFixedHalftone125
, 0, 0, 126, { 0 } },
446 { WICBitmapPaletteTypeFixedHalftone125
, 0, 0, 127, { 0 }, 1 },
447 { WICBitmapPaletteTypeFixedHalftone216
, 0, 0, 224, { 0 } },
448 { WICBitmapPaletteTypeFixedHalftone216
, 0, 0, 225, { 0 }, 1 },
449 { WICBitmapPaletteTypeFixedHalftone252
, 0, 0, 252, { 0 } },
450 { WICBitmapPaletteTypeFixedHalftone252
, 0, 0, 253, { 0 }, 1 },
451 { WICBitmapPaletteTypeFixedHalftone256
, 0, 0, 256, { 0 } },
452 { WICBitmapPaletteTypeFixedHalftone256
, 0, 0, 256, { 0 }, 1 }
454 IWICImagingFactory
*factory
;
455 IWICPalette
*palette
;
457 WICBitmapPaletteType type
;
462 hr
= CoCreateInstance(&CLSID_WICImagingFactory
, NULL
, CLSCTX_INPROC_SERVER
,
463 &IID_IWICImagingFactory
, (void **)&factory
);
464 ok(hr
== S_OK
, "CoCreateInstance error %#x\n", hr
);
466 hr
= IWICImagingFactory_CreatePalette(factory
, &palette
);
467 ok(hr
== S_OK
, "CreatePalette error %#x\n", hr
);
468 hr
= IWICPalette_InitializePredefined(palette
, WICBitmapPaletteTypeCustom
, FALSE
);
469 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %#x\n", hr
);
470 hr
= IWICPalette_InitializePredefined(palette
, WICBitmapPaletteTypeMedianCut
, FALSE
);
471 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %#x\n", hr
);
472 hr
= IWICPalette_InitializePredefined(palette
, 0x0f, FALSE
);
473 ok(hr
== E_INVALIDARG
, "expected E_INVALIDARG, got %#x\n", hr
);
474 IWICPalette_Release(palette
);
476 for (i
= 0; i
< sizeof(td
)/sizeof(td
[0]); i
++)
478 hr
= IWICImagingFactory_CreatePalette(factory
, &palette
);
479 ok(hr
== S_OK
, "%u: CreatePalette error %#x\n", i
, hr
);
481 hr
= IWICPalette_InitializePredefined(palette
, td
[i
].type
, td
[i
].add_transparent
);
482 ok(hr
== S_OK
, "%u: InitializePredefined error %#x\n", i
, hr
);
485 hr
= IWICPalette_IsBlackWhite(palette
, &bret
);
486 ok(hr
== S_OK
, "%u: IsBlackWhite error %#x\n", i
, hr
);
487 ok(bret
== td
[i
].is_bw
||
488 broken(td
[i
].type
== WICBitmapPaletteTypeFixedBW
&& bret
!= td
[i
].is_bw
), /* XP */
489 "%u: expected %d, got %d\n",i
, td
[i
].is_bw
, bret
);
492 hr
= IWICPalette_IsGrayscale(palette
, &bret
);
493 ok(hr
== S_OK
, "%u: IsGrayscale error %#x\n", i
, hr
);
494 ok(bret
== td
[i
].is_gray
, "%u: expected %d, got %d\n", i
, td
[i
].is_gray
, bret
);
497 hr
= IWICPalette_GetType(palette
, &type
);
498 ok(hr
== S_OK
, "%u: GetType error %#x\n", i
, hr
);
499 ok(type
== td
[i
].type
, "%u: expected %#x, got %#x\n", i
, td
[i
].type
, type
);
502 hr
= IWICPalette_GetColorCount(palette
, &count
);
503 ok(hr
== S_OK
, "%u: GetColorCount error %#x\n", i
, hr
);
504 ok(count
== td
[i
].count
, "%u: expected %u, got %u\n", i
, td
[i
].count
, count
);
506 hr
= IWICPalette_GetColors(palette
, count
, color
, &ret
);
507 ok(hr
== S_OK
, "%u: GetColors error %#x\n", i
, hr
);
508 ok(ret
== count
, "%u: expected %u, got %u\n", i
, count
, ret
);
509 if (ret
== td
[i
].count
)
513 if (td
[i
].type
== WICBitmapPaletteTypeFixedGray16
)
514 generate_gray16_palette(td
[i
].color
, td
[i
].count
);
515 else if (td
[i
].type
== WICBitmapPaletteTypeFixedGray256
)
516 generate_gray256_palette(td
[i
].color
, td
[i
].count
);
517 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone8
)
518 generate_halftone8_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
519 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone27
)
520 generate_halftone27_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
521 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone64
)
522 generate_halftone64_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
523 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone125
)
524 generate_halftone125_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
525 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone216
)
526 generate_halftone216_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
527 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone252
)
528 generate_halftone252_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
529 else if (td
[i
].type
== WICBitmapPaletteTypeFixedHalftone256
)
530 generate_halftone256_palette(td
[i
].color
, td
[i
].count
, td
[i
].add_transparent
);
532 for (j
= 0; j
< count
; j
++)
534 ok(color
[j
] == td
[i
].color
[j
], "%u:[%u]: expected %#x, got %#x\n",
535 i
, j
, td
[i
].color
[j
], color
[j
]);
539 IWICPalette_Release(palette
);
542 IWICImagingFactory_Release(factory
);
547 CoInitializeEx(NULL
, COINIT_APARTMENTTHREADED
);
549 test_custom_palette();
550 test_predefined_palette();