Re: Converting colors to CGFloat
Re: Converting colors to CGFloat
- Subject: Re: Converting colors to CGFloat
- From: Jesper Storm Bache <email@hidden>
- Date: Fri, 31 Jul 2009 08:52:38 -0700
Given that QD is not color managed, I would expect that you should use
[NSColor colorWithDeviceRed..] rather than the calibrated variation.
(I must admit that I find the documentation regarding calibrated and
device rather thin in various NSColor references).
Jesper
On Jul 31, 2009, at 8:44 AM, Steve Christensen wrote:
On Jul 31, 2009, at 2:31 AM, Matthias Schmidt wrote:
how do I convert color values from longint or UInt16 as they were
used with the carbon API to CGFloat used with NSColor?
I assume you're talking about something like QuickDraw's RGBColor,
where color components range from 0 to 65535? You could do something
like this:
NSColor* NSColorFromQuickDrawRGBColor(const RGBColor* color)
{
return [NSColor colorWithCalibratedRed:((CGFloat)color->red /
65535.0)
green:((CGFloat)color->green /
65535.0)
blue:((CGFloat)color->blue /
65535.0)
alpha:1.0];
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden