00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef GUI_EDITING_HISTOGRAMINTERFACE_H
00012 #define GUI_EDITING_HISTOGRAMINTERFACE_H
00013
00014
00015
00016
00017
00018 #include <qwidget.h>
00019
00021 typedef enum
00022 {
00023 LUMINOSITY,
00024 RED,
00025 GREEN,
00026 BLUE,
00027 } DISPLAYED_CHANNEL;
00028
00030 typedef enum
00031 {
00032 DRAG,
00033 NO_EFFECT
00034 } DRAG_MODE;
00035
00036
00039
00040 class HistogramInterface : public QWidget
00041 {
00042 Q_OBJECT
00043
00044 public:
00046 HistogramInterface( QString imageFilename,
00047 QWidget *parent=0,
00048 const char* name=0);
00049
00051 ~HistogramInterface();
00052
00054 void setDisplayChannel( DISPLAYED_CHANNEL channel );
00055
00056 virtual QSize minimumSizeHint() const;
00057
00059 void getHistBoundaries(int &lumLeft, int &lumRight,
00060 int &redLeft, int &redRight,
00061 int &greenLeft, int &greenRight,
00062 int &blueLeft, int &blueRight);
00063
00065 void resetBoundaries();
00066
00067 protected:
00068 void paintEvent( QPaintEvent *e);
00069 void resizeEvent( QResizeEvent * );
00070 void mousePressEvent( QMouseEvent *e);
00071 void mouseReleaseEvent( QMouseEvent *);
00072 void mouseMoveEvent( QMouseEvent *e);
00073
00074 signals:
00075 void selectedRangeChanged();
00076
00077 private slots:
00078
00079 void selectAll();
00080
00081 private:
00083 void getSelectedRange( int &left, int &right );
00084
00086 double displayToIndex(int val);
00087
00089 int indexToDisplay(int val);
00090
00092 bool nearBoundary( QPoint p );
00093
00095 DISPLAYED_CHANNEL displayedChannel;
00096
00098 int redVals[256];
00099 int greenVals[256];
00100 int blueVals[256];
00101 int grayVals[256];
00102
00104 int maxRcount, maxGcount, maxBcount, maxGRAYcount;
00105
00107 int lumClick, lumDrag;
00108 int redClick, redDrag;
00109 int greenClick, greenDrag;
00110 int blueClick, blueDrag;
00111
00113 QSize origImageSize;
00114
00116 DRAG_MODE dragMode;
00117
00120 DRAG_MODE currentMouseShape;
00121
00122 };
00123
00124
00125 #endif //GUI_EDITING_HISTOGRAMINTERFACE_H