# HG changeset patch # User Chris Cannam # Date 1243007410 0 # Node ID aca01b3af29fbdb50a0491dc56bbb05a9460ec98 # Parent 78f9436195b1e2b2d151920acced0c5ddbb8d468 * Add High Gain colour map diff -r 78f9436195b1 -r aca01b3af29f layer/Colour3DPlotLayer.cpp --- 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); diff -r 78f9436195b1 -r aca01b3af29f layer/ColourMapper.cpp --- 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(""); @@ -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: diff -r 78f9436195b1 -r aca01b3af29f layer/ColourMapper.h --- a/layer/ColourMapper.h Fri May 22 13:54:45 2009 +0000 +++ b/layer/ColourMapper.h Fri May 22 15:50:10 2009 +0000 @@ -43,7 +43,8 @@ FruitSalad, Banded, Highlight, - Printer + Printer, + HighGain }; int getMap() const { return m_map; }