Question

Whenever I stroke a path with rounded corners on iPhone, the rounded corners are thicker than the rest of the stroked path. See here for what I mean:

rounded corner thickness http://img181.imageshack.us/img181/6372/screenshot20100320at123.png

Not sure why this happens, any ideas?

Was it helpful?

Solution

I agree with Peter Hosey's analysis that the outer half of your lines is getting clipped off, but my recommendation would be to move all the coordinates .5 pixels inward instead. This way your straight lines will be crisper (not antialiased across 2 screen pixels) as well.

OTHER TIPS

I suspect that you're drawing within a rectangular clipping path; the corners fall completely within the rectangle, but the sides get cut in half: half inside the clipping path and so drawn, half outside and so clipped out.

Try adding the path to the clipping path before stroking it.

To do this, you will need to add the CGPath to the context's current path twice:

  1. Add CGPath to current path.
  2. Add current path to clipping path (thereby emptying current path).
  3. Add CGPath to current path.
  4. Stroke current path.

It just looks thicker. If you zoom in on it you will see what looks like a couple extra pixels of black is actually some pixels of gray caused by antialiasing.

Try turning off antialiasing to see if the result looks better.

Edit: Also the bottom right corner seems to have a drop shadow effect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top