Bezier Path Arc Problem
Bezier Path Arc Problem
- Subject: Bezier Path Arc Problem
- From: "John Cassington" <email@hidden>
- Date: Wed, 4 Oct 2006 06:25:27 +1000
Hi, the image shows the problem
http://img522.imageshack.us/img522/6435/picture2ss3.png
here is the code:
- (void)drawRect:(NSRect)rect
{
NSColor *bgColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.1];
NSRect bgRect = rect;
int minX = NSMinX(bgRect);
int midX = NSMidX(bgRect);
int maxX = NSMaxX(bgRect);
int minY = NSMinY(bgRect);
int midY = NSMidY(bgRect);
int maxY = NSMaxY(bgRect);
float radius = 25.0; // correct value to duplicate Panther's App Switcher
NSBezierPath *bgPath = [NSBezierPath bezierPath];
// Bottom edge and bottom-right curve
[bgPath moveToPoint:NSMakePoint(midX, minY)];
[bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, minY)
toPoint:NSMakePoint(maxX, midY)
radius:radius];
// Right edge and top-right curve
[bgPath appendBezierPathWithArcFromPoint:NSMakePoint(maxX, maxY)
toPoint:NSMakePoint(midX, maxY)
radius:radius];
// Top edge and top-left curve
[bgPath appendBezierPathWithArcFromPoint:NSMakePoint(minX, maxY)
toPoint:NSMakePoint(minX, midY)
radius:radius];
// Left edge and bottom-left curve
[bgPath appendBezierPathWithArcFromPoint:bgRect.origin
toPoint:NSMakePoint(midX, minY)
radius:radius];
[bgPath closePath];
[bgColor set];
[bgPath fill];
[bgPath setLineWidth:10.0];
[[NSColor colorWithCalibratedWhite:0.75 alpha:0.3] set];
[bgPath stroke];
}
as you can see, the path i want is being stroked but around curves
there is an added squareness?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden