Per-pixel alpha blend function math [Resolved]
I know this is not vb, but...
I'm writing a function in vc++ for a dll that will be accessed from vb. It takes three hDC's and combines them, overlaying hdc2 over hdc1, using hdc3 as the mask.
I'm working with the DIB of the hdc's so it's hella fast (array of pixel values). Anybody know what the math formula for blending the pixels is?
this is how it might look in algebra.
d = f(o, s, a)
d = destination value
o = "layer 1" value
s = "layer 2" value
a = "alpha" or opacity value
all of the values range from 0 to 255 (this needs to be done for each channel of the pixel)
255 is full opacity and 0 is no opacity
if anybody can tell me what f is?
if you don't understand what i'm asking, let me know. maybe i can phrase it better