Getting CGColor components
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