This effect is used to combine two images using the alpha channels of the images to control the blending. It provides for the standard alpha blending options, and can handle pre–multiplying by any color, although white and black are most common and often run faster.
The alpha compositor effect takes a maximum of two sources .
The QTPlgEffectAlphaCompositorDesc class implements methods and properties to setup programmatically the parameters of the alpha compositor effect provided natively by QuickTime.
→ → → →
The QTPlgEffectAlphaCompositorDesc class constructors are called when you create a new instance of the class, while the ˜QTPlgEffectAlphaCompositorDesc class destructor, is called automatically when the class is no more in use. Also, you can invoke the class destructor by setting the instance of the class to nil.
Once a new class instance is returned, it is good practice to check the class property to be sure that the new object can be used. For discussion about the validity of an effect description instance see the documentation relative to the .
The class provides you with the following initializer methods:
()
This is the default constructor. Use this constructor to create a completely new data descriptor container in memory.
(other as )
This is the copy constructor. The properties of the object to be copied will be used to initialize the
new class instance properties. Note that the parameter passed is a generic object; this is due to the
fact that you could use a descriptor obtained by the that returns a generic
. Anyway, the class makes a
control to check if the passed object is suitable for use and, if not, will initialize the class instance with default values
determines the blend mode for the effect. Only values defined in the
below can be used for this property
if the blend mode is "pre–multiply alpha" this parameter contains the color used in the pre–multiply blend, otherwise it is ignored
perform a standard alpha blend. The alpha channel value of the first source defines the amount of the first source that is included in the composited image,
and one minus the alpha channel value of the first source defines the amount of the second source that is included in the composited image
calculates the destination pixel according to the following formulae:
where
DestinationRed = PreMultiplyRed * (1-alphaC) + temp1 * alphaC
DestinationGreen = PreMultiplyGreen * (1-alphaC) + temp2 * alphaC
DestinationBlue = PreMultiplyBlue * (1-alphaC) + temp3 * alphaC
where
alphaC = alphaB + (1-alphaB) * alphaA
temp1 = (alphaA * SourceARed + alphaB * sourceBRed)/alphaC
temp2 = (alphaA * SourceAGreen + alphaB * sourceBGreen)/alphaC
temp3 = (alphaA * SourceABlue + alphaB * sourceBBlue)/alphaC
perform a reverse alpha blend. The one minus the alpha channel value of the first source defines the amount of the first source that is included in the
composited image, and the alpha channel value of the first source defines the amount of the second source that is included in the composited image