[Interest] About copying the image buffer with alpha blending

Samuel Rødal samuel.rodal at nokia.com
Wed Aug 29 17:42:30 CEST 2012

On 08/29/2012 05:02 PM, Liu Song.7 (Nokia-MP/Beijing) wrote:
> Hi,
> After using the QPixmap, the pixel format now is Format_ARGB32_Premultiplied, and the performance looks better.
> But one question is about the background image, as this case the alpha channel info can be dropped,
> is there a way to discard this alpha info to accelerate drawing background image ?

The simplest way is to make sure there is no alpha channel in the PNG or
JPG you're loading it from. If you're using QPainter to draw it you can
also use setCompositionMode(QPainter::CompositionMode_Source) to make it
do a blit instead of a blend even if there's an alpha channel. Just
remember to set the composition mode back to the default
QPainter::CompositionMode_SourceOver after.

If you have a QPixmap, you can also do pixmap =
QPixmap::fromImage(pixmap.toImage().convertToFormat(QImage::Format_RGB32) to
lose the alpha channel.


More information about the Interest mailing list