Missing something with CGColorGetComponents()
Missing something with CGColorGetComponents()
- Subject: Missing something with CGColorGetComponents()
- From: Laurent Daudelin <email@hidden>
- Date: Thu, 14 Oct 2010 10:58:17 -0700
My first foray in Quartz and I'm having some problems, obviously missing something.
Given the following code in a subclass of UIButton:
UIColor *baseColor = self.backgroundColor;
CGColorRef cgColor = baseColor.CGColor;
int32_t model = CGColorSpaceGetModel(CGColorGetColorSpace(cgColor));
const CGFloat *colorComponents = CGColorGetComponents(cgColor);
float red = 0.0;
float green = 0.0;
float blue = 0.0;
float alpha = 0.0;
if (model == kCGColorSpaceModelRGB)
{
red = colorComponents[0];
green = colorComponents[1];
blue = colorComponents[2];
alpha = colorComponents[3];
}
It doesn't matter which background color I choose for the button in Interface Builder, all the main 3 color components are always 1. Yes, I double-checked that I had a valid reference to my button, I just don't get it.
Anybody sees what I'm doing wrong?
-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
Logiciels Nemesys Software 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