Re: Finder-like Color Labels
Re: Finder-like Color Labels
- Subject: Re: Finder-like Color Labels
- From: Ricci Adams <email@hidden>
- Date: Thu, 29 Jan 2004 23:05:24 -0600
Andreas,
My initial version used NSBezierPath; however, I was unable to get the
gradient working. I tried drawing both paths (one for the label and one
for the shadow) and then drawing on the gradient with
NSRectFillUsingOperation;
however, I couldn't get it to draw only within the bounds of the label.
By using CoreGraphics, I can draw the label part, set it up as a
clipping path, then
draw in the highlight.
Ricci Adams
> (Rounded rectangles that have a slight shadow and a gradient).
>
> I just created an implementation of this, you can download it
> at http://www.ricciadams.com/downloads/labeldemo.tar.gz
Nice!
Any reason you used Core Graphics drawing instead of NSBezierPath?
'Cause I needed the same form for those Safari like roll over buttons
and came up with this:
- (void)appendBezierPathWithPlateInRect:(NSRect)rect
{
if (rect.size.height > 0) {
float xoff = rect.origin.x;
float yoff = rect.origin.y;
float radius = rect.size.height/2.0;
NSPoint point4 = NSMakePoint(xoff+radius,
yoff+rect.size.height);
NSPoint center1 = NSMakePoint(xoff+radius, yoff+radius);
NSPoint center2 = NSMakePoint(xoff+rect.size.width-radius,
yoff+radius);
[self moveToPoint:point4];
[self appendBezierPathWithArcWithCenter:center1 radius:radius
startAngle:90.0 endAngle:270.0];
[self appendBezierPathWithArcWithCenter:center2 radius:radius
startAngle:270.0 endAngle:90.0];
[self closePath];
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.