1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 13:21:50 -05:00

Spectrum: reworked histogram palette

This commit is contained in:
f4exb 2018-10-20 19:20:11 +02:00
parent fac0e652c4
commit 9008f26fc3

View File

@ -86,23 +86,37 @@ GLSpectrum::GLSpectrum(QWidget* parent) :
m_waterfallPalette[239] = 0xffffffff; m_waterfallPalette[239] = 0xffffffff;
m_histogramPalette[0] = 0; m_histogramPalette[0] = 0;
for(int i = 16; i < 240; i++) {
for (int i = 1; i < 240; i++)
{
QColor c; QColor c;
c.setHsv(239 - i, 255 - ((i < 200) ? 0 : (i - 200) * 3), 150 + ((i < 100) ? i : 100)); int val = i < 60 ? 255 : 200;
((quint8*)&m_histogramPalette[i])[0] = c.red(); int sat = i < 60 ? 128 : i < 180 ? 255 : 180;
((quint8*)&m_histogramPalette[i])[1] = c.green(); c.setHsv(239 - i, sat, val);
((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])[0] = c.red();
((quint8*)&m_histogramPalette[i])[1] = c.green(); ((quint8*)&m_histogramPalette[i])[1] = c.green();
((quint8*)&m_histogramPalette[i])[2] = c.blue(); ((quint8*)&m_histogramPalette[i])[2] = c.blue();
((quint8*)&m_histogramPalette[i])[3] = c.alpha(); ((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_decayDivisor = 1;
m_decayDivisorCount = m_decayDivisor; m_decayDivisorCount = m_decayDivisor;
m_histogramStroke = 30; m_histogramStroke = 30;