Re: Reverse-engineering Apple's two-tinted gradient NSViews
Re: Reverse-engineering Apple's two-tinted gradient NSViews
- Subject: Re: Reverse-engineering Apple's two-tinted gradient NSViews
- From: Sam Krishna <email@hidden>
- Date: Thu, 22 Jan 2009 08:01:00 -0500
Two points:
1. "Reverse-engineer" may be a little strong. "Mimicking" is what I'm
going after.
2. I meant to say "right" (nee correct) angle, not right angle. Please
don't respond with a pithy "all 90 degree angles are the right angle"
Live Playfully,
Sam
-----
If he listens in faith,
finding no fault, a man is free
and will attain the cherished words
of those who act in virtue.
On Jan 22, 2009, at 7:57 AM, Sam Krishna wrote:
I think my understanding of NSGradient's use may be off here....
I'm trying to create a custom NSView that uses NSGradient to shade
the view in such a way that it mimics Apple's two-tints NSView. You
can see the color scheme at the bottom left hand corner of Mail and
the NSView at the bottom of Automator (I'm sure there are other
apps, but I can't figure out which ones they are).
Here's the code I'm using for -drawRect:
- (void)drawRect:(NSRect)rect {
// Drawing code here.
NSArray *_colorArray = [NSArray arrayWithObjects:
[NSColor colorWithDeviceRed:0.9843 green:
0.9843 blue:0.9843 alpha:1.0],
[NSColor colorWithDeviceRed:0.9608 green:
0.9608 blue:0.9608 alpha:1.0],
[NSColor colorWithDeviceRed:0.8824 green:
0.8824 blue:0.8824 alpha:1.0],
nil];
NSGradient *_gradient = [[NSGradient alloc]
initWithColors:_colorArray];
[_gradient drawInRect:rect angle:90];
[_gradient release];
}
Am I using the right NSGradient method? Is it the right angle?
I tried using -drawFromPoint:toPoint:options:, but that didn't work,
either. Any ideas?
Live Playfully,
Sam
-----
If he listens in faith,
finding no fault, a man is free
and will attain the cherished words
of those who act in virtue.
_______________________________________________
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