diff layer/SpectrumLayer.cpp @ 1362:d79e21855aef

Add mechanism for saving/loading colour maps by name/id rather than by numerical index, for future compatibility when adding to or changing the supported colour maps. Add two new colour maps (and one old one). Write out backward-compatible numerical indices for use when reloading in older versions. Also add a mechanism to invert the colour map, though I don't think it turns out useful enough to include in the UI.
author Chris Cannam
date Thu, 18 Oct 2018 13:21:56 +0100
parents fc9d9f1103fa
children 2df1af7ac752
line wrap: on
line diff
--- a/layer/SpectrumLayer.cpp	Fri Oct 12 11:17:29 2018 +0100
+++ b/layer/SpectrumLayer.cpp	Thu Oct 18 13:21:56 2018 +0100
@@ -418,7 +418,7 @@
         paint.setFont(fn);
     }
 
-    ColourMapper mapper(m_colourMap, 0, 1);
+    ColourMapper mapper(m_colourMap, m_colourInverted, 0, 1);
     paint.setPen(mapper.getContrastingColour());
 
     int xorigin = m_xorigins[v->getId()];
@@ -618,8 +618,8 @@
 
         ColourMapper mapper =
             hasLightBackground() ?
-            ColourMapper(ColourMapper::BlackOnWhite, 0, 1) :
-            ColourMapper(ColourMapper::WhiteOnBlack, 0, 1);
+            ColourMapper(ColourMapper::BlackOnWhite, m_colourInverted, 0, 1) :
+            ColourMapper(ColourMapper::WhiteOnBlack, m_colourInverted, 0, 1);
         
         int peakminbin = 0;
         int peakmaxbin = fft->getHeight() - 1;