kCGColorSpaceGenericRGB is deprecated?

Hello,
I've just begun to dive into the Quartz framework.

I'm running the following code to initialze a CGColorSpaceRef:

CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);

When I compile the code, xcode complains about the constant kCGColorSpaceGenericRGB being deprecated. But according to Apple's documentation, there's no mention of it being deprecated.

Any ideas? If it is deprecated, can someone please post an alternative approach to creating a CGColorSpaceRef object?

Thanks!

iPhone OS 2.1, Mac OS X (10.5.5)

Posted on Oct 22, 2008 6:35 AM

Reply
3 replies

Oct 22, 2008 7:35 AM in response to halbertn

Command double click on that kCGColorSpaceGenericRGB gives

CG_EXTERN const CFStringRef kCGColorSpaceGenericRGB
CGAVAILABLE_STARTING(__MAC_104, _IPHONENA);

So it appears this isn't available in the iPhone OS. Searching CGColorSpace.h some more we find

CG_EXTERN CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void)
CGAVAILABLE_STARTING(__MAC_100, _IPHONE_20);

I think you want this

CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

kCGColorSpaceGenericRGB is deprecated?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.