[Qt-interest] pc vs mac color differences (gamma correcting qcolor?)

Nathan Carter nathancarter5 at gmail.com
Thu Jun 18 18:44:20 CEST 2009


Dear Ross,

Are you sure that the difference can be fixed using gamma correction?   
If so, how did you become sure of that?  And if so, is the source of  
your certainty due to some docs which gave you the 1.8 vs. 2.2  
difference?  I see these two numbers mentioned on the Wikipedia  
article under gamma correction, but that seems to be specific to image  
files.

Your math seems correct to me, if your goal is to take a number  
a^(2.2/1.8) and convert it back to the original a.  (In that case,  
raising it to the 1.8/2.2 power is exactly the right thing to do,  
modulo roundoff issues.)  But are you certain that this is the  
operation that will solve your problem?  It seems not, given that it's  
not doing so.

So I guess I'm suggesting that you find out what's causing the  
difference; did you just assume that it's a gamma-correction issue?   
Am I helping at all?

Nathan


On Jun 18, 2009, at 3:42 AM, Ross Bencina wrote:

> Hi Guys
>
> I run Windows and OSX on the same computer using BootCamp. On each  
> OS, on
> exactly the same screen, colours displayed in my Qt app look  
> different. This
> is a problem since I have invested in having a custom colour scheme  
> designed
> for my app and I would like it to look just as good on both platforms.
>
> I have experimented with gamma correcting each QColor in my QPalette  
> but it
> doesn't seem to work very well -- possibly because my gamma  
> correction code
> is wrong (see below for interest).
>
> Has anyone solved this problem? Do you have any suggestions about  
> how to
> approach it?
>
> /// try to convert a QColor which looks correct on PC to something  
> which
> looks correct on OSX
> /// (not working very well)
> static QColor pcColor( int rr, int gg, int bb, int aa=255 )
> {
> QColor c(rr,gg,bb,aa);
> static const double m = 1.8/2.2;
> qreal r = std::pow( c.redF(), m );
> qreal g = std::pow( c.greenF(), m );
> qreal b = std::pow( c.blueF(), m );
>
> return QColor::fromRgbF( r, g, b, c.alphaF() );
> }
>
>
>
> Thanks!
>
> Ross.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list