Re: NSBezierPath stroke gives weird AA result.
Re: NSBezierPath stroke gives weird AA result.
- Subject: Re: NSBezierPath stroke gives weird AA result.
- From: Bertrand Landry-Hetu <email@hidden>
- Date: Thu, 11 Aug 2005 20:02:30 -0700
Tried it, the only difference is that now 2 of the straight lines are
blurred by the AA.
Now that I'm thinking about it, it must be something else that AA,
because the effect even more noticeable as I make the stroke width
wider. AA would only potentially add 1 pixel on each side of the
stroke, yet in the curved corners of my round rect I get a line that
is 3 times as wide as the straight lines.
2005/8/11, Ryan Britton <email@hidden>:
> You're running into a problem with the way pixel positions are
> calculated on OS X. You'll need to translate the path by 0.5, 0.5 to
> get rid of that extra wide line.
>
> Something like this:
> NSAffineTransform *transform = [NSAffineTransform transform];
>
> [transform translateXBy:0.5 yBy:0.5];
>
> [yourPath transformUsingAffineTransform:transform];
>
> On Aug 11, 2005, at 3:30 PM, Bertrand Landry-Hetu wrote:
>
> > looks like the attachment did not make it. made it available on the
> > web:
> >
> > http://software.landryhetu.com/NSBezierPathProblem.png
> >
> > 2005/8/11, Bertrand Landry-Hetu <email@hidden>:
> >
> >> Hi list,
> >>
> >> I'm trying to draw a frame for some thumbnail I'm going to show in my
> >> app. My graphic designer did some mockups in Illustrator that looks
> >> great. It is basically a rectangle of which 2 corners are round (so
> >> half a rounded rect :) ).
> >>
> >> When I try to draw it using Quartz I get some weird anti aliasing
> >> problems. I'm using [NSBezierPath appendBezierPathWithArcFromPoint:
> >> ...] to create the curved corners of the frame.
> >>
> >> Everything looks fine when I fill the path, but it really looks ugly
> >> when I stroke the path. It looks like the stroke is wider in the
> >> curves. (see attached pic).
> >>
> >> Anybody has any idea ?
> >>
> >> Here is the code:
> >>
> >> NSBezierPath * path = [NSBezierPath bezierPath];
> >>
> >> [path moveToPoint: topRight];
> >>
> >> [path appendBezierPathWithArcFromPoint: topLeft
> >> toPoint:
> >> bottomLeft
> >> radius: radius];
> >>
> >> [path lineToPoint: bottomLeft];
> >>
> >> [path appendBezierPathWithArcFromPoint: bottomRight
> >> toPoint: topRight
> >> radius: radius];
> >>
> >> [path lineToPoint: topRight];
> >>
> >> [path closePath];
> >>
> >>
> >> Thanks.
> >>
> >> Bertrand.
> >>
> >>
> > _______________________________________________
> > 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
> >
>
>
_______________________________________________
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