00001 #ifndef SHADEWIDGET_H
00002 #define SHADEWIDGET_H
00003
00004 #include <QPainter>
00005
00006 #include "Hoverpoints.h"
00007 #include "../renderer/Renderer.h"
00008
00012 class ShadeWidget : public QWidget
00013 {
00014 Q_OBJECT
00015 public:
00016
00017 ShadeWidget(QWidget *parent);
00018
00019 void setGradientStops(const QGradientStops &stops);
00020
00022 void set_shade_points(const QVector<TFPnt> &points);
00023
00025 void set_transferfunction(Renderer::TransferFunction& tf);
00026
00028 void set_transferfunction(const QVector<TFPnt> &points);
00029
00030 void paintEvent(QPaintEvent *e);
00031
00032 QSize sizeHint() const { return QSize(180, 390); }
00033 QVector<TFPnt> points() const;
00034
00035 HoverPoints *hoverPoints() const { return m_hoverPoints; }
00036
00037 uint colorAt(int x);
00038
00039 public slots:
00041 void setGradientStops(QVector<TFPnt> points);
00042
00043 private:
00044 void generateShade();
00045
00046 QWidget *m_widget;
00047
00048 Renderer::TransferFunction* m_transferFunction;
00049 QImage m_shade;
00050 HoverPoints *m_hoverPoints;
00051 QLinearGradient m_alpha_gradient;
00052 };
00053
00054 #endif