OSX 10.6 Gamma problem

Hi All

I’ve a problem with new gamma. If I set old gamma 1.8 (in System Preferences), my UI looks as it should (and as in 10.5.x).
However with new gamma 2.2 it becomes “blotched” (see attached picture).

I use ::SetWindowContentColor and ::EraseRect with same color value (204, 204, 204). I realize Carbon/QuickDraw is obsolete but with big app I can’t jump on Cocoa momentary. Also unclear is it related with Carbon. Any idea/suggestion?


I don’t have a solution for you, but I seem to remember others (on Apple’s Carbon mailing list, I think) who had problems with the new gamma and QuickDraw code when 10.6 was released.

Is you app glut-based? If not, maybe you could try drawing using CoreGraphics instead? Hopefully, the gamma problems would go away then.
You don’t have to start using Cocoa at all in order to use CoreGraphics, it’s completely usable from Carbon (and it has been the preferred drawing API for Carbon since 10.3 or 10.2 or so).
You can get a CGContextRef from the kEventParamCGContextRef of the kEventControlDraw event (if that is how you are drawing). Alternatively, you can use QDBeginCGContext/QDEndCGContext to get a CGContext for a known QuickDraw port, and then use that CGContextRef for drawing.

(It might work in a glut app too, but I’m not sure how to get a valid CGContextRef in that case. Maybe QDBeginCGContext/QDEndCGContext will work?


Just a follow-up to my reply:

This is the mailing list mail I was thinking about:


and this is the reply from a Carbon engineer at Apple:



Hello Pappis

Sorry for delayed reply. Yes, HISetWindowColorRef works and does what we need, thank you. About Carbon - we realize well need to get rid of it ASAP. but with app above million lines of code it’s not so easy as wanted :slight_smile:

Thanks again


I had a problem with gamma for my Carbon app in OSX 10.6, UI looked “blotched”
With Pappis’ help it was solved, here are details


However, the trick with HIWindowSetColorSpace does not work in OSX 10.7 Lion
Looking for solutions again