9#ifndef GP_MIX_PIXELS2_GEN_H
10#define GP_MIX_PIXELS2_GEN_H
26 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
29 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
31 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
32 GP_PIXEL_RGB101010_TO_RGB888(dst, dst_rgb);
38 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
39 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
42 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
43 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
46 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
47 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
48 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
50 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
52 GP_PIXEL_RGB888_TO_RGB101010(dst_rgb, res);
61 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
64 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
66 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
67 GP_PIXEL_xRGB8888_TO_RGB888(dst, dst_rgb);
73 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
74 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
77 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
78 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
81 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
82 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
83 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
85 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
87 GP_PIXEL_RGB888_TO_xRGB8888(dst_rgb, res);
96 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
99 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
101 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
102 GP_PIXEL_RGBA8888_TO_RGB888(dst, dst_rgb);
108 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
109 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
112 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
113 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
116 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
117 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
118 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
120 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
122 GP_PIXEL_RGB888_TO_RGBA8888(dst_rgb, res);
131 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
134 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
136 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
137 GP_PIXEL_RGB888_TO_RGB888(dst, dst_rgb);
143 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
144 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
147 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
148 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
151 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
152 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
153 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
155 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
157 GP_PIXEL_RGB888_TO_RGB888(dst_rgb, res);
166 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
169 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
171 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
172 GP_PIXEL_BGR888_TO_RGB888(dst, dst_rgb);
178 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
179 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
182 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
183 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
186 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
187 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
188 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
190 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
192 GP_PIXEL_RGB888_TO_BGR888(dst_rgb, res);
201 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
204 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
206 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
207 GP_PIXEL_RGB555_TO_RGB888(dst, dst_rgb);
213 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
214 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
217 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
218 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
221 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
222 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
223 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
225 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
227 GP_PIXEL_RGB888_TO_RGB555(dst_rgb, res);
236 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
239 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
241 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
242 GP_PIXEL_RGB565_TO_RGB888(dst, dst_rgb);
248 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
249 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
252 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
253 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
256 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
257 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
258 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
260 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
262 GP_PIXEL_RGB888_TO_RGB565(dst_rgb, res);
271 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
274 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
276 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
277 GP_PIXEL_RGB666_TO_RGB888(dst, dst_rgb);
283 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
284 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
287 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
288 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
291 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
292 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
293 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
295 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
297 GP_PIXEL_RGB888_TO_RGB666(dst_rgb, res);
306 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
309 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
311 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
312 GP_PIXEL_RGB332_TO_RGB888(dst, dst_rgb);
318 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
319 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
322 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
323 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
326 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
327 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
328 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
330 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
332 GP_PIXEL_RGB888_TO_RGB332(dst_rgb, res);
341 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
344 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
346 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
347 GP_PIXEL_CMYK8888_TO_RGB888(dst, dst_rgb);
353 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
354 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
357 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
358 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
361 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
362 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
363 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
365 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
367 GP_PIXEL_RGB888_TO_CMYK8888(dst_rgb, res);
376 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
379 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
381 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
382 GP_PIXEL_G1_DB_TO_RGB888(dst, dst_rgb);
388 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
389 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
392 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
393 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
396 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
397 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
398 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
400 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
402 GP_PIXEL_RGB888_TO_G1_DB(dst_rgb, res);
411 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
414 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
416 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
417 GP_PIXEL_G2_DB_TO_RGB888(dst, dst_rgb);
423 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
424 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
427 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
428 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
431 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
432 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
433 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
435 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
437 GP_PIXEL_RGB888_TO_G2_DB(dst_rgb, res);
446 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
449 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
451 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
452 GP_PIXEL_G4_DB_TO_RGB888(dst, dst_rgb);
458 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
459 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
462 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
463 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
466 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
467 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
468 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
470 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
472 GP_PIXEL_RGB888_TO_G4_DB(dst_rgb, res);
481 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
484 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
486 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
487 GP_PIXEL_G1_UB_TO_RGB888(dst, dst_rgb);
493 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
494 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
497 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
498 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
501 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
502 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
503 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
505 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
507 GP_PIXEL_RGB888_TO_G1_UB(dst_rgb, res);
516 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
519 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
521 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
522 GP_PIXEL_G2_UB_TO_RGB888(dst, dst_rgb);
528 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
529 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
532 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
533 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
536 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
537 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
538 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
540 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
542 GP_PIXEL_RGB888_TO_G2_UB(dst_rgb, res);
551 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
554 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
556 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
557 GP_PIXEL_G4_UB_TO_RGB888(dst, dst_rgb);
563 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
564 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
567 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
568 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
571 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
572 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
573 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
575 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
577 GP_PIXEL_RGB888_TO_G4_UB(dst_rgb, res);
586 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
589 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
591 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
592 GP_PIXEL_G8_TO_RGB888(dst, dst_rgb);
598 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
599 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
602 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
603 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
606 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
607 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
608 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
610 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
612 GP_PIXEL_RGB888_TO_G8(dst_rgb, res);
621 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
624 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
626 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
627 GP_PIXEL_GA88_TO_RGB888(dst, dst_rgb);
633 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
634 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
637 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
638 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
641 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
642 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
643 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
645 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
647 GP_PIXEL_RGB888_TO_GA88(dst_rgb, res);
656 unsigned int alpha = GP_PIXEL_GET_A_RGBA8888(src);
659 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
661 GP_PIXEL_RGBA8888_TO_RGB888(src, src_rgb);
662 GP_PIXEL_G16_TO_RGB888(dst, dst_rgb);
668 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
669 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
672 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
673 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
676 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
677 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
678 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
680 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
682 GP_PIXEL_RGB888_TO_G16(dst_rgb, res);
691 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
694 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
696 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
697 GP_PIXEL_RGB101010_TO_RGB888(dst, dst_rgb);
703 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
704 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
707 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
708 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
711 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
712 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
713 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
715 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
717 GP_PIXEL_RGB888_TO_RGB101010(dst_rgb, res);
726 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
729 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
731 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
732 GP_PIXEL_xRGB8888_TO_RGB888(dst, dst_rgb);
738 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
739 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
742 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
743 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
746 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
747 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
748 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
750 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
752 GP_PIXEL_RGB888_TO_xRGB8888(dst_rgb, res);
761 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
764 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
766 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
767 GP_PIXEL_RGBA8888_TO_RGB888(dst, dst_rgb);
773 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
774 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
777 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
778 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
781 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
782 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
783 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
785 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
787 GP_PIXEL_RGB888_TO_RGBA8888(dst_rgb, res);
796 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
799 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
801 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
802 GP_PIXEL_RGB888_TO_RGB888(dst, dst_rgb);
808 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
809 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
812 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
813 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
816 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
817 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
818 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
820 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
822 GP_PIXEL_RGB888_TO_RGB888(dst_rgb, res);
831 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
834 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
836 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
837 GP_PIXEL_BGR888_TO_RGB888(dst, dst_rgb);
843 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
844 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
847 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
848 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
851 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
852 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
853 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
855 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
857 GP_PIXEL_RGB888_TO_BGR888(dst_rgb, res);
866 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
869 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
871 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
872 GP_PIXEL_RGB555_TO_RGB888(dst, dst_rgb);
878 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
879 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
882 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
883 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
886 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
887 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
888 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
890 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
892 GP_PIXEL_RGB888_TO_RGB555(dst_rgb, res);
901 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
904 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
906 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
907 GP_PIXEL_RGB565_TO_RGB888(dst, dst_rgb);
913 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
914 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
917 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
918 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
921 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
922 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
923 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
925 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
927 GP_PIXEL_RGB888_TO_RGB565(dst_rgb, res);
936 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
939 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
941 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
942 GP_PIXEL_RGB666_TO_RGB888(dst, dst_rgb);
948 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
949 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
952 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
953 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
956 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
957 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
958 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
960 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
962 GP_PIXEL_RGB888_TO_RGB666(dst_rgb, res);
971 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
974 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
976 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
977 GP_PIXEL_RGB332_TO_RGB888(dst, dst_rgb);
983 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
984 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
987 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
988 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
991 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
992 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
993 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
995 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
997 GP_PIXEL_RGB888_TO_RGB332(dst_rgb, res);
1006 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1009 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1011 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1012 GP_PIXEL_CMYK8888_TO_RGB888(dst, dst_rgb);
1018 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1019 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1022 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1023 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1026 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1027 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1028 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1030 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1032 GP_PIXEL_RGB888_TO_CMYK8888(dst_rgb, res);
1041 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1044 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1046 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1047 GP_PIXEL_G1_DB_TO_RGB888(dst, dst_rgb);
1053 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1054 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1057 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1058 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1061 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1062 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1063 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1065 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1067 GP_PIXEL_RGB888_TO_G1_DB(dst_rgb, res);
1076 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1079 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1081 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1082 GP_PIXEL_G2_DB_TO_RGB888(dst, dst_rgb);
1088 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1089 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1092 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1093 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1096 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1097 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1098 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1100 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1102 GP_PIXEL_RGB888_TO_G2_DB(dst_rgb, res);
1111 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1114 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1116 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1117 GP_PIXEL_G4_DB_TO_RGB888(dst, dst_rgb);
1123 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1124 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1127 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1128 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1131 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1132 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1133 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1135 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1137 GP_PIXEL_RGB888_TO_G4_DB(dst_rgb, res);
1146 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1149 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1151 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1152 GP_PIXEL_G1_UB_TO_RGB888(dst, dst_rgb);
1158 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1159 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1162 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1163 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1166 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1167 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1168 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1170 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1172 GP_PIXEL_RGB888_TO_G1_UB(dst_rgb, res);
1181 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1184 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1186 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1187 GP_PIXEL_G2_UB_TO_RGB888(dst, dst_rgb);
1193 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1194 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1197 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1198 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1201 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1202 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1203 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1205 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1207 GP_PIXEL_RGB888_TO_G2_UB(dst_rgb, res);
1216 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1219 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1221 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1222 GP_PIXEL_G4_UB_TO_RGB888(dst, dst_rgb);
1228 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1229 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1232 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1233 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1236 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1237 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1238 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1240 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1242 GP_PIXEL_RGB888_TO_G4_UB(dst_rgb, res);
1251 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1254 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1256 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1257 GP_PIXEL_G8_TO_RGB888(dst, dst_rgb);
1263 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1264 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1267 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1268 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1271 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1272 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1273 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1275 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1277 GP_PIXEL_RGB888_TO_G8(dst_rgb, res);
1286 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1289 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1291 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1292 GP_PIXEL_GA88_TO_RGB888(dst, dst_rgb);
1298 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1299 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1302 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1303 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1306 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1307 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1308 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1310 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1312 GP_PIXEL_RGB888_TO_GA88(dst_rgb, res);
1321 unsigned int alpha = GP_PIXEL_GET_A_GA88(src);
1324 gp_pixel src_rgb = 0, dst_rgb = 0, res = 0;
1326 GP_PIXEL_GA88_TO_RGB888(src, src_rgb);
1327 GP_PIXEL_G16_TO_RGB888(dst, dst_rgb);
1333 sg = GP_PIXEL_GET_G_RGB888(src_rgb);
1334 sb = GP_PIXEL_GET_B_RGB888(src_rgb);
1337 dg = GP_PIXEL_GET_G_RGB888(dst_rgb);
1338 db = GP_PIXEL_GET_B_RGB888(dst_rgb);
1341 dr = (dr * (255 - alpha) + sr * alpha + 127) / 255;
1342 dg = (dg * (255 - alpha) + sg * alpha + 127) / 255;
1343 db = (db * (255 - alpha) + sb * alpha + 127) / 255;
1345 dst_rgb = GP_PIXEL_CREATE_RGB888(dr, dg, db);
1347 GP_PIXEL_RGB888_TO_G16(dst_rgb, res);
uint32_t gp_pixel
Pixel integer value.
#define GP_PIXEL_GET_R_RGB888(p)
Macro to get raw channel value for RGB888 pixel.