• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Converting colors to CGFloat
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting colors to CGFloat


  • Subject: Re: Converting colors to CGFloat
  • From: Steve Christensen <email@hidden>
  • Date: Fri, 31 Jul 2009 08:44:10 -0700

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


  • Follow-Ups:
    • Re: Converting colors to CGFloat
      • From: Jesper Storm Bache <email@hidden>
References: 
 >Converting colors to CGFloat (From: Matthias Schmidt <email@hidden>)

  • Prev by Date: Re: Exception-like behavior in save panel used for file choose
  • Next by Date: Re: Converting colors to CGFloat
  • Previous by thread: Converting colors to CGFloat
  • Next by thread: Re: Converting colors to CGFloat
  • Index(es):
    • Date
    • Thread