00001 00013 #ifndef __TRANSFERFUNCTION___ 00014 #define __TRANSFERFUNCTION___ 00015 #pragma once 00016 00017 #include <QVector> 00018 #include <QPoint> 00019 #include <QWidget> 00020 #include <QPainter> 00021 #include <QMouseEvent> 00022 #include <QImage> 00023 #include <QMenu> 00024 #include <QAction> 00025 #include "Color.h" 00026 00033 class Transferfunction : 00034 public QWidget 00035 { 00036 Q_OBJECT 00037 00038 public: 00039 Transferfunction(QWidget *parent = 0); 00040 00041 Color process(int density); 00042 void init(); 00043 void reset(); 00045 private: 00046 QPoint *points[6]; 00047 QPoint *points_forDrawing[6]; 00048 QPoint *current_pos; 00049 QMenu *pMenu; 00050 QAction *pAction; 00051 bool hitLine1; 00052 bool hitLine2; 00053 bool hitLine3; 00054 bool hitPoint1; 00055 bool hitPoint2; 00056 bool hitPoint3; 00057 bool hitPoint4; 00058 bool changeColor1; 00059 bool changeColor2; 00060 bool changeColor3; 00061 Color leftColor; 00062 Color diffLMColor; 00063 Color middleColor; 00064 Color diffMRColor; 00065 Color rightColor; 00067 private slots: 00068 int changeColor(); 00070 protected: 00071 void paintEvent(QPaintEvent *event); 00072 void mousePressEvent(QMouseEvent* event); 00073 void mouseMoveEvent(QMouseEvent* event); 00074 00075 }; 00076 00077 00078 #endif