I’m a bit lost about rectangle and line thickness…
As a quick test, I just change LookAndFeel_V3::drawButtonBackground
to simply draw a rectangle :
void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button, const Colour& /*backgroundColour*/,
bool /*isMouseOverButton*/, bool /*isButtonDown*/)
{
g.setColour (Colours::black);
const Rectangle<float> area (button.getLocalBounds().toFloat());
g.drawRect (area, 1.f);
}
Here is the result :
Now if I just change it to a rounded rectangle with a corner of 0, I got a thinner rectangle!
void LookAndFeel_V3::drawButtonBackground (Graphics& g, Button& button, const Colour& /*backgroundColour*/,
bool /*isMouseOverButton*/, bool /*isButtonDown*/)
{
g.setColour (Colours::black);
const Rectangle<float> area (button.getLocalBounds().toFloat());
g.drawRoundedRectangle (area, 0.f, 1.f);
}
Shouldn’t they lead to the same result?
Also, I can’t get such a thin rectangle If I just do the same in a paint method in my parent component (here I’m just testing that in the MenusDemo) :
void paint (Graphics& g) override
{
g.fillAll (Colour (0xffeeeeee));
g.setColour (Colours::black);
const juce::Rectangle<float> area (5.f, 80.f, 90.0f, 20.f);
g.drawRoundedRectangle (area, 0.f, 1.f);
g.drawRect (area.translated (100.f, 0.f), 1.f);
// test the same thing with a 0.5 offset
const juce::Rectangle<float> area2 (5.5f, 110.5f, 90.0f, 20.f);
g.drawRoundedRectangle (area2, 0.f, 1.f);
g.drawRect (area2.translated (100.f, 0.f), 1.f);
}
Why can’t I get the same result, what am I missing here?