Developer Reference for Intel® Integrated Performance Primitives
Combines two images using constant alpha values.
Case 1: Not-in-place operation
IppStatus ippiAlphaCompC_<mod>(const Ipp<datatype>* pSrc1, int src1Step, Ipp<datatype> alpha1, const Ipp<datatype>* pSrc2, int src2Step, Ipp<datatype> alpha2, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, IppiAlphaType alphaType);
Supported values for mod:
8u_C1R |
8u_C3R |
8u_C4R |
8u_AC4R |
16u_C1R |
16u_C3R |
16u_C4R |
16u_AC4R |
16s_C1R |
|||
32u_C1R |
|||
32s_C1R |
|||
32f_C1R |
|||
IppStatus ippiAlphaCompC_<mod>(const Ipp<datatype>* const pSrc1[4], int src1Step, Ipp<datatype> alpha1, const Ipp<datatype>* const pSrc2[4], int src2Step, Ipp<datatype> alpha2, Ipp<datatype>* const pDst[4], int dstStep, IppiSize roiSize, IppiAlphaType alphaType);
Supported values for mod:
8u_AP4R |
16u_AP4R |
Case 2: In-place operation
IppStatus ippiAlphaCompC_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype> alpha1, Ipp<datatype>* pSrcDst, int srcDstStep, Ipp<datatype> alpha2, IppiSize roiSize, IppiAlphaType alphaType);
Supported values for mod:
8u_C1IR |
16u_C1IR |
16s_C1IR |
32s_C1IR |
32u_C1IR |
32f_C1IR |
8u_C3IR |
16u_C3IR |
||||
8u_C4IR |
16u_C4IR |
||||
8u_AC4IR |
16u_AC4IR |
||||
IppStatus ippiAlphaCompC_<mod>(const Ipp<datatype>* const pSrc[4], int srcStep, Ipp<datatype> alpha1, Ipp<datatype>* const pSrcDst[4], int srcDstStep, Ipp<datatype> alpha2, IppiSize roiSize, IppiAlphaType alphaType);
Supported values for mod:
8u_AP4IR |
16u_AP4IR |
ippi.h
Headers: ippcore.h, ippvm.h, ipps.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib
pSrc1, pSrc2 |
Pointers to the source image ROI for pixel-order data. An array of pointers to ROI in the separate source color planes in case of planar data. |
src1Step, src2Step |
Distances, in bytes, between the starting points of consecutive lines in the source images. |
pSrcDst |
Pointer to the source and destination buffer or an array of pointers to separate source and destination color planes for in-place operation. |
pDst |
Pointer to the destination image ROI for pixel-order data. An array of pointers to ROI in the separate destination color planes in case of planar data. |
srcDstStep |
Distance, in bytes, between the starting points of consecutive lines in the source and destination image for in-place operation. |
dstStep |
Distance, in bytes, between the starting points of consecutive lines in the destination image. |
roiSize |
Size of the source and destination ROI in pixels. |
alpha1, alpha2 |
Constant alpha values to use for the compositing operation. |
alphaType |
The composition type to perform. See Table “Possible Values of the Parameter alphaType” for the type value and description. |
This function operates with ROI (see Regions of Interest in Intel IPP).
This function performs an image compositing operation on one-channel image buffers, three-channel RGB and four-channel RGBA image buffers and on planar images, using constant alpha values alpha1 and alpha2. These values are passed to the function as parameters.
The compositing is done by overlaying pixels from the foreground image ROI pSrc1 with pixels from the background image ROI pSrc2 to produce pixels in the resultant image ROI pDst. The alpha values are normalized to the range [0..1].
The type of the compositing operation is indicated by the alphaType parameter. Use Table “Possible Values of the Parameter alphaType” to choose a valid alphaType value depending on the required composition type. For example, the resulting pixel color components for the OVER operation (see Table “Types of Image Composing Operations”) are computed as follows:
rC = α1 * rA +(1 - α1)* α2 *rB
gC = α1 * gA +(1 - α1)* α2 *gB
bC = α1 * bA +(1 - α1)* α2 *bB
where α1, α2 are the normalised alpha values alpha1, alpha2.
This function can be used for unsigned pixel data only.
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error condition if one of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
The code example below shows how to use alpha composition function.
IppStatus acomp( void ) { Ipp8u imga[8*8], imgb[8*8], imgc[8*8]; IppiSize roi = { 8, 8 }; IppStatus st; ippiImageRamp_8u_C1R( imga, 8, roi, 0, 1, ippAxsHorizontal ); ippiImageRamp_8u_C1R( imgb, 8, roi, 0, 2, ippAxsHorizontal ); st = ippiAlphaCompC_8u_C1R( imga, 8, 255/3, imgb, 8, 255, imgc, 8, roi, ippAlphaOver ); printf( "over: a=%d,A=255/3; b=%d,B=255; c=%d // c=a*A+b*(1-A)*B\n",imga[6],imgb[6],imgc[6] ); return st; }
Output
over: a=6,A=255/3; b=12,B=255; c=10 // c=a*A+b*B*(1-A)