Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 287:cd2492c5fe45
* Add SingleColourLayer to manage colours for layers that have a single
predominant colour (i.e. most of them).
author | Chris Cannam |
---|---|
date | Thu, 12 Jul 2007 16:14:59 +0000 |
parents | 9dd432665059 |
children | c0b9eec70639 |
comparison
equal
deleted
inserted
replaced
286:7554ae119882 | 287:cd2492c5fe45 |
---|---|
1019 } | 1019 } |
1020 | 1020 |
1021 bool | 1021 bool |
1022 SpectrogramLayer::hasLightBackground() const | 1022 SpectrogramLayer::hasLightBackground() const |
1023 { | 1023 { |
1024 return (m_colourMap == (int)ColourMapper::BlackOnWhite); | 1024 return ColourMapper(m_colourMap, 1.f, 255.f).hasLightBackground(); |
1025 } | 1025 } |
1026 | 1026 |
1027 void | 1027 void |
1028 SpectrogramLayer::initialisePalette() | 1028 SpectrogramLayer::initialisePalette() |
1029 { | 1029 { |
2332 int y0 = int(getYForFrequency(v, f0)); | 2332 int y0 = int(getYForFrequency(v, f0)); |
2333 | 2333 |
2334 // std::cerr << "SpectrogramLayer: illuminate " | 2334 // std::cerr << "SpectrogramLayer: illuminate " |
2335 // << x0 << "," << y1 << " -> " << x1 << "," << y0 << std::endl; | 2335 // << x0 << "," << y1 << " -> " << x1 << "," << y0 << std::endl; |
2336 | 2336 |
2337 paint.setPen(Qt::white); | 2337 paint.setPen(v->getForeground()); |
2338 | 2338 |
2339 //!!! should we be using paintCrosshairs for this? | 2339 //!!! should we be using paintCrosshairs for this? |
2340 | 2340 |
2341 paint.drawRect(x0, y1, x1 - x0 + 1, y0 - y1 + 1); | 2341 paint.drawRect(x0, y1, x1 - x0 + 1, y0 - y1 + 1); |
2342 } | 2342 } |
2834 idb != lastdb && | 2834 idb != lastdb && |
2835 ((abs(y - lasty) > textHeight && | 2835 ((abs(y - lasty) > textHeight && |
2836 idb % 10 == 0) || | 2836 idb % 10 == 0) || |
2837 (abs(y - lasty) > paint.fontMetrics().ascent() && | 2837 (abs(y - lasty) > paint.fontMetrics().ascent() && |
2838 idb % 5 == 0))) { | 2838 idb % 5 == 0))) { |
2839 paint.setPen(Qt::black); | 2839 paint.setPen(v->getBackground()); |
2840 QString text = QString("%1").arg(idb); | 2840 QString text = QString("%1").arg(idb); |
2841 paint.drawText(3 + cw - cbw - paint.fontMetrics().width(text), | 2841 paint.drawText(3 + cw - cbw - paint.fontMetrics().width(text), |
2842 y + toff + textHeight/2, text); | 2842 y + toff + textHeight/2, text); |
2843 paint.setPen(Qt::white); | 2843 paint.setPen(v->getForeground()); |
2844 paint.drawLine(5 + cw - cbw, y, 8 + cw - cbw, y); | 2844 paint.drawLine(5 + cw - cbw, y, 8 + cw - cbw, y); |
2845 lasty = y; | 2845 lasty = y; |
2846 lastdb = idb; | 2846 lastdb = idb; |
2847 } | 2847 } |
2848 } | 2848 } |