ugluk
21st January 2013, 15:20
I see this code in setPixel() from qimage.cpp:
case Format_ARGB32:
case Format_ARGB32_Premultiplied:
((uint *)s)[x] = index_or_rgb;
break;
This means, that the RGB values are not premultiplied with alpha, when the pixel is set. To set the pixel values correctly, do I need to do this?
image.setPixel(x, y, qRgba(qt_div_255(color.alpha() * color.red()),
qt_div_255(color.alpha() * color.green()),
qt_div_255(color.alpha() * color.blue()),
color.alpha()));
Or when and how do the RGB values get premultiplied? In other words, how to set the pixel so it contains the correct value?
case Format_ARGB32:
case Format_ARGB32_Premultiplied:
((uint *)s)[x] = index_or_rgb;
break;
This means, that the RGB values are not premultiplied with alpha, when the pixel is set. To set the pixel values correctly, do I need to do this?
image.setPixel(x, y, qRgba(qt_div_255(color.alpha() * color.red()),
qt_div_255(color.alpha() * color.green()),
qt_div_255(color.alpha() * color.blue()),
color.alpha()));
Or when and how do the RGB values get premultiplied? In other words, how to set the pixel so it contains the correct value?