Mercurial > hg > svgui
changeset 1112:d578b685d912 spectrogram-minor-refactor
Colourmap rotation (inelegantly)
author | Chris Cannam |
---|---|
date | Tue, 19 Jul 2016 10:12:30 +0100 |
parents | 953ce409ccfb |
children | 261a00010918 |
files | layer/Colour3DPlotRenderer.cpp layer/Colour3DPlotRenderer.h layer/SpectrogramLayer.cpp |
diffstat | 3 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp Tue Jul 19 09:36:21 2016 +0100 +++ b/layer/Colour3DPlotRenderer.cpp Tue Jul 19 10:12:30 2016 +0100 @@ -370,7 +370,8 @@ QRect r(rx0, ry1, rw, ry0 - ry1); float value = preparedColumn[sy - minbin]; - QColor colour = m_params.colourScale.getColour(value, 0);//!!! +rotation + QColor colour = m_params.colourScale.getColour(value, + m_params.colourRotation); if (rw == 1) { paint.setPen(colour); @@ -938,10 +939,10 @@ m_drawBuffer = QImage(w, h, QImage::Format_Indexed8); for (int pixel = 0; pixel < 256; ++pixel) { - //!!! todo: colour rotation (here 0) m_drawBuffer.setColor ((unsigned char)pixel, - m_params.colourScale.getColourForPixel(pixel, 0).rgb()); + m_params.colourScale.getColourForPixel + (pixel, m_params.colourRotation).rgb()); } m_drawBuffer.fill(0);
--- a/layer/Colour3DPlotRenderer.h Tue Jul 19 09:36:21 2016 +0100 +++ b/layer/Colour3DPlotRenderer.h Tue Jul 19 10:12:30 2016 +0100 @@ -64,7 +64,8 @@ binScale(BinScale::Linear), alwaysOpaque(false), interpolate(false), //!!! separate out x-interpolate and y-interpolate? the spectrogram actually does (or used to) - invertVertical(false) { } + invertVertical(false), + colourRotation(0) { } ColourScale colourScale; // complete ColourScale object by value ColumnNormalization normalization; @@ -73,6 +74,7 @@ bool alwaysOpaque; bool interpolate; bool invertVertical; + int colourRotation; }; Colour3DPlotRenderer(Sources sources, Parameters parameters) :
--- a/layer/SpectrogramLayer.cpp Tue Jul 19 09:36:21 2016 +0100 +++ b/layer/SpectrogramLayer.cpp Tue Jul 19 10:12:30 2016 +0100 @@ -845,8 +845,6 @@ void SpectrogramLayer::setColourRotation(int r) { - invalidateRenderers(); - if (r < 0) r = 0; if (r > 256) r = 256; int distance = r - m_colourRotation; @@ -856,6 +854,8 @@ m_colourRotation = r; } + invalidateRenderers(); //!!! in theory we shouldn't have to do this... but... + emit layerParametersChanged(); } @@ -1481,6 +1481,7 @@ params.binScale = m_binScale; params.alwaysOpaque = true; params.invertVertical = false; + params.colourRotation = m_colourRotation; Preferences::SpectrogramSmoothing smoothing = Preferences::getInstance()->getSpectrogramSmoothing();