vlc_linux/vlc-3.0.16/modules/video_filter/blend.cpp
/**
 * It blends 2 picture together.
 */
It blends 2 picture together.
It blends 2 picture together .
static void Blend(filter_t *filter,
                  picture_t *dst, const picture_t *src,
                  int x_offset, int y_offset, int alpha)
{
    filter_sys_t *sys = filter->p_sys;
    if( x_offset < 0 || y_offset < 0 )
    {
        msg_Err( filter, "Blend cannot process negative offsets" );
        return;
    }
    int width  = __MIN((int)filter->fmt_out.video.i_visible_width - x_offset,
                       (int)filter->fmt_in.video.i_visible_width);
    int height = __MIN((int)filter->fmt_out.video.i_visible_height - y_offset,
                       (int)filter->fmt_in.video.i_visible_height);
    if (width <= 0 || height <= 0 || alpha <= 0)
        return;
    video_format_FixRgb(&filter->fmt_out.video);
    video_format_FixRgb(&filter->fmt_in.video);
    sys->blend(CPicture(dst, &filter->fmt_out.video,
                        filter->fmt_out.video.i_x_offset + x_offset,
                        filter->fmt_out.video.i_y_offset + y_offset),
               CPicture(src, &filter->fmt_in.video,
                        filter->fmt_in.video.i_x_offset,
                        filter->fmt_in.video.i_y_offset),
               width, height, alpha);
}
static void Blend ( filter_t * filter , picture_t * dst , const picture_t * src , int x_offset , int y_offset , int alpha ) { filter_sys_t * sys = filter -> p_sys ; if ( x_offset < 0 || y_offset < 0 ) { msg_Err ( filter , " " ) ; return ; } int width = __MIN ( ( int ) filter -> fmt_out . video . i_visible_width - x_offset , ( int ) filter -> fmt_in . video . i_visible_width ) ; int height = __MIN ( ( int ) filter -> fmt_out . video . i_visible_height - y_offset , ( int ) filter -> fmt_in . video . i_visible_height ) ; if ( width <= 0 || height <= 0 || alpha <= 0 ) return ; video_format_FixRgb ( & filter -> fmt_out . video ) ; video_format_FixRgb ( & filter -> fmt_in . video ) ; sys -> blend ( CPicture ( dst , & filter -> fmt_out . video , filter -> fmt_out . video . i_x_offset + x_offset , filter -> fmt_out . video . i_y_offset + y_offset ) , CPicture ( src , & filter -> fmt_in . video , filter -> fmt_in . video . i_x_offset , filter -> fmt_in . video . i_y_offset ) , width , height , alpha ) ; }
It blends 2 picture together.
It blends 2 picture together .