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

Getting CGColor components


  • Subject: Getting CGColor components
  • From: Development <email@hidden>
  • Date: Sat, 11 Jun 2011 16:12:09 -0700

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

  • Follow-Ups:
    • Re: Getting CGColor components
      • From: Andreas Mayer <email@hidden>
    • Re: Getting CGColor components
      • From: Development <email@hidden>
  • Prev by Date: Re: Why Wasn't Memory Collected?
  • Next by Date: Re: Getting CGColor components
  • Previous by thread: Re: Why Wasn't Memory Collected?
  • Next by thread: Re: Getting CGColor components
  • Index(es):
    • Date
    • Thread