# HG changeset patch # User Chris Cannam # Date 1468919550 -3600 # Node ID d578b685d9126cbb34e0b52dbc0997b4b5ecf810 # Parent 953ce409ccfbfc4ef95617d6a68465d463d8a449 Colourmap rotation (inelegantly) diff -r 953ce409ccfb -r d578b685d912 layer/Colour3DPlotRenderer.cpp --- 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); diff -r 953ce409ccfb -r d578b685d912 layer/Colour3DPlotRenderer.h --- 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) : diff -r 953ce409ccfb -r d578b685d912 layer/SpectrogramLayer.cpp --- 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();