CGContext draw 45 degree line joint

156 Views Asked by At

Is there any way to draw lines in CGContext which connected with each other with 45 degree angle, like this picture shows: enter image description here

1

There are 1 best solutions below

0
i_am_jorf On BEST ANSWER

I don't think there is a simple way to do it. If there were, it would be one of the options you could pass to CGContextSetLineCap, but it only supports Butt, Round, and Square.

What you would need to do is write a function that takes two end points, a direction (so you know which side to make smaller), and a color. Use this info to draw a filled-in trapezoid.