ImageGear Professional for Windows ActiveX
BlendWithAlpha Method

Description:

Blends two images, 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 Page1. All three images: Page1, Page2, and backPage must have the same width and height.

Two parameters index1 and index2 are used to specify index of alpha channel to be taken in blending.

The images page1 and page2 will be blended equally, and any areas that are not covered by either image will show through to the background image. If Page1 has a lower bit depth than Page2, 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 Mode. 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 Page1, where. Please use the following key for the formulas:

IG_BLEND_OVER: Blend first image over the second image:

I1 = (Back*(1-A1)*(1-A2)) + (I1*A1) + (I2*(1-A1)*A2)

IG_BLEND_IN: Blend the first image into the second image

I1 = (Back*(1-A1)*(1-A2)) + (I1*A1*A2) + (I2*(1-A1)*A2)

IG_HELD_OUT: The first image is held out by the second image.

I1 = (Back*(1-A1)*(1-A2)) + (I1*A1*(1-A2)) + (I2*A2)

IG_BLEND_LINEAR: The first and second images are combined in a linear fashion.

I1 = ((Back*(1-A1)*(1-A2)) + (I1*A1) + (I2*A2)/(1+A2*A1)

This method takes into account the ROI settings of Page1 object, that are accessible via the IGPage Object.ROI Property. By default ROI is set to the entire image.

Syntax:

      BlendWithAlpha (ByVal Page1 As IGPage, ByVal index1 As Long,
ByVal Page2 As IGPage, ByVal index2 As Long, ByVal backPage As
IGPage, ByVal Mode As enumIGBlendModes)

Parameters:

Name Description
Page1 Reference to IGPage Object of first image.
index1 Specifies an index of alpha channel in Page1 image.
Page2 Reference to IGPage Object of second image.
index2 Specifies an index of alpha channel in Page2 image.
backPage Reference to IGPage Object of background image.
Mode Specifies which type of blending should be used.

Return Value:

N/A

Bits Per Pixel:

1, 4, 8, 24

Sample:

Image Processing and Effects

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback