143{
144 switch (source_format)
145 {
149 {
153 UINT srcstride, srcdatasize;
161
164
167 else
169
171 res = IWICPalette_GetColors(
palette, 2, colors, &actualcolors);
172
175
176 srcstride = (
prc->Width+7)/8;
177 srcdatasize = srcstride *
prc->Height;
178
181
182 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
183
185 {
186 srcrow = srcdata;
187 dstrow = pbBuffer;
188 for (
y=0;
y<
prc->Height;
y++) {
189 srcbyte = srcrow;
190 dstpixel=(
DWORD*)dstrow;
191 for (
x=0;
x<
prc->Width;
x+=8) {
193 srcval=*srcbyte++;
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];
202 }
203 srcrow += srcstride;
204 dstrow += cbStride;
205 }
206 }
207
209
211 }
216 {
220 UINT srcstride, srcdatasize;
228
231
234 else
236
238 res = IWICPalette_GetColors(
palette, 4, colors, &actualcolors);
239
242
243 srcstride = (
prc->Width+3)/4;
244 srcdatasize = srcstride *
prc->Height;
245
248
249 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
250
252 {
253 srcrow = srcdata;
254 dstrow = pbBuffer;
255 for (
y=0;
y<
prc->Height;
y++) {
256 srcbyte = srcrow;
257 dstpixel=(
DWORD*)dstrow;
258 for (
x=0;
x<
prc->Width;
x+=4) {
260 srcval=*srcbyte++;
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];
265 }
266 srcrow += srcstride;
267 dstrow += cbStride;
268 }
269 }
270
272
274 }
279 {
283 UINT srcstride, srcdatasize;
291
294
297 else
299
301 res = IWICPalette_GetColors(
palette, 16, colors, &actualcolors);
302
305
306 srcstride = (
prc->Width+1)/2;
307 srcdatasize = srcstride *
prc->Height;
308
311
312 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
313
315 {
316 srcrow = srcdata;
317 dstrow = pbBuffer;
318 for (
y=0;
y<
prc->Height;
y++) {
319 srcbyte = srcrow;
320 dstpixel=(
DWORD*)dstrow;
321 for (
x=0;
x<
prc->Width;
x+=2) {
323 srcval=*srcbyte++;
324 *dstpixel++ = colors[srcval>>4];
325 if (
x+1 <
prc->Width) *dstpixel++ = colors[srcval&0xf];
326 }
327 srcrow += srcstride;
328 dstrow += cbStride;
329 }
330 }
331
333
335 }
339 {
343 UINT srcstride, srcdatasize;
348
349 srcstride =
prc->Width;
350 srcdatasize = srcstride *
prc->Height;
351
354
355 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
356
358 {
359 srcrow = srcdata;
360 dstrow = pbBuffer;
361 for (
y=0;
y<
prc->Height;
y++) {
362 srcbyte = srcrow;
363 dstpixel=(
DWORD*)dstrow;
364 for (
x=0;
x<
prc->Width;
x++)
365 {
366 *dstpixel++ = 0xff000000|(*srcbyte<<16)|(*srcbyte<<8)|*srcbyte;
367 srcbyte++;
368 }
369 srcrow += srcstride;
370 dstrow += cbStride;
371 }
372 }
373
375
377 }
381 {
385 UINT srcstride, srcdatasize;
393
396
399 res = IWICPalette_GetColors(
palette, 256, colors, &actualcolors);
400
402
404
405 srcstride =
prc->Width;
406 srcdatasize = srcstride *
prc->Height;
407
410
411 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
412
414 {
415 srcrow = srcdata;
416 dstrow = pbBuffer;
417 for (
y=0;
y<
prc->Height;
y++) {
418 srcbyte = srcrow;
419 dstpixel=(
DWORD*)dstrow;
420 for (
x=0;
x<
prc->Width;
x++)
421 *dstpixel++ = colors[*srcbyte++];
422 srcrow += srcstride;
423 dstrow += cbStride;
424 }
425 }
426
428
430 }
434 {
438 UINT srcstride, srcdatasize;
443
444 srcstride =
prc->Width * 2;
445 srcdatasize = srcstride *
prc->Height;
446
449
450 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
451
453 {
454 srcrow = srcdata;
455 dstrow = pbBuffer;
456 for (
y=0;
y<
prc->Height;
y++) {
457 srcbyte = srcrow;
458 dstpixel=(
DWORD*)dstrow;
459 for (
x=0;
x<
prc->Width;
x++)
460 {
461 srcbyte++;
462 *dstpixel++ = 0xff000000|(*srcbyte<<16)|(*srcbyte<<8)|*srcbyte;
463 srcbyte++;
464 }
465 srcrow += srcstride;
466 dstrow += cbStride;
467 }
468 }
469
471
473 }
477 {
481 UINT srcstride, srcdatasize;
483 const WORD *srcpixel;
486
487 srcstride = 2 *
prc->Width;
488 srcdatasize = srcstride *
prc->Height;
489
492
493 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
494
496 {
497 srcrow = srcdata;
498 dstrow = pbBuffer;
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++) {
504 srcval=*srcpixel++;
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);
512 }
513 srcrow += srcstride;
514 dstrow += cbStride;
515 }
516 }
517
519
521 }
525 {
529 UINT srcstride, srcdatasize;
531 const WORD *srcpixel;
534
535 srcstride = 2 *
prc->Width;
536 srcdatasize = srcstride *
prc->Height;
537
540
541 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
542
544 {
545 srcrow = srcdata;
546 dstrow = pbBuffer;
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++) {
552 srcval=*srcpixel++;
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);
560 }
561 srcrow += srcstride;
562 dstrow += cbStride;
563 }
564 }
565
567
569 }
573 {
577 UINT srcstride, srcdatasize;
579 const WORD *srcpixel;
582
583 srcstride = 2 *
prc->Width;
584 srcdatasize = srcstride *
prc->Height;
585
588
589 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
590
592 {
593 srcrow = srcdata;
594 dstrow = pbBuffer;
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++) {
600 srcval=*srcpixel++;
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);
608 }
609 srcrow += srcstride;
610 dstrow += cbStride;
611 }
612 }
613
615
617 }
621 {
625 UINT srcstride, srcdatasize;
627 const BYTE *srcpixel;
630
631 srcstride = 3 *
prc->Width;
632 srcdatasize = srcstride *
prc->Height;
633
636
637 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
638
640 {
641 srcrow = srcdata;
642 dstrow = pbBuffer;
643 for (
y=0;
y<
prc->Height;
y++) {
644 srcpixel=srcrow;
645 dstpixel=dstrow;
646 for (
x=0;
x<
prc->Width;
x++) {
647 *dstpixel++=*srcpixel++;
648 *dstpixel++=*srcpixel++;
649 *dstpixel++=*srcpixel++;
650 *dstpixel++=255;
651 }
652 srcrow += srcstride;
653 dstrow += cbStride;
654 }
655 }
656
658
660 }
664 {
668 UINT srcstride, srcdatasize;
670 const BYTE *srcpixel;
674
675 srcstride = 3 *
prc->Width;
676 srcdatasize = srcstride *
prc->Height;
677
680
681 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
682
684 {
685 srcrow = srcdata;
686 dstrow = pbBuffer;
687 for (
y=0;
y<
prc->Height;
y++) {
688 srcpixel=srcrow;
689 dstpixel=dstrow;
690 for (
x=0;
x<
prc->Width;
x++) {
691 tmppixel[0]=*srcpixel++;
692 tmppixel[1]=*srcpixel++;
693 tmppixel[2]=*srcpixel++;
694
695 *dstpixel++=tmppixel[2];
696 *dstpixel++=tmppixel[1];
697 *dstpixel++=tmppixel[0];
698 *dstpixel++=255;
699 }
700 srcrow += srcstride;
701 dstrow += cbStride;
702 }
703 }
704
706
708 }
712 {
715
716 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
718
719
720 for (
y=0;
y<
prc->Height;
y++)
721 for (
x=0;
x<
prc->Width;
x++)
722 pbBuffer[cbStride*
y+4*
x+3] = 0xff;
723 }
727 {
729 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
732 }
736 return IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
740 {
743
744 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
746
747 for (
y=0;
y<
prc->Height;
y++)
748 for (
x=0;
x<
prc->Width;
x++)
749 {
752 {
753 pbBuffer[cbStride*
y+4*
x] = pbBuffer[cbStride*
y+4*
x] * 255 /
alpha;
754 pbBuffer[cbStride*
y+4*
x+1] = pbBuffer[cbStride*
y+4*
x+1] * 255 /
alpha;
755 pbBuffer[cbStride*
y+4*
x+2] = pbBuffer[cbStride*
y+4*
x+2] * 255 /
alpha;
756 }
757 }
758 }
762 {
766 UINT srcstride, srcdatasize;
768 const BYTE *srcpixel;
771
772 srcstride = 6 *
prc->Width;
773 srcdatasize = srcstride *
prc->Height;
774
777
778 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
779
781 {
782 srcrow = srcdata;
783 dstrow = pbBuffer;
784 for (
y=0;
y<
prc->Height;
y++) {
785 srcpixel=srcrow;
786 dstpixel=(
DWORD*)dstrow;
787 for (
x=0;
x<
prc->Width;
x++) {
789 srcpixel++;
red = *srcpixel++;
790 srcpixel++;
green = *srcpixel++;
791 srcpixel++;
blue = *srcpixel++;
793 }
794 srcrow += srcstride;
795 dstrow += cbStride;
796 }
797 }
798
800
802 }
806 {
810 UINT srcstride, srcdatasize;
812 const BYTE *srcpixel;
815
816 srcstride = 8 *
prc->Width;
817 srcdatasize = srcstride *
prc->Height;
818
821
822 res = IWICBitmapSource_CopyPixels(
This->source,
prc, srcstride, srcdatasize, srcdata);
823
825 {
826 srcrow = srcdata;
827 dstrow = pbBuffer;
828 for (
y=0;
y<
prc->Height;
y++) {
829 srcpixel=srcrow;
830 dstpixel=(
DWORD*)dstrow;
831 for (
x=0;
x<
prc->Width;
x++) {
833 srcpixel++;
red = *srcpixel++;
834 srcpixel++;
green = *srcpixel++;
835 srcpixel++;
blue = *srcpixel++;
836 srcpixel++;
alpha = *srcpixel++;
838 }
839 srcrow += srcstride;
840 dstrow += cbStride;
841 }
842 }
843
845
847 }
851 {
854
855 res = IWICBitmapSource_CopyPixels(
This->source,
prc, cbStride, cbBufferSize, pbBuffer);
857
858 for (
y=0;
y<
prc->Height;
y++)
859 for (
x=0;
x<
prc->Width;
x++)
860 {
861 BYTE *pixel = pbBuffer+cbStride*
y+4*
x;
862 BYTE c=pixel[0],
m=pixel[1],
y=pixel[2],
k=pixel[3];
863 pixel[0] = (255-
y)*(255-
k)/255;
864 pixel[1] = (255-
m)*(255-
k)/255;
865 pixel[2] = (255-
c)*(255-
k)/255;
866 pixel[3] = 255;
867 }
868 }
870 default:
871 FIXME(
"Unimplemented conversion path!\n");
873 }
874}
void convert_rgba_to_bgra(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride)
HRESULT PaletteImpl_Create(IWICPalette **palette)
GLclampf GLclampf GLclampf alpha
@ WICBitmapPaletteTypeFixedBW
@ WICBitmapPaletteTypeFixedGray16
@ WICBitmapPaletteTypeFixedGray4