Kinetic Visualization (Visualisierung 2 - S2012)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TransferFunctionWidget.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <QtGui/QWidget.h>
4 
5 class HoverPoints;
6 
8 
11 class TransferFunctionWidget : public QWidget
12 {
13  Q_OBJECT
14 public:
15  TransferFunctionWidget(QWidget *parent);
17 
19  void setGradientStops(const QGradientStops &stops);
21  void setHistogram(const std::vector<float> &hist);
22 
23  QSize sizeHint() const { return QSize(150, 80); }
25  QPolygonF points() const;
26 
27  HoverPoints *hoverPoints() const { return _hoverPoints; }
28 
29  void paintEvent(QPaintEvent *);
30 
32  uint colorAt(int x);
34  void resetPoints();
35 
36  virtual void resizeEvent(QResizeEvent *ev);
37 signals:
38  void colorsChanged();
39 private:
41  void generateHistogramImage();
43  void generateShade();
45  void scaleHistogram();
47  std::vector<float> _histogram;
49  QImage _histImage;
51  QImage _shade;
55  QLinearGradient _alphaGradient;
56 };
57