man pages section 3: Multimedia Library Functions

Exit Print View

Updated: July 2014
 
 

mlib_VideoColorBlendABGR_ResetAlpha(3MLIB)

Name

mlib_VideoColorBlendABGR, mlib_VideoColorBlendABGR_ResetAlpha - image blend

Synopsis

cc [ flag... ] file... –lmlib [ library... ]
#include <mlib.h>

void mlib_VideoColorBlendABGR(mlib_u32 *dst,
     const mlib_u32 *src1,const mlib_u32 *src2,
     mlib_s32 src1_w, mlib_s32 src1_h,
     mlib_s32 src2_w,mlib_s32 src2_h,
     mlib_s32 src2_x, mlib_s32 src2_y,
     mlib_s32 dst_lb,mlib_s32 src1_lb,
     mlib_s32 src2_lb, mlib_blend src1_blend,
     mlib_blend src2_blend);
void mlib_VideoColorBlendABGR_ResetAlpha(mlib_u32 *dst,
     const mlib_u32 *src1,const mlib_u32 *src2,
     mlib_s32 src1_w, mlib_s32 src1_h,
     mlib_s32 src2_w,mlib_s32 src2_h, 
     mlib_s32 src2_x, mlib_s32 src2_y,
     mlib_s32 dst_lb, mlib_s32 src1_lb,
     mlib_s32 src2_lb, mlib_blend src1_blend,
     mlib_blend src2_blend);

Description

The functions use the following equation for blending images:

  dst = (src1 * src1_blend) + (src2 * src2_blend)

The two multi-banded source images (src1 and src2) are blended together and stored in the destination image (dst). The image buffers pointed to by dst, src1, and src2 contain 4-banded ABGR images, 8 bits per component. src1_w and src1_h are the dimensions of the src1 input buffer. src2_w and src2_h are the dimensions of the src2 input buffer. The output buffer must be at least as large as the src1 input buffer. src2_x and src2_y are the offset of the src2 input buffer relative to src1. Where pixels in src2 overlap pixels in src1, the pixels are blended. Pixels in src1 which are outside of src2 are copied into dst. Pixels in the dst image outside of src1 are left unchanged. src1_blend specifies the blend function to be applied to the pixels of src1 image and src2_blend specifies the blend function to be applied to the pixels of src2.

Possible blend functions are:

  MLIB_BLEND_ZERO
  MLIB_BLEND_ONE
  MLIB_BLEND_SRC_ALPHA
  MLIB_BLEND_ONE_MINUS_SRC_ALPHA
  MLIB_BLEND_DST_ALPHA
  MLIB_BLEND_ONE_MINUS_DST_ALPHA

MLIB_BLEND_SRC_ALPHA is the alpha component of image src2 scaled to the range 0.0 to 1.0. MLIB_BLEND_DST_ALPHA is the alpha component of image src1 scaled to the range 0.0 to 1.0. All pixel components are treated as unsigned 8-bit quantities and the output pixel component values are clamped to the range 0 to 255.

For the mlib_VideoColorBlendABGR_ResetAlpha() function, the alpha value of every pixel in destination image is set to 0 after blending is complete.

Parameters

Each of the functions takes the following arguments:

dst

Pointer to output image.

src1

Pointer to 1st input image.

src2

Pointer to 2nd input image.

src1_w

src1 image width in pixels.

src1_h

src1 image height in rows.

src2_w

src2 image width in pixels.

src2_h

src2 image height in rows.

src2_x

src2 horizontal displacement (in pixels), relative to the upper-left corner of src1.

src2_y

src2 vertical displacement (in rows), relative to the upper-left corner of src1.

dst_lb

Linebytes for output image.

src1_lb

Linebytes for 1st input image.

src2_lb

Linebytes for 2nd input image.

src1_blend

Blend function for src1 image.

src2_blend

Blend function for src2 image.

Return Values

None.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe

See also

mlib_VideoColorBlendABGR_Inp(3MLIB), attributes (5)