• 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: Getting CGColor components
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting CGColor components


  • Subject: Re: Getting CGColor components
  • From: Development <email@hidden>
  • Date: Sat, 11 Jun 2011 17:23:20 -0700

:\

I think I have it figured out

All colors work except white and black.


I had to detect those and build the rgb manually

On Jun 11, 2011, at 4:12 PM, Development wrote:

> According to all the examples I have found the following code should give me the RGB components of any UIColor.CGColor I pass to it....
>
> However I get back a scrambled and often inaccurate array of color values which turns out to be useless.
>
>    CGFloat colors[[widgetArray count]*4];
>
>
>
>    id * item;
>    int idx=0;
>    for (item in widgetArray) {
>
>
>
>        const CGFloat *comp = CGColorGetComponents(item.backgroundColor.CGColor);
>        const CGFloat *c = CGColorGetComponents(item.backgroundColor.CGColor);
>
>        colors[idx] = comp[0];
>
>        colors[++idx] = comp[1];
>
>        colors[++idx] = comp[2];
>
>        colors[++idx] = c[CGColorGetNumberOfComponents(item.backgroundColor.CGColor)-1];
>
>        idx++;
>
>    }_______________________________________________
>
> 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

References: 
 >Getting CGColor components (From: Development <email@hidden>)

  • Prev by Date: Getting CGColor components
  • Next by Date: Re: iOS: encoding a custom view with a shape in it
  • Previous by thread: Getting CGColor components
  • Next by thread: Re: Getting CGColor components
  • Index(es):
    • Date
    • Thread