AlbumShaper  1.0a3
histogramInterface.h
Go to the documentation of this file.
1 //==============================================
2 // copyright : (C) 2003-2005 by Will Stokes
3 //==============================================
4 // This program is free software; you can redistribute it
5 // and/or modify it under the terms of the GNU General
6 // Public License as published by the Free Software
7 // Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //==============================================
10 
11 #ifndef GUI_EDITING_HISTOGRAMINTERFACE_H
12 #define GUI_EDITING_HISTOGRAMINTERFACE_H
13 
14 //--------------------
15 //forward declarations
16 //--------------------
17 
18 #include <qwidget.h>
19 //Added by qt3to4:
20 #include <QResizeEvent>
21 #include <QMouseEvent>
22 #include <QPaintEvent>
23 
25 typedef enum
26 {
28  RED,
32 
34 typedef enum
35 {
38 } DRAG_MODE;
39 
40 //=====================================
43 //=====================================
45 {
46 Q_OBJECT
47 
48 public:
50  HistogramInterface( QString imageFilename,
51  QWidget *parent=0,
52  const char* name=0);
53 
56 
58  void setDisplayChannel( DISPLAYED_CHANNEL channel );
59 
60  virtual QSize minimumSizeHint() const;
61 
63  void getHistBoundaries(int &lumLeft, int &lumRight,
64  int &redLeft, int &redRight,
65  int &greenLeft, int &greenRight,
66  int &blueLeft, int &blueRight);
67 
69  void resetBoundaries();
70  //----------------------
71 protected:
72  void paintEvent( QPaintEvent *e);
73  void resizeEvent( QResizeEvent * );
74  void mousePressEvent( QMouseEvent *e);
75  void mouseReleaseEvent( QMouseEvent *);
76  void mouseMoveEvent( QMouseEvent *e);
77  //----------------------
78 signals:
79  void selectedRangeChanged();
80  //----------------------
81 private slots:
82  //selects entire range of current channel
83  void selectAll();
84  //----------------------
85 private:
87  void getSelectedRange( int &left, int &right );
88 
90  double displayToIndex(int val);
91 
93  int indexToDisplay(int val);
94 
96  bool nearBoundary( QPoint p );
97 
100 
102  int redVals[256];
103  int greenVals[256];
104  int blueVals[256];
105  int grayVals[256];
106 
109 
115 
118 
121 
125 //----------------------
126 };
127 //======================
128 
129 #endif //GUI_EDITING_HISTOGRAMINTERFACE_H
int redVals[256]
color and luminosity histograms
void resizeEvent(QResizeEvent *)
void paintEvent(QPaintEvent *e)
HistogramInterface(QString imageFilename, QWidget *parent=0, const char *name=0)
Creates layout.
int maxRcount
max r,g,b, and gray counts
~HistogramInterface()
Deletes objects.
DRAG_MODE
current drag mode, effect of mouse movement on selected range
void setDisplayChannel(DISPLAYED_CHANNEL channel)
Sets currently displayed channel.
QSize origImageSize
original image dimensions, needed for painting
double displayToIndex(int val)
convert screen coordinate to index in 0-255 range
DISPLAYED_CHANNEL
chanel histogram displays
void selectedRangeChanged()
void mousePressEvent(QMouseEvent *e)
int indexToDisplay(int val)
converts index in 0-255 ranges to screen coordinate
virtual QSize minimumSizeHint() const
int lumClick
left and right bounds for each channel
void getSelectedRange(int &left, int &right)
this utility function finds currently selected range
void mouseReleaseEvent(QMouseEvent *)
DRAG_MODE dragMode
effect of mouse drags
bool nearBoundary(QPoint p)
determines if mouse is near boundary
DISPLAYED_CHANNEL displayedChannel
Currently displayed channel.
void getHistBoundaries(int &lumLeft, int &lumRight, int &redLeft, int &redRight, int &greenLeft, int &greenRight, int &blueLeft, int &blueRight)
returns histogram boundaries
void resetBoundaries()
resets all boundaries
void mouseMoveEvent(QMouseEvent *e)
DRAG_MODE currentMouseShape
current mouse shape.