From 9008f26fc3430e74f9747b0a7a8bb79270f7e7d0 Mon Sep 17 00:00:00 2001 From: f4exb Date: Sat, 20 Oct 2018 19:20:11 +0200 Subject: [PATCH] Spectrum: reworked histogram palette --- sdrgui/gui/glspectrum.cpp | 44 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/sdrgui/gui/glspectrum.cpp b/sdrgui/gui/glspectrum.cpp index 1b7ee8940..a0e5fafe6 100644 --- a/sdrgui/gui/glspectrum.cpp +++ b/sdrgui/gui/glspectrum.cpp @@ -86,23 +86,37 @@ GLSpectrum::GLSpectrum(QWidget* parent) : m_waterfallPalette[239] = 0xffffffff; m_histogramPalette[0] = 0; - for(int i = 16; i < 240; i++) { - QColor c; - c.setHsv(239 - i, 255 - ((i < 200) ? 0 : (i - 200) * 3), 150 + ((i < 100) ? i : 100)); - ((quint8*)&m_histogramPalette[i])[0] = c.red(); - ((quint8*)&m_histogramPalette[i])[1] = c.green(); - ((quint8*)&m_histogramPalette[i])[2] = c.blue(); - ((quint8*)&m_histogramPalette[i])[3] = c.alpha(); - } - for(int i = 1; i < 16; i++) { - QColor c; - c.setHsv(255, 128, 48 + i * 4); - ((quint8*)&m_histogramPalette[i])[0] = c.red(); - ((quint8*)&m_histogramPalette[i])[1] = c.green(); - ((quint8*)&m_histogramPalette[i])[2] = c.blue(); - ((quint8*)&m_histogramPalette[i])[3] = c.alpha(); + + for (int i = 1; i < 240; i++) + { + QColor c; + int val = i < 60 ? 255 : 200; + int sat = i < 60 ? 128 : i < 180 ? 255 : 180; + c.setHsv(239 - i, sat, val); + ((quint8*)&m_histogramPalette[i])[0] = c.red(); + ((quint8*)&m_histogramPalette[i])[1] = c.green(); + ((quint8*)&m_histogramPalette[i])[2] = c.blue(); + ((quint8*)&m_histogramPalette[i])[3] = c.alpha(); } + // Original palette: +// for(int i = 16; i < 240; i++) { +// QColor c; +// c.setHsv(239 - i, 255 - ((i < 200) ? 0 : (i - 200) * 3), 150 + ((i < 100) ? i : 100)); +// ((quint8*)&m_histogramPalette[i])[0] = c.red(); +// ((quint8*)&m_histogramPalette[i])[1] = c.green(); +// ((quint8*)&m_histogramPalette[i])[2] = c.blue(); +// ((quint8*)&m_histogramPalette[i])[3] = c.alpha(); +// } +// for(int i = 1; i < 16; i++) { +// QColor c; +// c.setHsv(255, 128, 48 + i * 4); +// ((quint8*)&m_histogramPalette[i])[0] = c.red(); +// ((quint8*)&m_histogramPalette[i])[1] = c.green(); +// ((quint8*)&m_histogramPalette[i])[2] = c.blue(); +// ((quint8*)&m_histogramPalette[i])[3] = c.alpha(); +// } + m_decayDivisor = 1; m_decayDivisorCount = m_decayDivisor; m_histogramStroke = 30;