Question

I'm working on a MacAppStore friendly implementation of CIColorWheelGenerator. It's a simple CIFilter who generates the color wheel you can see in Apple's color picker. Sadly it's part of private things Apple doesn't allow us to use in our apps destined to the MacAppStore.

I've partially succeeded, I got a working implementation but it is still stuck in genericRGB color space. The Apple one works using sRGB color space. I've found a workaround :

CGColorSpaceRef cSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
NSDictionary *dict = @{kCIContextWorkingColorSpace : CFBridgingRelease(cSpace),};
CIContext *ctx = [CIContext contextWithCGContext:[[NSGraphicsContext currentContext] graphicsPort] options:dict];

[ctx drawImage:_wheelImage inRect:rect fromRect:_wheelRect];

(_wheelImage is a CIImage generated using my color wheel generator filter).

I've checked in QuartzComposer, CIColorWheelGenerator seams to be working with sRGB color space (based on my color perception and the fact that my own implementation doesn't give the same results). Know comes the question : did I misunderstood something and CIColorWheelGenerator I use in QC is not just a CIFilter but comes with more complex code or is it possible de specify the working color space in a CIFilter (by default genericRGB) ?

Here is a picture so you can see Apple's color wheel (on the right) isn't the same as mine (logicaly, on the left) :

tiny differences

And my app (left) vs Apple's color picker (right) you can see some similarities :

tiny differences 2

Was it helpful?

Solution

Quartz Composer has a hidden setting. Holding the option key while selecting Preferences from the menu. In the (Editor) pane, there will be an 'uncorrectedCoreImage' setting. Check it on, close QC, then re-open it. Now all filters will run in an uncorrected color space. Repeat the procedure to go back to normal color space conversion.

Other than this, I don't know of any way to change color spaces within Quartz Composer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top