cgcolorspace

How to convert colors from one color space to another?

Is there a Cocoa Touch way to convert colors from one color space to another? At the end of this code: UIColor *grey = [UIColor colorWithWhite: 0.5 alpha: 1.0]; CGColorRef greyRef = [grey CGColor]; int x = CGColorGetNumberOfComponents(greyRef); ...x is 2. The reason I need this is I'm trying to copy colors to a list of color compon...

Is there a penalty for mixing color spaces? (Core Graphics)

If I'm writing drawing code in Core Graphics on Mac OS X or iPhone OS, I can set the active fill color to red by calling: CGContextSetRGBFillColor(context, 1.0, 0.0, 0.0, 1.0); // RGB(1,0,0) If I want 50% gray, I could call: CGContextSetRGBFillColor(context, 0.5, 0.5, 0.5, 1.0); // RGB(0.5,0.5,0.5) But for shades of gray it's tempt...