PathStrokeType rounded EndCap

I’m drawing a plain Arc…

Path arcPath; arcPath.addCentredArc(100, 100, radius, radius, 0, -0.8 * float_Pi, 0.8 * float_Pi, true);

then I make it into a stroke:

auto myStroke = PathStrokeType(2.0, juce::PathStrokeType::JointStyle::curved, juce::PathStrokeType::EndCapStyle::rounded); myStroke.createStrokedPath(arcPath, arcPath);
However if you’ll notice only one side is being rounded. (left side, start point)
image

Even if I split it into 2 arcs each one starting from the opposite direction (or starting from the end of the other one) I get same results.

am I missing something?

I tried this code:

    Path arcPath;
    arcPath.addCentredArc (500.0f, 500.0f, 400.0f, 400.0f, 0, -0.8f * float_Pi, 0.8f * float_Pi, true);

    PathStrokeType (50.0, juce::PathStrokeType::JointStyle::curved,
                    juce::PathStrokeType::EndCapStyle::rounded)
        .createStrokedPath (arcPath, arcPath);

    g.setColour (Colours::white);
    g.fillPath (arcPath);

…and it works perfectly.

This is why we recommend that you give us a test-case when posting a bug. Often when you try writing a self-contained bit of code like this to replicate it, you quickly find out what the difference is that’s causing your real app to go wrong.

1 Like

I’ve should’ve suspect the Component I’ve used. (internal slider component with region clipping :frowning:).

It does works perfectly. sorry for the inconvenience.