qwt_color_map.h
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997 Josef Wilgen
4  * Copyright (C) 2002 Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_COLOR_MAP_H
11 #define QWT_COLOR_MAP_H
12 
13 #include "qwt_global.h"
14 #include "qwt_interval.h"
15 #include <qcolor.h>
16 #include <qvector.h>
17 
34 {
35 public:
41  enum Format
42  {
44  RGB,
45 
56  Indexed
57  };
58 
59  explicit QwtColorMap( Format = QwtColorMap::RGB );
60  virtual ~QwtColorMap();
61 
62  void setFormat( Format );
63  Format format() const;
64 
72  virtual QRgb rgb( const QwtInterval &interval,
73  double value ) const = 0;
74 
75  virtual uint colorIndex( int numColors,
76  const QwtInterval &interval, double value ) const;
77 
78  QColor color( const QwtInterval &, double value ) const;
79  virtual QVector<QRgb> colorTable( int numColors ) const;
80  virtual QVector<QRgb> colorTable256() const;
81 
82 private:
83  Q_DISABLE_COPY(QwtColorMap)
84 
85  Format d_format;
86 };
87 
96 {
97 public:
102  enum Mode
103  {
106 
108  ScaledColors
109  };
110 
112  QwtLinearColorMap( const QColor &from, const QColor &to,
114 
115  virtual ~QwtLinearColorMap();
116 
117  void setMode( Mode );
118  Mode mode() const;
119 
120  void setColorInterval( const QColor &color1, const QColor &color2 );
121  void addColorStop( double value, const QColor& );
122  QVector<double> colorStops() const;
123 
124  QColor color1() const;
125  QColor color2() const;
126 
127  virtual QRgb rgb( const QwtInterval &, double value ) const;
128  virtual uint colorIndex( int numColors,
129  const QwtInterval &, double value ) const;
130 
131  class ColorStops;
132 
133 private:
134  class PrivateData;
136 };
137 
142 {
143 public:
144  explicit QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) );
145  virtual ~QwtAlphaColorMap();
146 
147  void setAlphaInterval( int alpha1, int alpha2 );
148 
149  int alpha1() const;
150  int alpha2() const;
151 
152  void setColor( const QColor & );
153  QColor color() const;
154 
155  virtual QRgb rgb( const QwtInterval &, double value ) const;
156 
157 private:
158  class PrivateData;
160 };
161 
174 {
175 public:
177  virtual ~QwtHueColorMap();
178 
179  void setHueInterval( int hue1, int hue2 ); // direction ?
180  void setSaturation( int saturation );
181  void setValue( int value );
182  void setAlpha( int alpha );
183 
184  int hue1() const;
185  int hue2() const;
186  int saturation() const;
187  int value() const;
188  int alpha() const;
189 
190  virtual QRgb rgb( const QwtInterval &, double value ) const;
191 
192 private:
193  class PrivateData;
195 };
196 
207 {
208 public:
210  virtual ~QwtSaturationValueColorMap();
211 
212  void setHue( int hue );
213  void setSaturationInterval( int sat1, int sat2 );
214  void setValueInterval( int value1, int value2 );
215  void setAlpha( int alpha );
216 
217  int hue() const;
218  int saturation1() const;
219  int saturation2() const;
220  int value1() const;
221  int value2() const;
222  int alpha() const;
223 
224  virtual QRgb rgb( const QwtInterval &, double value ) const;
225 
226 private:
227  class PrivateData;
229 };
230 
239 inline QColor QwtColorMap::color(
240  const QwtInterval &interval, double value ) const
241 {
242  return QColor::fromRgba( rgb( interval, value ) );
243 }
244 
250 {
251  return d_format;
252 }
253 
254 #endif
A class representing an interval.
Definition: qwt_interval.h:26
#define QWT_EXPORT
Definition: qwt_global.h:38
TFSIMD_FORCE_INLINE void setValue(const tfScalar &x, const tfScalar &y, const tfScalar &z)
Return the color from the next lower color stop.
PrivateData * d_data
PrivateData * d_data
QwtAlphaColorMap varies the alpha value of a color.
T value
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:33
std::string format(const std::string &, const time_point< seconds > &, const femtoseconds &, const time_zone &)
QColor color(const QwtInterval &, double value) const
Format d_format
Definition: qwt_color_map.h:85
QwtLinearColorMap builds a color map from color stops.
Definition: qwt_color_map.h:95
The map is intended to map into RGB values.
Definition: qwt_color_map.h:44
QwtSaturationValueColorMap varies the saturation and/or value for a given hue in the HSV color model...
T value1
QwtHueColorMap varies the hue value of the HSV color model.
U value2
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
PrivateData * d_data
Format format() const


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17