Mercurial > hg > svgui
changeset 536:aca01b3af29f
* Add High Gain colour map
author | Chris Cannam |
---|---|
date | Fri, 22 May 2009 15:50:10 +0000 |
parents | 78f9436195b1 |
children | 0cc658fe1423 |
files | layer/Colour3DPlotLayer.cpp layer/ColourMapper.cpp layer/ColourMapper.h |
diffstat | 3 files changed, 39 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp Fri May 22 13:54:45 2009 +0000 +++ b/layer/Colour3DPlotLayer.cpp Fri May 22 15:50:10 2009 +0000 @@ -1561,9 +1561,10 @@ .arg(m_maxy) .arg(m_invertVertical ? "true" : "false") .arg(m_opaque ? "true" : "false") - .arg(QString("binScale=\"%1\" smooth=\"%2\" ") + .arg(QString("binScale=\"%1\" smooth=\"%2\" gain=\"%3\" ") .arg((int)m_binScale) - .arg(m_smooth ? "true" : "false")); + .arg(m_smooth ? "true" : "false") + .arg(m_gain)); Layer::toXml(stream, indent, extraAttributes + " " + s); } @@ -1602,6 +1603,9 @@ (attributes.value("smooth").trimmed() == "true"); setSmooth(smooth); + float gain = attributes.value("gain").toFloat(&ok); + if (ok) setGain(gain); + float min = attributes.value("minY").toFloat(&ok); float max = attributes.value("maxY").toFloat(&alsoOk); if (ok && alsoOk) setDisplayExtents(min, max);
--- a/layer/ColourMapper.cpp Fri May 22 13:54:45 2009 +0000 +++ b/layer/ColourMapper.cpp Fri May 22 15:50:10 2009 +0000 @@ -39,7 +39,7 @@ int ColourMapper::getColourMapCount() { - return 11; + return 12; } QString @@ -60,6 +60,7 @@ case Banded: return tr("Banded"); case Highlight: return tr("Highlight"); case Printer: return tr("Printer"); + case HighGain: return tr("High Gain"); } return tr("<unknown>"); @@ -180,6 +181,31 @@ r = g = b = 1.f - r; hsv = false; break; + + case HighGain: + if (norm <= 1.f / 256.f) { + norm = 0.f; + } else { + norm = 0.1f + (powf(((norm - 0.5f) * 2.f), 3.f) + 1.f) / 2.081f; + } + // now as for Sunset + r = (norm - 0.24f) * 2.38f; + if (r > 1.f) r = 1.f; + if (r < 0.f) r = 0.f; + g = (norm - 0.64f) * 2.777f; + if (g > 1.f) g = 1.f; + if (g < 0.f) g = 0.f; + b = (3.6f * norm); + if (norm > 0.277f) b = 2.f - b; + if (b > 1.f) b = 1.f; + if (b < 0.f) b = 0.f; + hsv = false; +/* + if (r > 1.f) r = 1.f; + r = g = b = 1.f - r; + hsv = false; +*/ + break; } if (hsv) { @@ -229,6 +255,9 @@ case Printer: return Qt::red; + + case HighGain: + return Qt::red; } return Qt::white; @@ -244,6 +273,7 @@ case BlackOnWhite: case Printer: + case HighGain: return true; default: