Skip navigation.
 
mlRe: Cocoa, Quartz, Colorspaces and ColorSync
FROM : Robert Clair
DATE : Thu Sep 30 22:09:48 2004

> Here's the technote you want (2035):
> http://developer.apple.com/technotes/tn/tn2035.html. It explains how
> Quartz and color management work together, and gives some rough
> definition of the basic concepts.


Thanks for the reference. It had some interesting things that were new
to me (especially sips !) but
much of it was a rehash of docs I've already seen. Most of the
discussion is couched in terms of
keeping already extant PDF's and images constant. It doesn't really
address content creation
or Cocoa. In particular it doesn't answer the (by now perennial)
questions:

* What space is NSCalibratedRGBColorSpace ?

* What is actually being done when you do [myNSCalibratedRGBColor set]
and then draw ?

* If untagged data is considered to have Generic RGB Profile and 
NSCalibratedRGBColorSpace does
  turn out to be equivalent to the space defined by Generic RGB
Profile, then what in hell is the difference
  between "Calibrated RGB" and "Device RGB" in Cocoa ?

* Where and when do the transformations happen - again, what happens
between and RGB being
  supplied to Cocoa and the RGB being applied to the input of the
display ?

* An in a related matter - what is the Digital Color Meter app
measuring ? I used to be an experimental
  physicist. If you don't really know what your device is measuring,
it's a pretty worthless device.


>
> Second, the Quartz code you want to use is pretty much:
>
>         CMProfileRef aProfile;
>
>         CMGetDefaultProfileBySpace(cmRGBData, &aProfile);
>         if ( aProfile == NULL ) return PF_Err_OUT_OF_MEMORY;
>         
>         colorSpace = CGColorSpaceCreateWithPlatformColorSpace( aProfile );
>
>         CMCloseProfile( aProfile );
>
> The CGColorSpaceCreateWithPlatformColorSpace() is how you access
> ColorSync on the Mac, *not* using the ICC-based functions. It's very
> confusing. Look up CMGetDefaultProfileBySpace() and you'll see other
> constants which you can supply. You change these profiles in the
> ColorSync Utility app.
>


?????????????????????????


> Also, go to OmniGroup.com and download OmniAppKit. It has some nice
> ColorSync-relelated code for Cocoa that you can use.


I have the Omni code and I took another look at it on the train.
Unfortunately, it is more evidence for the suspicion that the Cocoa
level interfaces are useless for doing a real color managed
application. While Omni has done an elegant job of packaging their
stuff using their own profile object and a category for NSColor, they
are doing major monkey business behind the scenes: They do a runtime
replacement of the "set" selector for all the classes in the NSColor
class cluster. The replacement selector does some negotiation with
their own profile object, asks ColorSync for the device RGB equivalent
considering the various profiles and then does

CGContextSetFillColorSpace( ... );
CGContextSetStrokeColorSpace( ... );
CGContextSetFillColor( ... );
CGContextSetStrokeColor( ... );

using device RGB for the color space and the RGB components it gets at
the end of the
chain.

Or something like that - it's not exactly straightforward and I have
sit down sometime and trace it
out. At the moment I don't see any difference between how it treats an
NSColor that is calibrated RGB and
one that is device RGB.


Bob Clair

Related mailsAuthorDate
mlCocoa, Quartz, Colorspaces and ColorSync Robert Clair Sep 29, 17:47
mlRe: Cocoa, Quartz, Colorspaces and ColorSync Eric Ocean Sep 29, 18:54
mlRe: Cocoa, Quartz, Colorspaces and ColorSync Robert Clair Sep 30, 22:09
mlRe: Cocoa, Quartz, Colorspaces and ColorSync R. Scott Thompson Sep 30, 22:30