88 if (
f <= 0.0031308f)
return 12.92f *
f;
89 return 1.055f *
powf(
f, 1.0f/2.4f) - 0.055f;
93static inline float from_sRGB_component(
float f)
95 if (
f <= 0.04045f)
return f / 12.92f;
96 return powf((
f + 0.055f) / 1.055f, 2.4f);
99static void from_sRGB(
BYTE *bgr)
107 r = from_sRGB_component(
r);
108 g = from_sRGB_component(
g);
109 b = from_sRGB_component(
b);
111 bgr[2] = (
BYTE)(
r * 255.0f);
112 bgr[1] = (
BYTE)(
g * 255.0f);
113 bgr[0] = (
BYTE)(
b * 255.0f);
116static void to_sRGB(
BYTE *bgr)
128 bgr[2] = (
BYTE)(
r * 255.0f);
129 bgr[1] = (
BYTE)(
g * 255.0f);
130 bgr[0] = (
BYTE)(
b * 255.0f);
142 switch (source_format)
151 UINT srcstride, srcdatasize;
169 res = IWICPalette_GetColors(
palette, 2, colors, &actualcolors);
174 srcstride = (
prc->Width+7)/8;
175 srcdatasize = srcstride *
prc->Height;
177 srcdata =
malloc(srcdatasize);
180 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
186 for (
y=0;
y<
prc->Height;
y++) {
188 dstpixel=(
DWORD*)dstrow;
189 for (
x=0;
x<
prc->Width;
x+=8) {
192 *dstpixel++ = colors[srcval>>7&1];
193 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval>>6&1];
194 if (
x+2 <
prc->Width) *dstpixel++ = colors[srcval>>5&1];
195 if (
x+3 <
prc->Width) *dstpixel++ = colors[srcval>>4&1];
196 if (
x+4 <
prc->Width) *dstpixel++ = colors[srcval>>3&1];
197 if (
x+5 <
prc->Width) *dstpixel++ = colors[srcval>>2&1];
198 if (
x+6 <
prc->Width) *dstpixel++ = colors[srcval>>1&1];
199 if (
x+7 <
prc->Width) *dstpixel++ = colors[srcval&1];
218 UINT srcstride, srcdatasize;
236 res = IWICPalette_GetColors(
palette, 4, colors, &actualcolors);
241 srcstride = (
prc->Width+3)/4;
242 srcdatasize = srcstride *
prc->Height;
244 srcdata =
malloc(srcdatasize);
247 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
253 for (
y=0;
y<
prc->Height;
y++) {
255 dstpixel=(
DWORD*)dstrow;
256 for (
x=0;
x<
prc->Width;
x+=4) {
259 *dstpixel++ = colors[srcval>>6];
260 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval>>4&0x3];
261 if (
x+2 <
prc->Width) *dstpixel++ = colors[srcval>>2&0x3];
262 if (
x+3 <
prc->Width) *dstpixel++ = colors[srcval&0x3];
281 UINT srcstride, srcdatasize;
299 res = IWICPalette_GetColors(
palette, 16, colors, &actualcolors);
304 srcstride = (
prc->Width+1)/2;
305 srcdatasize = srcstride *
prc->Height;
307 srcdata =
malloc(srcdatasize);
310 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
316 for (
y=0;
y<
prc->Height;
y++) {
318 dstpixel=(
DWORD*)dstrow;
319 for (
x=0;
x<
prc->Width;
x+=2) {
322 *dstpixel++ = colors[srcval>>4];
323 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval&0xf];
341 UINT srcstride, srcdatasize;
347 srcstride =
prc->Width;
348 srcdatasize = srcstride *
prc->Height;
350 srcdata =
malloc(srcdatasize);
353 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
359 for (
y=0;
y<
prc->Height;
y++) {
361 dstpixel=(
DWORD*)dstrow;
362 for (
x=0;
x<
prc->Width;
x++)
364 *dstpixel++ = 0xff000000|(*srcbyte<<16)|(*srcbyte<<8)|*srcbyte;
383 UINT srcstride, srcdatasize;
397 res = IWICPalette_GetColors(
palette, 256, colors, &actualcolors);
403 srcstride =
prc->Width;
404 srcdatasize = srcstride *
prc->Height;
406 srcdata =
malloc(srcdatasize);
409 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
415 for (
y=0;
y<
prc->Height;
y++) {
417 dstpixel=(
DWORD*)dstrow;
418 for (
x=0;
x<
prc->Width;
x++)
419 *dstpixel++ = colors[*srcbyte++];
436 UINT srcstride, srcdatasize;
442 srcstride =
prc->Width * 2;
443 srcdatasize = srcstride *
prc->Height;
445 srcdata =
malloc(srcdatasize);
448 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
454 for (
y=0;
y<
prc->Height;
y++) {
456 dstpixel=(
DWORD*)dstrow;
457 for (
x=0;
x<
prc->Width;
x++)
460 *dstpixel++ = 0xff000000|(*srcbyte<<16)|(*srcbyte<<8)|*srcbyte;
479 UINT srcstride, srcdatasize;
481 const WORD *srcpixel;
485 srcstride = 2 *
prc->Width;
486 srcdatasize = srcstride *
prc->Height;
488 srcdata =
malloc(srcdatasize);
491 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
497 for (
y=0;
y<
prc->Height;
y++) {
498 srcpixel=(
const WORD*)srcrow;
499 dstpixel=(
DWORD*)dstrow;
500 for (
x=0;
x<
prc->Width;
x++) {
503 *dstpixel++=0xff000000 |
504 ((srcval << 9) & 0xf80000) |
505 ((srcval << 4) & 0x070000) |
506 ((srcval << 6) & 0x00f800) |
507 ((srcval << 1) & 0x000700) |
508 ((srcval << 3) & 0x0000f8) |
509 ((srcval >> 2) & 0x000007);
527 UINT srcstride, srcdatasize;
529 const WORD *srcpixel;
533 srcstride = 2 *
prc->Width;
534 srcdatasize = srcstride *
prc->Height;
536 srcdata =
malloc(srcdatasize);
539 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
545 for (
y=0;
y<
prc->Height;
y++) {
546 srcpixel=(
const WORD*)srcrow;
547 dstpixel=(
DWORD*)dstrow;
548 for (
x=0;
x<
prc->Width;
x++) {
551 *dstpixel++=0xff000000 |
552 ((srcval << 8) & 0xf80000) |
553 ((srcval << 3) & 0x070000) |
554 ((srcval << 5) & 0x00fc00) |
555 ((srcval >> 1) & 0x000300) |
556 ((srcval << 3) & 0x0000f8) |
557 ((srcval >> 2) & 0x000007);
575 UINT srcstride, srcdatasize;
577 const WORD *srcpixel;
581 srcstride = 2 *
prc->Width;
582 srcdatasize = srcstride *
prc->Height;
584 srcdata =
malloc(srcdatasize);
587 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
593 for (
y=0;
y<
prc->Height;
y++) {
594 srcpixel=(
const WORD*)srcrow;
595 dstpixel=(
DWORD*)dstrow;
596 for (
x=0;
x<
prc->Width;
x++) {
599 *dstpixel++=((srcval & 0x8000) ? 0xff000000 : 0) |
600 ((srcval << 9) & 0xf80000) |
601 ((srcval << 4) & 0x070000) |
602 ((srcval << 6) & 0x00f800) |
603 ((srcval << 1) & 0x000700) |
604 ((srcval << 3) & 0x0000f8) |
605 ((srcval >> 2) & 0x000007);
623 UINT srcstride, srcdatasize;
625 const BYTE *srcpixel;
629 srcstride = 3 *
prc->Width;
630 srcdatasize = srcstride *
prc->Height;
632 srcdata =
malloc(srcdatasize);
635 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
641 for (
y=0;
y<
prc->Height;
y++) {
644 for (
x=0;
x<
prc->Width;
x++) {
645 *dstpixel++=*srcpixel++;
646 *dstpixel++=*srcpixel++;
647 *dstpixel++=*srcpixel++;
666 UINT srcstride, srcdatasize;
668 const BYTE *srcpixel;
673 srcstride = 3 *
prc->Width;
674 srcdatasize = srcstride *
prc->Height;
676 srcdata =
malloc(srcdatasize);
679 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
685 for (
y=0;
y<
prc->Height;
y++) {
688 for (
x=0;
x<
prc->Width;
x++) {
689 tmppixel[0]=*srcpixel++;
690 tmppixel[1]=*srcpixel++;
691 tmppixel[2]=*srcpixel++;
693 *dstpixel++=tmppixel[2];
694 *dstpixel++=tmppixel[1];
695 *dstpixel++=tmppixel[0];
714 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
718 for (
y=0;
y<
prc->Height;
y++)
719 for (
x=0;
x<
prc->Width;
x++)
720 pbBuffer[cbStride*
y+4*
x+3] = 0xff;
727 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
734 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
742 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
745 for (
y=0;
y<
prc->Height;
y++)
746 for (
x=0;
x<
prc->Width;
x++)
751 pbBuffer[cbStride*
y+4*
x] = pbBuffer[cbStride*
y+4*
x] * 255 /
alpha;
752 pbBuffer[cbStride*
y+4*
x+1] = pbBuffer[cbStride*
y+4*
x+1] * 255 /
alpha;
753 pbBuffer[cbStride*
y+4*
x+2] = pbBuffer[cbStride*
y+4*
x+2] * 255 /
alpha;
764 UINT srcstride, srcdatasize;
766 const BYTE *srcpixel;
770 srcstride = 6 *
prc->Width;
771 srcdatasize = srcstride *
prc->Height;
773 srcdata =
malloc(srcdatasize);
776 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
782 for (
y=0;
y<
prc->Height;
y++) {
784 dstpixel=(
DWORD*)dstrow;
785 for (
x=0;
x<
prc->Width;
x++) {
787 srcpixel++;
red = *srcpixel++;
788 srcpixel++;
green = *srcpixel++;
789 srcpixel++;
blue = *srcpixel++;
808 UINT srcstride, srcdatasize;
810 const BYTE *srcpixel;
814 srcstride = 8 *
prc->Width;
815 srcdatasize = srcstride *
prc->Height;
817 srcdata =
malloc(srcdatasize);
820 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
826 for (
y=0;
y<
prc->Height;
y++) {
828 dstpixel=(
DWORD*)dstrow;
829 for (
x=0;
x<
prc->Width;
x++) {
831 srcpixel++;
red = *srcpixel++;
832 srcpixel++;
green = *srcpixel++;
833 srcpixel++;
blue = *srcpixel++;
834 srcpixel++;
alpha = *srcpixel++;
853 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
856 for (
y=0;
y<
prc->Height;
y++)
857 for (
x=0;
x<
prc->Width;
x++)
859 BYTE *pixel = pbBuffer+cbStride*
y+4*
x;
860 BYTE c=pixel[0],
m=pixel[1],
y=pixel[2],
k=pixel[3];
861 pixel[0] = (255-
y)*(255-
k)/255;
862 pixel[1] = (255-
m)*(255-
k)/255;
863 pixel[2] = (255-
c)*(255-
k)/255;
869 FIXME(
"Unimplemented conversion path!\n");
879 switch (source_format)
886 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
890 for (
y=0;
y<
prc->Height;
y++)
891 for (
x=0;
x<
prc->Width;
x++)
892 pbBuffer[cbStride*
y+4*
x+3] = 0xff;
898 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
906 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
909 for (
y=0;
y<
prc->Height;
y++)
910 for (
x=0;
x<
prc->Width;
x++)
915 pbBuffer[cbStride*
y+4*
x] = pbBuffer[cbStride*
y+4*
x] * 255 /
alpha;
916 pbBuffer[cbStride*
y+4*
x+1] = pbBuffer[cbStride*
y+4*
x+1] * 255 /
alpha;
917 pbBuffer[cbStride*
y+4*
x+2] = pbBuffer[cbStride*
y+4*
x+2] * 255 /
alpha;
934 switch (source_format)
940 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
950 switch (source_format)
956 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
968 switch (source_format)
972 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
980 for (
y=0;
y<
prc->Height;
y++)
981 for (
x=0;
x<
prc->Width;
x++)
986 pbBuffer[cbStride*
y+4*
x] = (pbBuffer[cbStride*
y+4*
x] *
alpha + 127) / 255;
987 pbBuffer[cbStride*
y+4*
x+1] = (pbBuffer[cbStride*
y+4*
x+1] *
alpha + 127) / 255;
988 pbBuffer[cbStride*
y+4*
x+2] = (pbBuffer[cbStride*
y+4*
x+2] *
alpha + 127) / 255;
1001 switch (source_format)
1005 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1013 for (
y=0;
y<
prc->Height;
y++)
1014 for (
x=0;
x<
prc->Width;
x++)
1019 pbBuffer[cbStride*
y+4*
x] = (pbBuffer[cbStride*
y+4*
x] *
alpha + 127) / 255;
1020 pbBuffer[cbStride*
y+4*
x+1] = (pbBuffer[cbStride*
y+4*
x+1] *
alpha + 127) / 255;
1021 pbBuffer[cbStride*
y+4*
x+2] = (pbBuffer[cbStride*
y+4*
x+2] *
alpha + 127) / 255;
1034 switch (source_format)
1040 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1055 UINT srcstride, srcdatasize;
1057 const BYTE *srcpixel;
1061 srcstride = 4 *
prc->Width;
1062 srcdatasize = srcstride *
prc->Height;
1064 srcdata =
malloc(srcdatasize);
1067 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1076 for (
y = 0;
y <
prc->Height;
y++)
1080 for (
x = 0;
x <
prc->Width;
x++) {
1081 *dstpixel++ = srcpixel[2];
1082 *dstpixel++ = srcpixel[1];
1083 *dstpixel++ = srcpixel[0];
1086 srcrow += srcstride;
1092 for (
y = 0;
y <
prc->Height;
y++)
1096 for (
x = 0;
x <
prc->Width;
x++) {
1097 *dstpixel++ = *srcpixel++;
1098 *dstpixel++ = *srcpixel++;
1099 *dstpixel++ = *srcpixel++;
1102 srcrow += srcstride;
1118 UINT srcstride, srcdatasize;
1120 srcstride = 4 *
prc->Width;
1121 srcdatasize = srcstride *
prc->Height;
1123 srcdata =
malloc(srcdatasize);
1126 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1133 for (
y = 0;
y <
prc->Height;
y++)
1135 float *gray_float = (
float *)
src;
1138 for (
x = 0;
x <
prc->Width;
x++)
1160 UINT srcstride, srcdatasize;
1162 srcstride = 4 *
prc->Width;
1163 srcdatasize = srcstride *
prc->Height;
1165 srcdata =
malloc(srcdatasize);
1168 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1174 for (
y = 0;
y <
prc->Height;
y++)
1179 for (
x = 0;
x <
prc->Width;
x++)
1181 BYTE c = cmyk[0],
m = cmyk[1],
y = cmyk[2],
k = cmyk[3];
1182 bgr[0] = (255 -
y) * (255 -
k) / 255;
1183 bgr[1] = (255 -
m) * (255 -
k) / 255;
1184 bgr[2] = (255 -
c) * (255 -
k) / 255;
1199 FIXME(
"Unimplemented conversion path!\n");
1209 switch (source_format)
1215 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1229 UINT srcstride, srcdatasize;
1231 const BYTE *srcpixel;
1236 srcstride = 4 *
prc->Width;
1237 srcdatasize = srcstride *
prc->Height;
1239 srcdata =
malloc(srcdatasize);
1242 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1248 for (
y=0;
y<
prc->Height;
y++) {
1251 for (
x=0;
x<
prc->Width;
x++) {
1252 tmppixel[0]=*srcpixel++;
1253 tmppixel[1]=*srcpixel++;
1254 tmppixel[2]=*srcpixel++;
1257 *dstpixel++=tmppixel[2];
1258 *dstpixel++=tmppixel[1];
1259 *dstpixel++=tmppixel[0];
1261 srcrow += srcstride;
1272 FIXME(
"Unimplemented conversion path!\n");
1282 switch (source_format)
1290 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1305 for (
y = 0;
y <
prc->Height;
y++)
1308 for (
x = 0;
x <
prc->Width;
x++)
1310 float gray = (bgr[2] * 0.2126f + bgr[1] * 0.7152f + bgr[0] * 0.0722f) / 255.0f;
1311 *(
float *)bgr = gray;
1325 UINT srcstride, srcdatasize;
1330 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1341 srcstride = 4 *
prc->Width;
1342 srcdatasize = srcstride *
prc->Height;
1344 srcdata =
malloc(srcdatasize);
1347 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1353 for (
y=0;
y <
prc->Height;
y++)
1355 float *srcpixel = (
float*)
src;
1358 for (
x=0;
x <
prc->Width;
x++)
1375 srcstride = 3 *
prc->Width;
1376 srcdatasize = srcstride *
prc->Height;
1378 srcdata =
malloc(srcdatasize);
1387 for (
y = 0;
y <
prc->Height;
y++)
1391 for (
x = 0;
x <
prc->Width;
x++)
1393 float gray = (bgr[2] * 0.2126f + bgr[1] * 0.7152f + bgr[0] * 0.0722f) / 255.0f;
1410 UINT best_diff, best_index,
i;
1417 BYTE pal_r, pal_g, pal_b;
1418 UINT diff_r, diff_g, diff_b, diff;
1420 pal_r = colors[
i] >> 16;
1421 pal_g = colors[
i] >> 8;
1424 diff_r = bgr[2] - pal_r;
1425 diff_g = bgr[1] - pal_g;
1426 diff_b = bgr[0] - pal_b;
1428 diff = diff_r * diff_r + diff_g * diff_g + diff_b * diff_b;
1429 if (diff == 0)
return i;
1431 if (diff < best_diff)
1452 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1462 hr = IWICPalette_GetColors(
This->palette, 256, colors, &
count);
1465 srcstride = 3 *
prc->Width;
1466 srcdatasize = srcstride *
prc->Height;
1468 srcdata =
malloc(srcdatasize);
1477 for (
y = 0;
y <
prc->Height;
y++)
1481 for (
x = 0;
x <
prc->Width;
x++)
1498 switch (source_format)
1502 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1510 UINT srcstride, srcdatasize;
1512 const DWORD *srcpixel;
1519 srcstride = 4 *
prc->Width;
1520 srcdatasize = srcstride *
prc->Height;
1522 srcdata =
malloc(srcdatasize);
1525 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1530 for(
y=0;
y<
prc->Height;
y++) {
1531 srcpixel = (
const DWORD*)srcrow;
1532 dstpixel = (
WORD *)dstrow;
1533 for(
x=0;
x<
prc->Width;
x++) {
1535 a = (srcval & 0xff000000) >> 24;
1536 r = (srcval & 0x00ff0000) >> 16;
1537 g = (srcval & 0x0000ff00) >> 8;
1538 b = (srcval & 0x000000ff);
1543 *dstpixel++ = (
a|
r|
g|
b);
1545 srcrow += srcstride;
1553 FIXME(
"Unimplemented conversion path! %d\n", source_format);
1563 switch (source_format)
1567 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
1572 UINT srcstride, srcdatasize;
1583 srcstride = 6 *
prc->Width;
1584 srcdatasize = srcstride *
prc->Height;
1586 srcdata =
malloc(srcdatasize);
1589 hr = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
1594 for (
y = 0;
y <
prc->Height;
y++)
1596 srcpixel = (
USHORT *)srcrow;
1597 dstpixel= (
USHORT *)dstrow;
1598 for (
x = 0;
x <
prc->Width;
x++)
1600 *dstpixel++ = *srcpixel++;
1601 *dstpixel++ = *srcpixel++;
1602 *dstpixel++ = *srcpixel++;
1603 *dstpixel++ = 65535;
1605 srcrow += srcstride;
1613 FIXME(
"Unimplemented conversion path %d.\n", source_format);
1668 *
ppv = &
This->IWICFormatConverter_iface;
1685 TRACE(
"(%p) refcount=%lu\n", iface,
ref);
1695 TRACE(
"(%p) refcount=%lu\n", iface,
ref);
1699 This->lock.DebugInfo->Spare[0] = 0;
1701 if (
This->source) IWICBitmapSource_Release(
This->source);
1702 if (
This->palette) IWICPalette_Release(
This->palette);
1714 TRACE(
"(%p,%p,%p)\n", iface, puiWidth, puiHeight);
1717 return IWICBitmapSource_GetSize(
This->source, puiWidth, puiHeight);
1727 TRACE(
"(%p,%p)\n", iface, pPixelFormat);
1738 double *pDpiX,
double *pDpiY)
1742 TRACE(
"(%p,%p,%p)\n", iface, pDpiX, pDpiY);
1745 return IWICBitmapSource_GetResolution(
This->source, pDpiX, pDpiY);
1763 return IWICBitmapSource_CopyPalette(
This->source,
palette);
1766 return IWICPalette_InitializeFromPalette(
palette,
This->palette);
1791 return This->dst_format->copy_function(
This,
prc, cbStride, cbBufferSize,
1792 pbBuffer,
This->src_format->format);
1807 TRACE(
"(%p,%p,%s,%u,%p,%0.3f,%u)\n", iface,
source,
debugstr_guid(dstFormat),
1833 if (
dstinfo->is_indexed_format)
1839 if (
dstinfo->is_indexed_format)
1845 if (
dstinfo->is_indexed_format)
1867 res = IWICBitmapSource_GetPixelFormat(
source, &srcFormat);
1880 IWICBitmapSource_AddRef(
source);
1881 This->src_format = srcinfo;
1883 This->dither = dither;
1884 This->alpha_threshold = alpha_threshold;
1930 *pfCanConvert =
TRUE;
1934 *pfCanConvert =
FALSE;
1974 This->lock.DebugInfo->Spare[0] = (
DWORD_PTR)(__FILE__
": FormatConverter.lock");
1976 ret = IWICFormatConverter_QueryInterface(&
This->IWICFormatConverter_iface, iid,
ppv);
1977 IWICFormatConverter_Release(&
This->IWICFormatConverter_iface);
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
WICBitmapPaletteType palette_type
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
static HRESULT WINAPI FormatConverter_QueryInterface(IWICFormatConverter *iface, REFIID iid, void **ppv)
static UINT rgb_to_palette_index(BYTE bgr[3], WICColor *colors, UINT count)
static HRESULT copypixels_to_32bppRGB(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static FormatConverter * impl_from_IWICFormatConverter(IWICFormatConverter *iface)
static HRESULT WINAPI FormatConverter_CanConvert(IWICFormatConverter *iface, REFWICPixelFormatGUID srcPixelFormat, REFWICPixelFormatGUID dstPixelFormat, BOOL *pfCanConvert)
static const IWICFormatConverterVtbl FormatConverter_Vtbl
static HRESULT WINAPI FormatConverter_CopyPalette(IWICFormatConverter *iface, IWICPalette *palette)
static HRESULT copypixels_to_32bppPRGBA(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
HRESULT FormatConverter_CreateInstance(REFIID iid, void **ppv)
static HRESULT WINAPI FormatConverter_GetResolution(IWICFormatConverter *iface, double *pDpiX, double *pDpiY)
static HRESULT copypixels_to_32bppBGR(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT WINAPI FormatConverter_Initialize(IWICFormatConverter *iface, IWICBitmapSource *source, REFWICPixelFormatGUID dstFormat, WICBitmapDitherType dither, IWICPalette *palette, double alpha_threshold, WICBitmapPaletteType palette_type)
static ULONG WINAPI FormatConverter_Release(IWICFormatConverter *iface)
static HRESULT copypixels_to_24bppBGR(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static const struct pixelformatinfo supported_formats[]
static const struct pixelformatinfo * get_formatinfo(const WICPixelFormatGUID *format)
static HRESULT copypixels_to_24bppRGB(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT copypixels_to_64bppRGBA(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT copypixels_to_8bppGray(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT copypixels_to_8bppIndexed(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT WINAPI FormatConverter_CopyPixels(IWICFormatConverter *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer)
static float to_sRGB_component(float f)
static HRESULT copypixels_to_32bppRGBA(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static ULONG WINAPI FormatConverter_AddRef(IWICFormatConverter *iface)
static HRESULT copypixels_to_32bppBGRA(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT copypixels_to_32bppPBGRA(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT WINAPI FormatConverter_GetPixelFormat(IWICFormatConverter *iface, WICPixelFormatGUID *pPixelFormat)
HRESULT(* copyfunc)(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT copypixels_to_16bppBGRA5551(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT copypixels_to_32bppGrayFloat(struct FormatConverter *This, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer, enum pixelformat source_format)
static HRESULT WINAPI FormatConverter_GetSize(IWICFormatConverter *iface, UINT *puiWidth, UINT *puiHeight)
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
HRESULT PaletteImpl_Create(IWICPalette **palette)
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLclampf GLclampf GLclampf alpha
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
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
_Check_return_ float __cdecl powf(_In_ float b, _In_ float e)
#define memcpy(s1, s2, n)
#define IsEqualGUID(rguid1, rguid2)
#define IsEqualIID(riid1, riid2)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define CONTAINING_RECORD(address, type, field)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
@ WICBitmapPaletteTypeCustom
@ WICBitmapPaletteTypeFixedBW
@ WICBitmapPaletteTypeFixedGray16
@ WICBitmapPaletteTypeFixedGray4
@ WICBitmapPaletteTypeMedianCut
void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride)
static const char * debug_wic_rect(const WICRect *rect)
#define WINCODEC_ERR_WRONGSTATE
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
#define WINCODEC_ERR_NOTINITIALIZED
#define WINCODEC_ERR_UNSUPPORTEDPIXELFORMAT
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO