How to draw lines, arcs and paths with stroke cap similar to SVG butt in FMX?


SVG supports stroke cap types Round, Square and Butt. The difference between Square and Butt is shown below (square on the left). Butt causes the stroke to end at the end points without going past by half the thickness.

The FMX TStrokeCap type supports Flat and Round. Based on the documentation linked to below, it would seem that Flat is the same as Butt ("The line ends at the last point"). Even comparing the line example images next to the definitions implies that Flat is equivalent to Butt (assuming that those lines have the same endpoints). However, it’s clear when drawing that Flat is equivalent to Square. So my first question is why is the documentation misleading?

Secondly, is there some method to draw using a true Butt end cap (pardon if that sounds rude)? Straight lines are easy, just move the endpoints towards each other by half the line thickness. If the Line thickness > Distance between end points then it’s a little more difficult but possible by drawing a line perpendicular with thickness equal to length. For arcs and curved paths I can’t see how to do it. An arc is always drawn with a straight section at the end as shown on the left in the image above. Am I missing something?

Comments are closed.