Mercurial > hg > svgui
comparison layer/ColourScale.h @ 1266:a34a2a25907c
Untabify
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2018 18:02:22 +0000 |
parents | 4e7ed3252d80 |
children | d79e21855aef |
comparison
equal
deleted
inserted
replaced
1265:6e724c81f18f | 1266:a34a2a25907c |
---|---|
33 */ | 33 */ |
34 class ColourScale | 34 class ColourScale |
35 { | 35 { |
36 public: | 36 public: |
37 struct Parameters { | 37 struct Parameters { |
38 Parameters() : colourMap(0), scaleType(ColourScaleType::Linear), | 38 Parameters() : colourMap(0), scaleType(ColourScaleType::Linear), |
39 minValue(0.0), maxValue(1.0), | 39 minValue(0.0), maxValue(1.0), |
40 threshold(0.0), gain(1.0), multiple(1.0) { } | 40 threshold(0.0), gain(1.0), multiple(1.0) { } |
41 | 41 |
42 /** A colour map index as used by ColourMapper */ | 42 /** A colour map index as used by ColourMapper */ |
43 int colourMap; | 43 int colourMap; |
44 | 44 |
45 /** Distribution for the scale */ | 45 /** Distribution for the scale */ |
46 ColourScaleType scaleType; | 46 ColourScaleType scaleType; |
47 | 47 |
48 /** Minimum value in source range */ | 48 /** Minimum value in source range */ |
49 double minValue; | 49 double minValue; |
50 | 50 |
51 /** Maximum value in source range. Must be > minValue */ | 51 /** Maximum value in source range. Must be > minValue */ |
52 double maxValue; | 52 double maxValue; |
53 | 53 |
54 /** Threshold below which every value is mapped to background | 54 /** Threshold below which every value is mapped to background |
55 pixel 0 */ | 55 pixel 0 */ |
56 double threshold; | 56 double threshold; |
57 | 57 |
58 /** Gain to apply before thresholding, mapping, and clamping */ | 58 /** Gain to apply before thresholding, mapping, and clamping */ |
59 double gain; | 59 double gain; |
60 | 60 |
61 /** Multiple to apply after thresholding and mapping. In most | 61 /** Multiple to apply after thresholding and mapping. In most |
62 * cases the gain parameter is the one you want instead of | 62 * cases the gain parameter is the one you want instead of |
63 * this, but this can be used for example with Log scale to | 63 * this, but this can be used for example with Log scale to |
64 * produce the log of some power of the original value, | 64 * produce the log of some power of the original value, |
104 /** | 104 /** |
105 * Return the colour corresponding to the given value. This is | 105 * Return the colour corresponding to the given value. This is |
106 * equivalent to getColourForPixel(getPixel(value), rotation). | 106 * equivalent to getColourForPixel(getPixel(value), rotation). |
107 */ | 107 */ |
108 QColor getColour(double value, int rotation) const { | 108 QColor getColour(double value, int rotation) const { |
109 return getColourForPixel(getPixel(value), rotation); | 109 return getColourForPixel(getPixel(value), rotation); |
110 } | 110 } |
111 | 111 |
112 private: | 112 private: |
113 Parameters m_params; | 113 Parameters m_params; |
114 ColourMapper m_mapper; | 114 ColourMapper m_mapper; |