annotate layer/ColourMapper.h @ 283:86a112b5b319

* Make it possible to "measure" a feature on the spectrogram by double- clicking in measure mode * Make shift-click-drag (for zoom to region) work in measure mode as well as navigate mode. It would be nice to be able to shift-doubleclick to zoom on a feature directly using a combination of these last two features, but that isn't possible yet. * Make Del delete the measurement under the mouse pointer.
author Chris Cannam
date Thu, 05 Jul 2007 15:36:37 +0000
parents b9380f679f70
children
rev   line source
Chris@196 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@196 2
Chris@196 3 /*
Chris@196 4 Sonic Visualiser
Chris@196 5 An audio file viewer and annotation editor.
Chris@196 6 Centre for Digital Music, Queen Mary, University of London.
Chris@196 7 This file copyright 2006-2007 Chris Cannam and QMUL.
Chris@196 8
Chris@196 9 This program is free software; you can redistribute it and/or
Chris@196 10 modify it under the terms of the GNU General Public License as
Chris@196 11 published by the Free Software Foundation; either version 2 of the
Chris@196 12 License, or (at your option) any later version. See the file
Chris@196 13 COPYING included with this distribution for more information.
Chris@196 14 */
Chris@196 15
Chris@196 16 #ifndef _COLOUR_MAPPER_H_
Chris@196 17 #define _COLOUR_MAPPER_H_
Chris@196 18
Chris@196 19 #include <QObject>
Chris@196 20 #include <QColor>
Chris@196 21 #include <QString>
Chris@196 22
Chris@196 23 /**
Chris@196 24 * A class for mapping intensity values onto various colour maps.
Chris@196 25 */
Chris@196 26
Chris@196 27 class ColourMapper : public QObject
Chris@196 28 {
Chris@222 29 Q_OBJECT
Chris@222 30
Chris@196 31 public:
Chris@196 32 ColourMapper(int map, float minValue, float maxValue);
Chris@196 33 virtual ~ColourMapper();
Chris@196 34
Chris@196 35 enum StandardMap {
Chris@196 36 DefaultColours,
Chris@196 37 Sunset,
Chris@196 38 WhiteOnBlack,
Chris@196 39 BlackOnWhite,
Chris@196 40 RedOnBlue,
Chris@196 41 YellowOnBlack,
Chris@196 42 BlueOnBlack,
Chris@197 43 FruitSalad,
Chris@197 44 Banded,
Chris@274 45 Highlight,
Chris@274 46 Printer
Chris@196 47 };
Chris@196 48
Chris@196 49 int getMap() const { return m_map; }
Chris@196 50 float getMinValue() const { return m_min; }
Chris@196 51 float getMaxValue() const { return m_max; }
Chris@196 52
Chris@196 53 static int getColourMapCount();
Chris@196 54 static QString getColourMapName(int n);
Chris@196 55
Chris@196 56 QColor map(float value) const;
Chris@196 57
Chris@196 58 QColor getContrastingColour() const; // for cursors etc
Chris@196 59
Chris@196 60 protected:
Chris@196 61 int m_map;
Chris@196 62 float m_min;
Chris@196 63 float m_max;
Chris@196 64 };
Chris@196 65
Chris@196 66 #endif
Chris@196 67