Grabbing QQuickItem to image and comparing to QImage from disk fails because of inconsistent alpha channel premultiplication
-
Hi,
I want to verify the implementation of a customQQuickItem
that derives fromQQuickPaintedItem
. The plan is to grab it at test runtime to an image and compare it against a reference image (which was stored from the initial test run, so it was also generated by the Qt engine).
The format from the software image isQImage::Format_ARGB32_Premultiplied
, so I callreinterpretAsFormat(QImage::Format_ARGB32_Premultiplied)
on the reference image I load from disk to assure that both have the same format.
It appears as if the software image has the premultiplication applied different then the reference image. Is this expected or an issue in QImage?My workaround for now is to store the grabbed image to disk and load it immediately after again. Then the comparison is successfull.
Another note: different color values are reported from
QImage::pixel(x, y)
andQImage::pixelColor(x,y)
depending on the image format of the two images.Thx,
Andi