ImageGear Professional DLL v17.2 for Windows
IG_IP_blend_with_alpha
Send Feedback
ImageGear Professional DLL v17.2 for Windows > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Effects Functions > IG_IP_blend_with_alpha

Glossary Item Box

This function is no longer supported; please use IG_image_blend_with_alpha instead.

Declaration:

  Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_blend_with_alpha ( 
        HIGEAR hIGear1, 
        UINT nFAIndex
        HIGEAR hIGear2, 
        UINT nSAIndex
        HIGEAR hIBackgrnd, 
        LPAT_RECT lpRect, 
        AT_MODE nBlendMode 
);

Arguments:

Name Type Description
hIGear1 HIGEAR HIGEAR handle of first image.
nFAIndex UINT Not used.
hIGear2 HIGEAR HIGEAR handle of second image.
nSAIndex UINT Not used.
hIBackgrnd HIGEAR HIGEAR handle of background image.
lpRect LPAT_RECT A long pointer to a structure of type AT_RECT which tells which rectangular sub-region of hIGear1 will have blending applied to it. Set to NULL for whole image. Before ImageGear performs this operation, it will check to see if an internal flag has been set to TRUE to make a mask active for this HIGEAR image. If a mask is active, and a valid pointer to a mask can be found, ImageGear will override the settings passed to this structure in favor of the non- rectangular ROI defined by the mask.
nBlendMode AT_MODE An integer of type AT_MODE which is used to set which type of blending should be used. These are defined in accucnst.h and are shown below with their formulas.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

All pixel formats supported by ImageGear Professional.

Sample:

Image Processing

Example:

  Copy Code
HIGEAR hIGear1, hIGear2,      /* HIGEAR handle of image */
                hIBackgrnd;
AT_ERRCOUNT  nErrcount;      /* tally of IG errors on the stack */
AT_RECT rcRectOf1;      /* selected rectangle from image 1 */
nErrcount = IG_IP_blend_with_alpha (hIGear1, hIGear2, hIBackgrnd, &rcRectOf1,
IG_BLEND_OVER);

Remarks:

This function is no longer supported. Please use IG_image_blend_with_alpha instead. IG_image_blend_with_alpha has much simpler API, but still provides the necessary functionality for blending images containing Alpha channels.

IG_IP_blend_with_alpha function blends two images, hIGear1 and hIGear2, using both their pixel data, their alpha channel data (if they have any), and a background image. The changes are made to the pixel data of hIGear1. All three images: hIGear1, hIGear2, and hIBackgrnd must have the same width and height. hIGear2 and hIBackgrnd may be NULL. hIGear1 should not be NULL.

The images hIGear1 and hIGear2 will be blended equally, and any areas that are not covered by either image will show through to the background image. If hIGear1 has a lower bit depth than hIGear2, it will automatically be promoted to the bit depth so that the resultant image has the higher bit depth.

Below are the possible settings for nBlendMode. With each setting, there is a brief description of what this blend mode will do, and also the formula that is used for calculating the new pixel values of hIGear1, where. Please use the following key for the formulas:

Exceptions:

The values contained in the alpha channel will be mapped to a float value between 0 and 1, where 1 is equivalent to 100%. 100% means that the pixel will be fully transparent, and 0% means that the pixel will be fully opaque. All values in between (0.1 - 0.99) will represent varying degrees of transparency. If it is an 8-bit alpha channel, the value 255 will be mapped to 1, or 100%.

This function, like other ImageGear Image Processing and Clipboard API calls, takes an AT_RECT structure as an argument so that you can blend a rectangular sub-region of hIGear1. However, before ImageGear performs the operation specified by this function, it will check to see if an internal flag has been set to TRUE, indicating that a mask HIGEAR should be used with the image. If the flag is set to TRUE, and a valid pointer to a mask image has been assigned, ImageGear will override the settings passed to the AT_RECT structure and use the non-rectangular ROI defined by the mask HIGEAR. To create a non-rectangular region of interest, call IG_IP_NR_ROI_to_HIGEAR_mask().

Please see the descriptions of IG_IP_NR_ROI_mask_associate() and IG_IP_NR_ROI_to_HIGEAR_mask() for more details. See also IG_image_create_alpha().
©2012. Accusoft Corporation. All Rights Reserved.