Re: NSColor to CGColor
Re: NSColor to CGColor
- Subject: Re: NSColor to CGColor
- From: Uli Kusterer <email@hidden>
- Date: Sun, 12 Nov 2006 19:51:57 +0100
Am 12.11.2006 um 16:48 schrieb j o a r:
I also bumped into this problem recently and ended up implementing
this function:
static CGColorRef CGColorCreateFromNSColor (CGColorSpaceRef
colorSpace, NSColor *color)
{
NSColor *deviceColor = [color colorUsingColorSpaceName:
NSDeviceRGBColorSpace];
float components[4];
[deviceColor getRed: &components[0] green: &components[1] blue:
&components[2] alpha: &components[3]];
return CGColorCreate (colorSpace, components);
}
Well, if someone passes in a CMYK color, this may cause the color to
change slightly. So, it may be desirable to check color's
colorSpaceName and, where possible, use an equivalent CGColorSpaceRef
etc.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden