开发者

CoreGraphics rounded corner thickness

开发者 https://www.devze.com 2022-12-23 20:04 出处:网络
Whenever I stroke a path with rounded corner开发者_运维技巧s on iPhone, the rounded corners are thicker than the rest of the stroked path. See here for what I mean:

Whenever I stroke a path with rounded corner开发者_运维技巧s 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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号