144 switch (source_format)
153 UINT srcstride, srcdatasize;
171 res = IWICPalette_GetColors(
palette, 2, colors, &actualcolors);
176 srcstride = (
prc->Width+7)/8;
177 srcdatasize = srcstride *
prc->Height;
182 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
188 for (
y=0;
y<
prc->Height;
y++) {
190 dstpixel=(
DWORD*)dstrow;
191 for (
x=0;
x<
prc->Width;
x+=8) {
194 *dstpixel++ = colors[srcval>>7&1];
195 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval>>6&1];
196 if (
x+2 <
prc->Width) *dstpixel++ = colors[srcval>>5&1];
197 if (
x+3 <
prc->Width) *dstpixel++ = colors[srcval>>4&1];
198 if (
x+4 <
prc->Width) *dstpixel++ = colors[srcval>>3&1];
199 if (
x+5 <
prc->Width) *dstpixel++ = colors[srcval>>2&1];
200 if (
x+6 <
prc->Width) *dstpixel++ = colors[srcval>>1&1];
201 if (
x+7 <
prc->Width) *dstpixel++ = colors[srcval&1];
220 UINT srcstride, srcdatasize;
238 res = IWICPalette_GetColors(
palette, 4, colors, &actualcolors);
243 srcstride = (
prc->Width+3)/4;
244 srcdatasize = srcstride *
prc->Height;
249 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
255 for (
y=0;
y<
prc->Height;
y++) {
257 dstpixel=(
DWORD*)dstrow;
258 for (
x=0;
x<
prc->Width;
x+=4) {
261 *dstpixel++ = colors[srcval>>6];
262 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval>>4&0x3];
263 if (
x+2 <
prc->Width) *dstpixel++ = colors[srcval>>2&0x3];
264 if (
x+3 <
prc->Width) *dstpixel++ = colors[srcval&0x3];
283 UINT srcstride, srcdatasize;
301 res = IWICPalette_GetColors(
palette, 16, colors, &actualcolors);
306 srcstride = (
prc->Width+1)/2;
307 srcdatasize = srcstride *
prc->Height;
312 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
318 for (
y=0;
y<
prc->Height;
y++) {
320 dstpixel=(
DWORD*)dstrow;
321 for (
x=0;
x<
prc->Width;
x+=2) {
324 *dstpixel++ = colors[srcval>>4];
325 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval&0xf];
343 UINT srcstride, srcdatasize;
349 srcstride =
prc->Width;
350 srcdatasize = srcstride *
prc->Height;
355 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
361 for (
y=0;
y<
prc->Height;
y++) {
363 dstpixel=(
DWORD*)dstrow;
364 for (
x=0;
x<
prc->Width;
x++)
366 *dstpixel++ = 0xff000000|(*srcbyte<<16)|(*srcbyte<<8)|*srcbyte;
385 UINT srcstride, srcdatasize;
399 res = IWICPalette_GetColors(
palette, 256, colors, &actualcolors);
405 srcstride =
prc->Width;
406 srcdatasize = srcstride *
prc->Height;
411 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
417 for (
y=0;
y<
prc->Height;
y++) {
419 dstpixel=(
DWORD*)dstrow;
420 for (
x=0;
x<
prc->Width;
x++)
421 *dstpixel++ = colors[*srcbyte++];
438 UINT srcstride, srcdatasize;
444 srcstride =
prc->Width * 2;
445 srcdatasize = srcstride *
prc->Height;
450 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
456 for (
y=0;
y<
prc->Height;
y++) {
458 dstpixel=(
DWORD*)dstrow;
459 for (
x=0;
x<
prc->Width;
x++)
462 *dstpixel++ = 0xff000000|(*srcbyte<<16)|(*srcbyte<<8)|*srcbyte;
481 UINT srcstride, srcdatasize;
483 const WORD *srcpixel;
487 srcstride = 2 *
prc->Width;
488 srcdatasize = srcstride *
prc->Height;
493 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
499 for (
y=0;
y<
prc->Height;
y++) {
500 srcpixel=(
const WORD*)srcrow;
501 dstpixel=(
DWORD*)dstrow;
502 for (
x=0;
x<
prc->Width;
x++) {
505 *dstpixel++=0xff000000 |
506 ((srcval << 9) & 0xf80000) |
507 ((srcval << 4) & 0x070000) |
508 ((srcval << 6) & 0x00f800) |
509 ((srcval << 1) & 0x000700) |
510 ((srcval << 3) & 0x0000f8) |
511 ((srcval >> 2) & 0x000007);
529 UINT srcstride, srcdatasize;
531 const WORD *srcpixel;
535 srcstride = 2 *
prc->Width;
536 srcdatasize = srcstride *
prc->Height;
541 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
547 for (
y=0;
y<
prc->Height;
y++) {
548 srcpixel=(
const WORD*)srcrow;
549 dstpixel=(
DWORD*)dstrow;
550 for (
x=0;
x<
prc->Width;
x++) {
553 *dstpixel++=0xff000000 |
554 ((srcval << 8) & 0xf80000) |
555 ((srcval << 3) & 0x070000) |
556 ((srcval << 5) & 0x00fc00) |
557 ((srcval >> 1) & 0x000300) |
558 ((srcval << 3) & 0x0000f8) |
559 ((srcval >> 2) & 0x000007);
577 UINT srcstride, srcdatasize;
579 const WORD *srcpixel;
583 srcstride = 2 *
prc->Width;
584 srcdatasize = srcstride *
prc->Height;
589 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
595 for (
y=0;
y<
prc->Height;
y++) {
596 srcpixel=(
const WORD*)srcrow;
597 dstpixel=(
DWORD*)dstrow;
598 for (
x=0;
x<
prc->Width;
x++) {
601 *dstpixel++=((srcval & 0x8000) ? 0xff000000 : 0) |
602 ((srcval << 9) & 0xf80000) |
603 ((srcval << 4) & 0x070000) |
604 ((srcval << 6) & 0x00f800) |
605 ((srcval << 1) & 0x000700) |
606 ((srcval << 3) & 0x0000f8) |
607 ((srcval >> 2) & 0x000007);
625 UINT srcstride, srcdatasize;
627 const BYTE *srcpixel;
631 srcstride = 3 *
prc->Width;
632 srcdatasize = srcstride *
prc->Height;
637 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
643 for (
y=0;
y<
prc->Height;
y++) {
646 for (
x=0;
x<
prc->Width;
x++) {
647 *dstpixel++=*srcpixel++;
648 *dstpixel++=*srcpixel++;
649 *dstpixel++=*srcpixel++;
668 UINT srcstride, srcdatasize;
670 const BYTE *srcpixel;
675 srcstride = 3 *
prc->Width;
676 srcdatasize = srcstride *
prc->Height;
681 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
687 for (
y=0;
y<
prc->Height;
y++) {
690 for (
x=0;
x<
prc->Width;
x++) {
691 tmppixel[0]=*srcpixel++;
692 tmppixel[1]=*srcpixel++;
693 tmppixel[2]=*srcpixel++;
695 *dstpixel++=tmppixel[2];
696 *dstpixel++=tmppixel[1];
697 *dstpixel++=tmppixel[0];
716 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
720 for (
y=0;
y<
prc->Height;
y++)
721 for (
x=0;
x<
prc->Width;
x++)
722 pbBuffer[cbStride*
y+4*
x+3] = 0xff;
727 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
735 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
738 for (
y=0;
y<
prc->Height;
y++)
739 for (
x=0;
x<
prc->Width;
x++)
744 pbBuffer[cbStride*
y+4*
x] = pbBuffer[cbStride*
y+4*
x] * 255 /
alpha;
745 pbBuffer[cbStride*
y+4*
x+1] = pbBuffer[cbStride*
y+4*
x+1] * 255 /
alpha;
746 pbBuffer[cbStride*
y+4*
x+2] = pbBuffer[cbStride*
y+4*
x+2] * 255 /
alpha;
757 UINT srcstride, srcdatasize;
759 const BYTE *srcpixel;
763 srcstride = 6 *
prc->Width;
764 srcdatasize = srcstride *
prc->Height;
769 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
775 for (
y=0;
y<
prc->Height;
y++) {
777 dstpixel=(
DWORD*)dstrow;
778 for (
x=0;
x<
prc->Width;
x++) {
780 srcpixel++;
red = *srcpixel++;
781 srcpixel++;
green = *srcpixel++;
782 srcpixel++;
blue = *srcpixel++;
801 UINT srcstride, srcdatasize;
803 const BYTE *srcpixel;
807 srcstride = 8 *
prc->Width;
808 srcdatasize = srcstride *
prc->Height;
813 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
819 for (
y=0;
y<
prc->Height;
y++) {
821 dstpixel=(
DWORD*)dstrow;
822 for (
x=0;
x<
prc->Width;
x++) {
824 srcpixel++;
red = *srcpixel++;
825 srcpixel++;
green = *srcpixel++;
826 srcpixel++;
blue = *srcpixel++;
827 srcpixel++;
alpha = *srcpixel++;
846 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
849 for (
y=0;
y<
prc->Height;
y++)
850 for (
x=0;
x<
prc->Width;
x++)
852 BYTE *pixel = pbBuffer+cbStride*
y+4*
x;
853 BYTE c=pixel[0],
m=pixel[1],
y=pixel[2],
k=pixel[3];
854 pixel[0] = (255-
y)*(255-
k)/255;
855 pixel[1] = (255-
m)*(255-
k)/255;
856 pixel[2] = (255-
c)*(255-
k)/255;
HRESULT PaletteImpl_Create(IWICPalette **palette)
GLint GLint GLint GLint GLint x
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WINCODEC_ERR_UNSUPPORTEDOPERATION
GLint GLint GLint GLint GLint GLint y
GLclampf GLclampf GLclampf alpha
#define HeapFree(x, y, z)