ARGB32 png blending of alpha layer in transparent background
I'm using a custom hardware display driver that is realized as a linuxfb. I'm trying to display an image and perform the alpha blending operation in hardware. The code below passes the alpha layer of the image through fine (and the rest of the main application window is transparent as I'd expect). But, qt seems to be pre-applying the alpha layer to the image and blending with zeros. Is there a way to tell Qt just to pass the image colors through without applying the alpha value to the pixel data?
this->setStyleSheet("background:transparent");
QImage img;
img.load(":/images/images/box.png");
ui->label2->setPixmap(QPixmap::fromImage(img));
Re: ARGB32 png blending of alpha layer in transparent background
Maybe the image format is one that pre-applies the alpha value.
Have you tried creating and empty image with fully separated channel data, e.g. QImage::Format_ARGB32, then setting the pixel values manually and then checking if they arrive correctly?
Cheers,
_
Re: ARGB32 png blending of alpha layer in transparent background
Yeah, it's a good thought. But, if I do img.format() it returns 5 or the enumerated value QImage::Format_ARGB32.
Maybe I should be drawing the image in a different manner than using a QLabel?
Re: ARGB32 png blending of alpha layer in transparent background
You could try using QPainter::drawImage() in the paintEvent() of a custom widget class.
However, since QPixmap is supposed to be the platform specific graphics device related image type, it could be that the platform abstraction plugin does not correctly detect that you want to have ARGB as the native format.
I'd recommend checking the Linuxfb QPA code.
On a quick check it looks like it is using RGB_16 as the format for it screen images:
https://code.woboq.org/qt5/qtbase/sr...9QFbScreenC1Ev
Cheers,
_
Re: ARGB32 png blending of alpha layer in transparent background
Thanks. That's a good idea to start looking at the linuxfb constructor. I'll start playing with the code.