MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / paint

Method paint

Source/Panels/SpectrogramPanel/EnableButton.cpp:22–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22void EnableButton::paint (juce::Graphics& g)
23{
24 g.setColour (getColour().darker().darker());
25 g.fillEllipse (0.0f, 0.0f, getWidth(), getHeight());
26
27 g.setColour (getColour());
28 auto bounds = juce::Rectangle<int> (getLocalBounds()).toFloat();
29 auto radius = juce::jmin (bounds.getWidth(), bounds.getHeight()) / 2.0f;
30 auto lineW = radius * 0.2f;
31 auto arcRadius = radius - lineW * 2.0f;
32
33 juce::Path backgroundArc;
34 backgroundArc.addCentredArc (bounds.getCentreX(),
35 bounds.getCentreY(),
36 arcRadius,
37 arcRadius,
38 0.0f,
39 2 * M_PI * 0.1f,
40 2 * M_PI * 0.9f,
41 true);
42
43 g.strokePath (backgroundArc, juce::PathStrokeType (lineW, juce::PathStrokeType::curved, juce::PathStrokeType::rounded));
44 g.drawLine (getWidth() / 2.0f, getHeight() / 6.0f, getWidth() / 2.0f, getHeight() / 2.0f, lineW);
45}
46
47void EnableButton::resized()
48{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected