When you draw a path with a bigger line stroke width, you might notice uggly edges.
no round stroke corners
In order to get them round you simply need to change the stroke join to round. Here are some default settings I’m using in my Doodle Drawer app.
1 2 3 4 5 6 7 8 9 10 | private void initPaint() { paint = new Paint(); paint.setAntiAlias(true); // enable anti aliasing paint.setColor(Color.WHITE); // set default color to white paint.setDither(true); // enable dithering paint.setStyle(Paint.Style.STROKE); // set to STOKE paint.setStrokeJoin(Paint.Join.ROUND); // set the join to round you want paint.setStrokeCap(Paint.Cap.ROUND); // set the paint cap to round too paint.setPathEffect(new CornerPathEffect(getStrokeWidth())); // set the path effect when they join. } |
At the end it should look like this:
round stroke corners
Leave a Reply