Am 29.08.2012 um 12:05 schrieb Samuel Rødal <[email protected]>:

> On 08/29/2012 11:54 AM, ext [email protected] wrote:
>> Is the premultiplied specified when creating QImage or other ?
> 
> The QImage constructor takes the QImage::Format. But if you load the
> image from file it should already pick Format_ARGB32_Premultiplied by
> default if the image has an alpha channel.

As a matter of fact I am just in this very topic ("alpha-blending and 
premultiplied values") myself.

I am not entirely sure, but I think when I loaded a PNG with alpha channel the 
format was *not* premultiplied alpha (but "normal" RGBA32 instead).

It probably depends on the source file: if the original data is premultipied 
RGBA, then the resulting QImage is most likely also RGBA premultiplied.

(Does the PNG file format support "premultiplied" RGBA?)

In other words: "you get what you load"(tm) with QImage::load - which is good! 
Qt shouldn't convert data behind your back unnecessarily.

So in my case the PNG contained "normal" RGBA values - so that was the pixel 
format of the resulting QImage.


However: you can always query the pixel format after loading and explicitly 
request a (possibly costly) conversion, if necessary:

  http://qt-project.org/doc/qt-4.8/qimage.html#convertToFormat

Cheers,
  Oliver
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to