I think this should do it, but I haven't tested it:
Delphi-Quellcode:
function ColorAlgebra(F, B, M: TColor32): TColor32;
begin
// 1. multiply
Result := ColorModulate(F, B);
// 2. blend
Result := BlendRegEx(Result, B, M);
end;
[edit]
Only your assumption that alpha=0 would result in picture 2 is false. What you'd really get is a picture that has the background in the middle and then fades to solid black near the edges. Nowhere in this picture you'd see anything white.
Because if you did, then you'd logically also have some white in it when alpha>0, which is what happens in 3 and 4.
[/edit]