Accessing alpha channel of QImage directly
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.
Re: Initially transparent QImage
And what is wrong with using QImage::setPixel()?
Re: Accessing alpha channel of QImage directly
Quote:
Originally Posted by
spraff
setPixel refers to RGB, not RGBA
No, it referrs to QRgb which may also contain the alpha value.