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 <qcolor.h>
15 
16 class QwtInterval;
17 template <typename T> class QVector;
18 
35 {
36 public:
42  enum Format
43  {
45  RGB,
46 
57  Indexed
58  };
59 
60  explicit QwtColorMap( Format = QwtColorMap::RGB );
61  virtual ~QwtColorMap();
62 
63  void setFormat( Format );
64  Format format() const;
65 
73  virtual QRgb rgb( const QwtInterval &interval,
74  double value ) const = 0;
75 
76  virtual uint colorIndex( int numColors,
77  const QwtInterval &interval, double value ) const;
78 
79  QColor color( const QwtInterval &, double value ) const;
80  virtual QVector<QRgb> colorTable( int numColors ) const;
81  virtual QVector<QRgb> colorTable256() const;
82 
83 private:
84  Q_DISABLE_COPY(QwtColorMap)
85 
86  Format d_format;
87 };
88 
97 {
98 public:
103  enum Mode
104  {
107 
109  ScaledColors
110  };
111 
113  QwtLinearColorMap( const QColor &from, const QColor &to,
115 
116  virtual ~QwtLinearColorMap();
117 
118  void setMode( Mode );
119  Mode mode() const;
120 
121  void setColorInterval( const QColor &color1, const QColor &color2 );
122  void addColorStop( double value, const QColor& );
123  QVector<double> colorStops() const;
124 
125  QColor color1() const;
126  QColor color2() const;
127 
128  virtual QRgb rgb( const QwtInterval &,
129  double value ) const QWT_OVERRIDE;
130 
131  virtual uint colorIndex( int numColors,
132  const QwtInterval &, double value ) const QWT_OVERRIDE;
133 
134  class ColorStops;
135 
136 private:
137  class PrivateData;
139 };
140 
145 {
146 public:
147  explicit QwtAlphaColorMap( const QColor & = QColor( Qt::gray ) );
148  virtual ~QwtAlphaColorMap();
149 
150  void setAlphaInterval( int alpha1, int alpha2 );
151 
152  int alpha1() const;
153  int alpha2() const;
154 
155  void setColor( const QColor & );
156  QColor color() const;
157 
158  virtual QRgb rgb( const QwtInterval &,
159  double value ) const QWT_OVERRIDE;
160 
161 private:
162  class PrivateData;
164 };
165 
178 {
179 public:
181  virtual ~QwtHueColorMap();
182 
183  void setHueInterval( int hue1, int hue2 ); // direction ?
184  void setSaturation( int saturation );
185  void setValue( int value );
186  void setAlpha( int alpha );
187 
188  int hue1() const;
189  int hue2() const;
190  int saturation() const;
191  int value() const;
192  int alpha() const;
193 
194  virtual QRgb rgb( const QwtInterval &,
195  double value ) const QWT_OVERRIDE;
196 
197 private:
198  class PrivateData;
200 };
201 
212 {
213 public:
215  virtual ~QwtSaturationValueColorMap();
216 
217  void setHue( int hue );
218  void setSaturationInterval( int sat1, int sat2 );
219  void setValueInterval( int value1, int value2 );
220  void setAlpha( int alpha );
221 
222  int hue() const;
223  int saturation1() const;
224  int saturation2() const;
225  int value1() const;
226  int value2() const;
227  int alpha() const;
228 
229  virtual QRgb rgb( const QwtInterval &,
230  double value ) const QWT_OVERRIDE;
231 
232 private:
233  class PrivateData;
235 };
236 
245 inline QColor QwtColorMap::color(
246  const QwtInterval &interval, double value ) const
247 {
248  return QColor::fromRgba( rgb( interval, value ) );
249 }
250 
256 {
257  return d_format;
258 }
259 
260 #endif
enum MQTTPropertyCodes value
FMT_INLINE std::basic_string< Char > format(const S &format_str, Args &&...args)
Definition: core.h:2081
A class representing an interval.
Definition: qwt_interval.h:22
#define QWT_EXPORT
Definition: qwt_global.h:38
Return the color from the next lower color stop.
PrivateData * d_data
PrivateData * d_data
QwtAlphaColorMap varies the alpha value of a color.
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:34
QColor color(const QwtInterval &, double value) const
Format d_format
Definition: qwt_color_map.h:86
QwtLinearColorMap builds a color map from color stops.
Definition: qwt_color_map.h:96
The map is intended to map into RGB values.
Definition: qwt_color_map.h:45
QwtSaturationValueColorMap varies the saturation and/or value for a given hue in the HSV color model...
QwtHueColorMap varies the hue value of the HSV color model.
virtual QRgb rgb(const QwtInterval &interval, double value) const =0
PrivateData * d_data
Format format() const
#define QWT_OVERRIDE
Definition: qwt_global.h:53


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10