Nick Nick - 3 months ago 13
Android Question

Using Paint.setStrokeJoin() and Paint.setStrokeMiter()

I'm curious about what these methods do and how to use them as there doesnt seem to be any details beyond the single sentence descriptions in the Javadocs:

setStrokeJoin

setStrokeMiter

Anybody have some example code or a good description?

Answer

setStrokeJoin allows to set three modes how a line join of thick lines is rendered. ROUND means a circular section is used to go around the kink, BEVEL means another short straigt segment is used perpendicular to the halve angle, and MITER means the outer contour of the two joining lines is elongated until it intersects. However, when the angle is really sharp, that point can go very far away, so usually a limit is set that switches from MITER to BEVEL, if certain sharpness is reached. This limit is controlled by setStrokeMiter. For examples see here.