man pages section 3: Multimedia Library Functions

Exit Print View

Updated: July 2014
 
 

mlib_ImageBlend_SA_ONE_Inp(3MLIB)

Name

mlib_ImageBlend_BSRC1_BSRC2_Inp, mlib_ImageBlend_DA_DA_Inp, mlib_ImageBlend_DA_DC_Inp, mlib_ImageBlend_DA_OMDA_Inp , mlib_ImageBlend_DA_OMDC_Inp, mlib_ImageBlend_DA_OMSA_Inp, mlib_ImageBlend_DA_ONE_Inp, mlib_ImageBlend_DA_SA_Inp, mlib_ImageBlend_DA_SAS_Inp, mlib_ImageBlend_DA_ZERO_Inp, mlib_ImageBlend_OMDA_DA_Inp , mlib_ImageBlend_OMDA_DC_Inp, mlib_ImageBlend_OMDA_OMDA_Inp, mlib_ImageBlend_OMDA_OMDC_Inp, mlib_ImageBlend_OMDA_OMSA_Inp, mlib_ImageBlend_OMDA_ONE_Inp, mlib_ImageBlend_OMDA_SA_Inp, mlib_ImageBlend_OMDA_SAS_Inp, mlib_ImageBlend_OMDA_ZERO_Inp, mlib_ImageBlend_OMSA_DA_Inp, mlib_ImageBlend_OMSA_DC_Inp, mlib_ImageBlend_OMSA_OMDA_Inp, mlib_ImageBlend_OMSA_OMDC_Inp, mlib_ImageBlend_OMSA_OMSA_Inp , mlib_ImageBlend_OMSA_ONE_Inp, mlib_ImageBlend_OMSA_SA_Inp, mlib_ImageBlend_OMSA_SAS_Inp, mlib_ImageBlend_OMSA_ZERO_Inp, mlib_ImageBlend_OMSC_DA_Inp, mlib_ImageBlend_OMSC_DC_Inp, mlib_ImageBlend_OMSC_OMDA_Inp , mlib_ImageBlend_OMSC_OMDC_Inp, mlib_ImageBlend_OMSC_OMSA_Inp, mlib_ImageBlend_OMSC_ONE_Inp, mlib_ImageBlend_OMSC_SA_Inp, mlib_ImageBlend_OMSC_SAS_Inp, mlib_ImageBlend_OMSC_ZERO_Inp, mlib_ImageBlend_ONE_DA_Inp, mlib_ImageBlend_ONE_DC_Inp, mlib_ImageBlend_ONE_OMDA_Inp, mlib_ImageBlend_ONE_OMDC_Inp, mlib_ImageBlend_ONE_OMSA_Inp, mlib_ImageBlend_ONE_ONE_Inp, mlib_ImageBlend_ONE_SA_Inp , mlib_ImageBlend_ONE_SAS_Inp, mlib_ImageBlend_ONE_ZERO_Inp, mlib_ImageBlend_SA_DA_Inp, mlib_ImageBlend_SA_DC_Inp, mlib_ImageBlend_SA_OMDA_Inp, mlib_ImageBlend_SA_OMDC_Inp, mlib_ImageBlend_SA_OMSA_Inp , mlib_ImageBlend_SA_ONE_Inp, mlib_ImageBlend_SA_SA_Inp, mlib_ImageBlend_SA_SAS_Inp, mlib_ImageBlend_SA_ZERO_Inp, mlib_ImageBlend_SC_DA_Inp, mlib_ImageBlend_SC_DC_Inp, mlib_ImageBlend_SC_OMDA_Inp , mlib_ImageBlend_SC_OMDC_Inp, mlib_ImageBlend_SC_OMSA_Inp, mlib_ImageBlend_SC_ONE_Inp, mlib_ImageBlend_SC_SA_Inp, mlib_ImageBlend_SC_SAS_Inp, mlib_ImageBlend_SC_ZERO_Inp, mlib_ImageBlend_ZERO_DA_Inp , mlib_ImageBlend_ZERO_DC_Inp, mlib_ImageBlend_ZERO_OMDA_Inp, mlib_ImageBlend_ZERO_OMDC_Inp, mlib_ImageBlend_ZERO_OMSA_Inp, mlib_ImageBlend_ZERO_ONE_Inp, mlib_ImageBlend_ZERO_SA_Inp, mlib_ImageBlend_ZERO_SAS_Inp, mlib_ImageBlend_ZERO_ZERO_Inp - blending, in place

Synopsis

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

mlib_status mlib_ImageBlend_BSRC1_BSRC2_Inp(mlib_image *src1dst,
     const mlib_image *src2, mlib_s32 cmask);

Description

This group of functions supports digital image composition. They are low-level, in-place, blending functions.

The image type must be MLIB_BYTE. The input and output images must contain three or four channels. For three-channel images, the alpha value is as if the alpha value is 1.

BSRC1 is one of the following: ZERO, ONE, SC, OMSC, DA, SA, OMDA, or OMSA. BSRC2 is one of the following: ZERO, ONE, DC, OMDC, DA, SA, OMDA, OMSA, or SAS.

The following are predefined blend factor types used in mediaLib image composition functions.

/* image blend factors */
typedef enum {
    MLIB_BLEND_ZERO,
    MLIB_BLEND_ONE,
    MLIB_BLEND_DST_COLOR,
    MLIB_BLEND_SRC_COLOR,
    MLIB_BLEND_ONE_MINUS_DST_COLOR,
    MLIB_BLEND_ONE_MINUS_SRC_COLOR,
    MLIB_BLEND_DST_ALPHA,
    MLIB_BLEND_SRC_ALPHA,
    MLIB_BLEND_ONE_MINUS_DST_ALPHA,
    MLIB_BLEND_ONE_MINUS_SRC_ALPHA,
    MLIB_BLEND_SRC_ALPHA_SATURATE
} mlib_blend;

See the following table for the definitions of the blend factors.

Type
Blend Factor [*]
Abbr.
MLIB_BLEND_ZERO
(0,0,0,0)
ZERO
MLIB_BLEND_ONE
(1,1,1,1)
ONE
MLIB_BLEND_DST_COLOR
(Rd,Gd,Bd,Ad)
DC
MLIB_BLEND_SRC_COLOR
(Rs,Gs,Bs,As)
SC
MLIB_BLEND_ONE_MINUS_DST_COLOR
(1,1,1,1)-(Rd,Gd,Bd,Ad)
OMDC
MLIB_BLEND_ONE_MINUS_SRC_COLOR
(1,1,1,1)-(Rs,Gs,Bs,As)
OMSC
MLIB_BLEND_DST_ALPHA
(Ad,Ad,Ad,Ad)
DA
MLIB_BLEND_SRC_ALPHA
(As,As,As,As)
SA
MLIB_BLEND_ONE_MINUS_DST_ALPHA
(1,1,1,1)-(Ad,Ad,Ad,Ad)
OMDA
MLIB_BLEND_ONE_MINUS_SRC_ALPHA
(1,1,1,1)-(As,As,As,As)
OMSA
MLIB_BLEND_SRC_ALPHA_SATURATE
(f,f,f,1)
SAS

[*]: The components of the first source image pixel are (Rd,Gd,Bd,Ad), and the components of the second source pixel are (Rs,Gs,Bs,As). Function f = min(As,1-Ad). The first source image is also the destination image.

The blending formula for in-place processing is:

Cd = Cd*D + Cs*S

where Cd is the destination pixel (Rd,Gd,Bd,Ad), Cs is the source pixel (Rs,Gs,Bs,As), and D and S are the blend factors for the destination and source, respectively.

Parameters

Each of the functions takes the following arguments:

src1dst

Pointer to the first source and the destination image.

src2

Pointer to the second source image.

cmask

Channel mask to indicate the alpha channel. Each bit of the mask represents a channel in the image. The channel corresponding to the 1 bit is the alpha channel. cmask must be either 0x01 or 0x08.

Return Values

Each of the functions returns MLIB_SUCCESS if successful. Otherwise it returns MLIB_FAILURE.

Attributes

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

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

See also

mlib_ImageBlend_BSRC1_BSRC2(3MLIB), mlib_ImageComposite(3MLIB), mlib_ImageComposite_Inp(3MLIB), attributes (5)