[Development] Color Profile support on Qt

Olivier Goffart olivier at woboq.com
Tue Jul 17 18:16:43 CEST 2012


On Monday 16 July 2012 20:49:49 Alessandro Portale wrote:
> On Mon, Jul 16, 2012 at 7:07 PM, Olivier Goffart <olivier at woboq.com> wrote:
> > All QPainter operations (at least in the raster engine) assume a linear
> > color space. That means that the color conversion need to hapen last,
> > right before being shown to the screen. After all kind of blending
> > operations or anything done with QPainter.  (That means it could even
> > been done in the platform plugin)
> 
> Good point. That way may automagically solve the issue with which
> screen (output-) profile to use when painting on a "screen". However,
> color transformations are not cheap and may slow down painting. I
> already see all kinds of caching in that area :)

I'm afraid you will have to re-do the color conversion on each frame. (for 
what has changed)

> > Color conversion should probably also happen when loading images, to
> > convert them to a linear color space.  Right now, Qt do no handle color
> > profiles at all, so it interpret png for example as plain linear RGB
> > instead of sRGB.
> Would the 'linear' RGB in this case be the screen RGB? 

Unfortunately not.

linear means you can blend images like this:
dst = alpha * src + (1 - alpha) * dst

Or do anti-aliasing like:    dst = src * proportion_of_the_pixel

Which is what QPainter does when it blends, when it interpolates, when it 
scales smoothly, when it does antialiasing, when it draws text, ...
QPainter assumes colors are linear.
(At least the raster engine do)

But in most color profiles, it is not the case.

But Qt has chosen to ignore the problem for the reasons of performence. (Even 
if you can see the difference clearly with naked eyes)

But should you integrate color profile in Qt, i guess it should be done 
properly :-)


>  ... QPainter would remain color profile agnostic, as it is right now.

I think indeed QPainter should remain color profile agnostic. 
But it only gives the correct results on linear color space.  




More information about the Development mailing list