Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start final color tweaking
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Aug 30, 2022
1 parent cd1b76f commit 481f594
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 79 deletions.
61 changes: 5 additions & 56 deletions opengl/Quantum.cpp
Expand Up @@ -1295,7 +1295,7 @@ void QuantumStereoLevelMeterWithLUFS::onNanoDisplay()
rect(pxl,
theme.borderSize + verticalReservedHeight + meterChannelHeight * (1.f - value),
meterChannelWidth, meterChannelHeight * value);
fillColor(theme.levelMeterColor.withAlpha(0.5f));
fillColor(theme.levelMeterColor);
fill();

std::snprintf(valuestr, sizeof(valuestr)-1, "%.0f", valueL);
Expand All @@ -1319,7 +1319,7 @@ void QuantumStereoLevelMeterWithLUFS::onNanoDisplay()
beginPath();
moveTo(pxl, y);
lineTo(pxl + meterChannelWidth, y);
strokeColor(theme.levelMeterColor.withAlpha(0.5f));
strokeColor(theme.levelMeterColor);
strokeWidth(theme.borderSize);
stroke();
}
Expand All @@ -1333,7 +1333,7 @@ void QuantumStereoLevelMeterWithLUFS::onNanoDisplay()
rect(pxr,
theme.borderSize + verticalReservedHeight + meterChannelHeight * (1.f - value),
meterChannelWidth, meterChannelHeight * value);
fillColor(theme.levelMeterColor.withAlpha(0.5f));
fillColor(theme.levelMeterColor);
fill();

std::snprintf(valuestr, sizeof(valuestr)-1, "%.0f", valueR);
Expand All @@ -1357,7 +1357,7 @@ void QuantumStereoLevelMeterWithLUFS::onNanoDisplay()
beginPath();
moveTo(pxr, y);
lineTo(pxr + meterChannelWidth, y);
strokeColor(theme.levelMeterColor.withAlpha(0.5f));
strokeColor(theme.levelMeterColor);
strokeWidth(theme.borderSize);
stroke();
}
Expand All @@ -1372,7 +1372,7 @@ void QuantumStereoLevelMeterWithLUFS::onNanoDisplay()
theme.borderSize + verticalReservedHeight + meterChannelHeight * (1.f - value),
meterChannelWidth * 2 + theme.borderSize * 2,
meterChannelHeight * value);
fillColor(Color(theme.levelMeterAlternativeColor, Color(), 0.5f));
fillColor(theme.levelMeterAlternativeColor);
fill();

std::snprintf(valuestr, sizeof(valuestr)-1, "LUFS: %.1f", valueLufs);
Expand Down Expand Up @@ -1456,57 +1456,6 @@ void QuantumStereoLevelMeterWithLUFS::idleCallback()

// --------------------------------------------------------------------------------------------------------------------

QuantumValueMeter18::QuantumValueMeter18(TopLevelWidget* const parent, const QuantumTheme& t)
: NanoSubWidget(parent),
theme(t)
{
setSize(32, 32);
}

void QuantumValueMeter18::setValue(const uint index, const float value)
{
DISTRHO_SAFE_ASSERT_INT_RETURN(index < ARRAY_SIZE(values), index,);

if (d_isEqual(values[index], value))
return;

values[index] = value;
repaint();
}

void QuantumValueMeter18::onNanoDisplay()
{
const uint wpb = getWidth() / (ARRAY_SIZE(values) / 2);

fillColor(theme.levelMeterColor.withAlpha(0.1f));
strokeColor(theme.widgetBackgroundColor.withAlpha(0.25f));
strokeWidth(std::max(1u, theme.borderSize / 2));

const float usableHeight = getHeight() / 2 - theme.padding;

for (size_t i=0; i<ARRAY_SIZE(values)/2; ++i)
{
const float valuableHeight = usableHeight * ((values[i] + 3) / 3);

beginPath();
rect(wpb * i, usableHeight - valuableHeight, wpb, valuableHeight);
fill();
stroke();
}

for (size_t i=0; i<ARRAY_SIZE(values)/2; ++i)
{
const float valuableHeight = usableHeight * ((values[ARRAY_SIZE(values)/2 + i] + 3) / 3);

beginPath();
rect(wpb * i, usableHeight * 2 + theme.padding - valuableHeight, wpb, valuableHeight);
fill();
stroke();
}
}

// --------------------------------------------------------------------------------------------------------------------

static inline
void respositionChildren(const Widget::PositionChangedEvent& ev, std::list<SubWidget*> children)
{
Expand Down
28 changes: 5 additions & 23 deletions opengl/Quantum.hpp
Expand Up @@ -42,17 +42,17 @@ struct QuantumTheme {
// how much extra width to give to text labels to compensate for rounding with >= 2x scaling factor
uint textPixelRatioWidthCompensation = 0;
// background color for level meter widgets
Color levelMeterColor = Color::fromHTML("#4ca947");
Color levelMeterColor = Color::fromHTML("#5c9187");
// alternative background color for level meter widgets
Color levelMeterAlternativeColor = Color::fromHTML("#ffc400");
Color levelMeterAlternativeColor = Color::fromHTML("#764b83");
// background color for widgets, e.g. slider line and knob padding, typically dark
Color widgetBackgroundColor = Color::fromHTML("#141414");
// default active color for widgets, e.g. pressed button and knob body
Color widgetDefaultActiveColor = Color::fromHTML("#3f535a");
Color widgetDefaultActiveColor = Color::fromHTML("#578079");
// default alternative color for widgets, similar to the active just an alternative color
Color widgetDefaultAlternativeColor = Color::fromHTML("#585338");
Color widgetDefaultAlternativeColor = Color::fromHTML("#6064ed");
// foreground color for widgets, e.g. slider handle and knob indicator, typically light
Color widgetForegroundColor = Color::fromHTML("#8c8c8c");
Color widgetForegroundColor = Color::fromHTML("#dcdcdc");
// window background, typically lighter than widget background
Color windowBackgroundColor = Color::fromHTML("#3d3d3d");
// text color, main / brightest tone
Expand Down Expand Up @@ -515,24 +515,6 @@ class QuantumStereoLevelMeterWithLUFS : public NanoSubWidget,

// --------------------------------------------------------------------------------------------------------------------

class QuantumValueMeter18 : public NanoSubWidget
{
const QuantumTheme& theme;
float values[18] = {};

public:
explicit QuantumValueMeter18(TopLevelWidget* parent, const QuantumTheme& theme);

void setValue(uint index, float value);

protected:
void onNanoDisplay() override;

DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(QuantumValueMeter18)
};

// --------------------------------------------------------------------------------------------------------------------

template<class tMainWidget>
class AbstractQuantumFrame : public NanoSubWidget
{
Expand Down

0 comments on commit 481f594

Please sign in to comment.