Endcaps on Lines - GUI - Audio Plugins

Hi everyone,

I am trying to add rounded endcaps to lines I am drawing between two rotary sliders to show that the sliders are connected. I have no idea how to create these endcaps. Here’s what I have so far. How would I progress from here?

Line<float> ban1Line (Point<float> (230 , 122),
                     Point<float> (230 , 152));

Line<float> ban2Line (Point<float> (370 , 122),
                     Point<float> (370 , 152));

Line<float> ban3Line (Point<float> (510 , 122),
                      Point<float> (510 , 152));

g.drawLine(ban1Line, 4.f);
g.drawLine(ban2Line, 4.f);
g.drawLine(ban3Line, 4.f);

Thank you,

I would add them to a Path and call g.strokePath().
You can define the caps style in the PathStrokeType.

Hope that helps

Cool! Should I get rid of the lines and do them as paths instead?

You can use path.addLineSegment() or path.startSubPath(x, y) and path.lineTo(). That way you can use the caps settings.

1 Like

I got it to work! Thank you.