annotate layer/ColourMapper.h @ 282:d9319859a4cf tip

(none)
author benoitrigolleau
date Fri, 31 Oct 2008 11:00:24 +0000
parents fc9323a41f5a
children
rev   line source
lbajardsilogic@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
lbajardsilogic@0 2
lbajardsilogic@0 3 /*
lbajardsilogic@0 4 Sonic Visualiser
lbajardsilogic@0 5 An audio file viewer and annotation editor.
lbajardsilogic@0 6 Centre for Digital Music, Queen Mary, University of London.
lbajardsilogic@0 7 This file copyright 2006-2007 Chris Cannam and QMUL.
lbajardsilogic@0 8
lbajardsilogic@0 9 This program is free software; you can redistribute it and/or
lbajardsilogic@0 10 modify it under the terms of the GNU General Public License as
lbajardsilogic@0 11 published by the Free Software Foundation; either version 2 of the
lbajardsilogic@0 12 License, or (at your option) any later version. See the file
lbajardsilogic@0 13 COPYING included with this distribution for more information.
lbajardsilogic@0 14 */
lbajardsilogic@0 15
lbajardsilogic@0 16 #ifndef _COLOUR_MAPPER_H_
lbajardsilogic@0 17 #define _COLOUR_MAPPER_H_
lbajardsilogic@0 18
lbajardsilogic@0 19 #include <QObject>
lbajardsilogic@0 20 #include <QColor>
lbajardsilogic@0 21 #include <QString>
lbajardsilogic@0 22
lbajardsilogic@0 23 /**
lbajardsilogic@0 24 * A class for mapping intensity values onto various colour maps.
lbajardsilogic@0 25 */
lbajardsilogic@0 26
lbajardsilogic@0 27 class ColourMapper : public QObject
lbajardsilogic@0 28 {
lbajardsilogic@0 29 Q_OBJECT
lbajardsilogic@0 30
lbajardsilogic@0 31 public:
lbajardsilogic@0 32 ColourMapper(int map, float minValue, float maxValue);
lbajardsilogic@0 33 virtual ~ColourMapper();
lbajardsilogic@0 34
lbajardsilogic@0 35 enum StandardMap {
lbajardsilogic@0 36 DefaultColours,
lbajardsilogic@0 37 Sunset,
lbajardsilogic@0 38 WhiteOnBlack,
lbajardsilogic@0 39 BlackOnWhite,
lbajardsilogic@0 40 RedOnBlue,
lbajardsilogic@0 41 YellowOnBlack,
lbajardsilogic@0 42 BlueOnBlack,
lbajardsilogic@0 43 FruitSalad,
lbajardsilogic@0 44 Banded,
lbajardsilogic@0 45 Highlight
lbajardsilogic@0 46 };
lbajardsilogic@0 47
lbajardsilogic@0 48 int getMap() const { return m_map; }
lbajardsilogic@0 49 float getMinValue() const { return m_min; }
lbajardsilogic@0 50 float getMaxValue() const { return m_max; }
lbajardsilogic@0 51
lbajardsilogic@0 52 static int getColourMapCount();
lbajardsilogic@0 53 static QString getColourMapName(int n);
lbajardsilogic@0 54
lbajardsilogic@0 55 QColor map(float value) const;
lbajardsilogic@0 56
lbajardsilogic@0 57 QColor getContrastingColour() const; // for cursors etc
lbajardsilogic@0 58
lbajardsilogic@0 59 protected:
lbajardsilogic@0 60 int m_map;
lbajardsilogic@0 61 float m_min;
lbajardsilogic@0 62 float m_max;
lbajardsilogic@0 63 };
lbajardsilogic@0 64
lbajardsilogic@0 65 #endif
lbajardsilogic@0 66