Suppose we have two images and we need to blend the images. Then we need to distinguish between foreground and background images, where the foreground is enhanced with foreground alpha enhancement and the background is lightened with foreground alpha enhancement.
Therefore, we have the following equation.
Here's a question: what if the background color also has an alpha value?
In this case, we need to first mix the foreground alpha and the background alpha into a special ‘blended’ alpha:
The alpha value of this blend is then applied from the color we obtained earlier.