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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to