Re: Problem drawing multiple parallel lines
Re: Problem drawing multiple parallel lines
- Subject: Re: Problem drawing multiple parallel lines
- From: Quincey Morris <email@hidden>
- Date: Fri, 25 Jul 2008 15:32:08 -0700
On Jul 25, 2008, at 15:08, Mark Teagarden wrote:
NSBezierPath * apath;
apath = [[NSBezierPath alloc] init];
[[NSColor grayColor] set];
for(i=0;i<12;i++){
[apath setLineWidth:0.15];
[apath moveToPoint: NSMakePoint(borders.origin.x
+20+16*i,borders.origin.y+20)];
[apath lineToPoint: NSMakePoint(borders.origin.x
+420+16*i,borders.origin.y+320)];
[apath stroke];
}
You're adding a subpath to the path every iteration, so previously
drawn subpaths are getting redrawn -- the first one 12 times, the
second one 11 times, and so on.
Anti-aliasing, in combination with a fractional line width, is causing
the line "spreading" effect.
You need [apath removeAllPoints] inside the loop after [apath stroke],
or move [apath stroke] outside the loop.
_______________________________________________
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