Ugh... Qt4 porting

Mosfet dan.duley at
Mon May 16 13:55:30 BST 2005

Hi Lars! You guys really need to start CCing me. I'm not on the list so am 
cutting and pasting responses from the mailing list archive ;-)

>Lars wrote:
>> I'm also curious about what they are going to do with the new Premultiplied
>> format. As far as I can tell it's a 32bpp format with the source part of
>> the alpha already calculated. Good if your going to alphablend the image a
>> lot, bad if you want to modify the original color channels. 
>The image paint engine uses it. All drawing operations are a lot faster when 
>using premultiplied alpha. It's also the format used by RENDER, so it matches 
>fine there as well.
>And I don't see why you shouldn't be able to modify the color channels in a 
>premultiplied image more or less the same way then in a non premultiplied 

Because a pixel's RGB values aren't the actual RGB values, they are averaged 
with the alpha value. So if your doing something like interpolating a color 
you'd be interpolating with the wrong color, no? Even simple things like the 
gray level would be wrong. A red value of 25 may actually be 100 but with 
1/4th the opacity. Most effects won't work properly with this.

>> Right now I just return if I get one of these.
>QImage has a convertToFormat() method you could use: Convert to a format you 
>can handle, and convert back at the end. Not fast, but maybe better than just 
>not doing anything.
We promote images to 32bpp when we have to but generally do not do things that 
require a lot of conversion, for example we don't do effects on 1bpp images 
by promoting them. I guess it would depend on how often it is used. Doing so 
will kill performance, and in such cases the approach has been that it's 
better to warn the developer.

More information about the kde-core-devel mailing list