comparison imgconvert_template.h @ 1208:0f37976aa436 libavcodec

added img_get_alpha_info()
author bellard
date Mon, 21 Apr 2003 21:20:46 +0000
parents e55580ae9969
children 766a2f4edbea
comparison
equal deleted inserted replaced
1207:162be12df86a 1208:0f37976aa436
812 build_rgb_palette(dst->data[1], has_alpha); 812 build_rgb_palette(dst->data[1], has_alpha);
813 } 813 }
814 814
815 #endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */ 815 #endif /* defined(FMT_RGB24) || defined(FMT_RGBA32) */
816 816
817 #ifdef RGBA_IN
818
819 static int glue(get_alpha_info_, RGB_NAME)(AVPicture *src, int width, int height)
820 {
821 const unsigned char *p;
822 int src_wrap, ret, x, y;
823 unsigned int r, g, b, a;
824
825 p = src->data[0];
826 src_wrap = src->linesize[0] - BPP * width;
827 ret = 0;
828 for(y=0;y<height;y++) {
829 for(x=0;x<width;x++) {
830 RGBA_IN(r, g, b, a, p);
831 if (a == 0x00) {
832 ret |= FF_ALPHA_TRANSP;
833 } else if (a != 0xff) {
834 ret |= FF_ALPHA_SEMI_TRANSP;
835 }
836 p += BPP;
837 }
838 p += src_wrap;
839 }
840 return ret;
841 }
842
843 #endif /* RGBA_IN */
844
817 #undef RGB_IN 845 #undef RGB_IN
818 #undef RGBA_IN 846 #undef RGBA_IN
819 #undef RGB_OUT 847 #undef RGB_OUT
820 #undef RGBA_OUT 848 #undef RGBA_OUT
821 #undef BPP 849 #undef BPP