annotate layer/ColourMapper.h @ 220:8dc50f57d480

* Make the vertical scale a bit less thtoopid for many linear scale spectra * Don't forget to reload slice layer properties when loading a session, as well as spectrum layer (i.e. subclass) properties
author Chris Cannam
date Mon, 05 Mar 2007 13:04:52 +0000
parents 6b023411087b
children cd81066ac7ad
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@196 29 public:
Chris@196 30 ColourMapper(int map, float minValue, float maxValue);
Chris@196 31 virtual ~ColourMapper();
Chris@196 32
Chris@196 33 enum StandardMap {
Chris@196 34 DefaultColours,
Chris@196 35 Sunset,
Chris@196 36 WhiteOnBlack,
Chris@196 37 BlackOnWhite,
Chris@196 38 RedOnBlue,
Chris@196 39 YellowOnBlack,
Chris@196 40 BlueOnBlack,
Chris@197 41 FruitSalad,
Chris@197 42 Banded,
Chris@197 43 Highlight
Chris@196 44 };
Chris@196 45
Chris@196 46 int getMap() const { return m_map; }
Chris@196 47 float getMinValue() const { return m_min; }
Chris@196 48 float getMaxValue() const { return m_max; }
Chris@196 49
Chris@196 50 static int getColourMapCount();
Chris@196 51 static QString getColourMapName(int n);
Chris@196 52
Chris@196 53 QColor map(float value) const;
Chris@196 54
Chris@196 55 QColor getContrastingColour() const; // for cursors etc
Chris@196 56
Chris@196 57 protected:
Chris@196 58 int m_map;
Chris@196 59 float m_min;
Chris@196 60 float m_max;
Chris@196 61 };
Chris@196 62
Chris@196 63 #endif
Chris@196 64