Inner Shadows

Inner shadows function identically and have the same API as drop shadows. Just call melatonin::InnerShadow.

Remember, inner shadows are rendered after the path is rendered.

class MySlider : public juce::Component
{
public:
    void paint (juce::Graphics& g) override
    {
        g.setColour (juce::Colours::red);
        path.fillPath (valueTrack);

        // inner shadows are painted *after* the path
        innerShadow.render (g, valueTrack);
    }

    void resized()
    {
        valueTrack.clear();
        valueTrack.addRoundedRectangle (10, 10, 100, 20, 2);
    }
private:
        melatonin::InnerShadow innerShadow = { juce::Colours::black, 3 };
}

Leave a Reply

Your email address will not be published. Required fields are marked *