Sunday, October 11, 2009

iPhone dev Stupidity 33: Line width

from StackOverflow:

"The behaviour you are seeing stems from the fact that cocoa's drawing routines draw lines centered around the pixel positions on which you ask them to. Let me explain.

The straight lines that you are drawing fall on the very edge of the button's rectangle. When your drawing routine is called, Cocoa has conveniently set the clipping region to the exact boundary of the button rectangle, but when you ask Cocoa to draw a line along the edge, exactly half of the line is drawn outside of the clipping rectangle.

You notice the difference in the rounded corners because the curved portion falls completely inside the clipping rectangle, so none of it is clipped away."

No comments: