spraff
19th March 2009, 15:27
Hi. I'm trying to create a QImage and set the alpha channel to some value on a per-pixel basis. setAlphaChannel is no good because it sets the whole image at once.
Ideally, I'd have brushes treat the alpha component as non-special, i.e. the operation wouldn't be
pixel = (old_r,old_g,old_b)*(1-alpha) + (new_r,new_g,new_b)*alpha
but instead
pixel = (new_r, new_g, new_b, new_a)
or even
pixel = (old_r,old_g,old_b,old_a)*(1-beta) + (new_r,new_g,new_b,new_a)*beta
In the short term, however, setting pixels' alphas individually would be acceptable.
Ideally, I'd have brushes treat the alpha component as non-special, i.e. the operation wouldn't be
pixel = (old_r,old_g,old_b)*(1-alpha) + (new_r,new_g,new_b)*alpha
but instead
pixel = (new_r, new_g, new_b, new_a)
or even
pixel = (old_r,old_g,old_b,old_a)*(1-beta) + (new_r,new_g,new_b,new_a)*beta
In the short term, however, setting pixels' alphas individually would be acceptable.