Skip to content

Commit

Permalink
colormaps: Add White Hot, Black Hot and White Hot compressed
Browse files Browse the repository at this point in the history
  • Loading branch information
devnulling authored and csete committed Jan 27, 2020
1 parent d5f8e00 commit e8dd0f2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/qtgui/dockfft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ DockFft::DockFft(QWidget *parent) :
ui->cmapComboBox->addItem(tr("Gqrx"), "gqrx");
ui->cmapComboBox->addItem(tr("Google Turbo"), "turbo");
ui->cmapComboBox->addItem(tr("Plasma"), "plasma");
ui->cmapComboBox->addItem(tr("White Hot Compressed"), "whitehotcompressed");
ui->cmapComboBox->addItem(tr("White Hot"), "whitehot");
ui->cmapComboBox->addItem(tr("Black Hot"), "blackhot");
}
DockFft::~DockFft()
{
Expand Down
27 changes: 27 additions & 0 deletions src/qtgui/plotter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1874,4 +1874,31 @@ void CPlotter::setWfColormap(const QString &cmap)
for (i = 0; i < 256; i++)
m_ColorTbl[i].setRgb(plasma[i][0], plasma[i][1], plasma[i][2]);
}
else if (cmap.compare("whitehotcompressed",Qt::CaseInsensitive) == 0)
{
// contributed by @drmpeg @devnulling
// for use with high quality spectrum paining
// see https://gist.github.com/drmpeg/31a9a7dd6918856aeb60
for (int i = 0; i < 256; i++)
{
if (i < 64)
{
m_ColorTbl[i].setRgb(i*4, i*4, i*4);
}
else
{
m_ColorTbl[i].setRgb(255, 255, 255);
}
}
}
else if (cmap.compare("whitehot",Qt::CaseInsensitive) == 0)
{
for (i = 0; i < 256; i++)
m_ColorTbl[i].setRgb(i, i, i);
}
else if (cmap.compare("blackhot",Qt::CaseInsensitive) == 0)
{
for (i = 0; i < 256; i++)
m_ColorTbl[i].setRgb(255-i, 255-i, 255-i);
}
}

0 comments on commit e8dd0f2

Please sign in to comment.