Add, subtract, and multiply blend modes work in a way that mimics light, but more often than not, we want to just put one thing on top of another. With those blend modes alone, we cannot complete this simple task. The venerable computer graphics concept of alpha comes to the rescue. Invented by Ed Catmull and Alvy Ray Smith in the 1970s, the alpha component is how we composite images with opacity.
Digital art tools use the RGBA acronym everywhere while glossing over what the A means. Let's finally define the A in this acronym; it is Alpha. The alpha is how much of a layer shows over what is beneath it, or its opacity. An alpha of 1 is completely opaque; an alpha of 0 is completely transparent. You can try it yourself with the Opacity Scale tool, which scales the alpha of an image.
It gets a bit more complicated when we composite multiple layers with different alphas. The formula that is most commonly used to handle this is called "Porter-Duff source over". To examine how this works for two colors, let's say we have a red color of (1, 0, 0) with an alpha of 0.6, so 60% opaque, and we have a background of a blue color of (0, 0, 1) with an alpha of 0.7, so 70% opaque. What is the color of these two semi-transparent colors overlapping? For Porter-Duff, the formula is:
where Cf and αf are the color and alpha of the foreground, Cb and αb are the color and alpha of the background, and Co and αo are the resulting color and alpha.

Foreground
Cf = (1, 0, 0)
αf = 0.6

Background
Cb = (0, 0, 1)
αb = 0.7
First, the alpha:
Then, the color:

Output
Co = (0.682, 0, 0.318)
αo = 0.88
There is an intuition behind the formula. Let's imagine alpha as the opacity of stained glass. An alpha of 0 would be completely transparent clear glass, and an alpha of 1 would be completely opaque, like a piece of wood. In our example, we have two stained glass pieces: red glass and blue glass. We look through the red glass at the blue glass. In this metaphor, as light hits the red glass, 60% of the light is reflected and 40% goes through. The blue glass receives 40% of the light. Of that 40% of the light that the blue glass receives, 70% is reflected back. So, we get 60% of light reflected by the red plus 70% of the remaining 40% of light that the blue glass receives (or 28%). The resulting opacity of the two pieces of glass together is 88%. But what about the color? The color works in much the same manner. The red glass contributes its 60%, and then the blue's 28% is added. In the formula, we divide by the output opacity (in this case 88%) so that the color remains a separate concept from the alpha.
The figure below demonstrates alpha in practice. The text is drawn over the painting with alpha going from 0, where the text is invisible, to 1, where the text fully covers the painting beneath it.




