1 /**
2  * This file is a part of LuminanceHDR package.
3  * ----------------------------------------------------------------------
4  * Copyright (C) 2006,2007 Giuseppe Rota
5  * Copyright (C) 2011 Davide Anastasia
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  * ----------------------------------------------------------------------
21  *
22  * Original Work
23  * @author Giuseppe Rota <grota@users.sourceforge.net>
24  * Improvements, bugfixing
25  * @author Franco Comida <fcomida@users.sourceforge.net>
26  * Improvements, new functionalities
27  * @author Davide Anastasia <davideanastasia@users.sourceforge.net>
28  *
29  */
30 
31 #ifndef IMAGEHDRVIEWER_H
32 #define IMAGEHDRVIEWER_H
33 
34 #include <QComboBox>
35 #include <QImage>
36 #include <QKeyEvent>
37 #include <QLabel>
38 #include <QScopedPointer>
39 #include <iostream>
40 
41 #include "GenericViewer.h"
42 
43 // Forward declaration
44 namespace pfs {
45 class Frame;
46 }
47 
48 class LuminanceRangeWidget;
49 
50 class HdrViewer : public GenericViewer {
51     Q_OBJECT
52 
53    public:
54     HdrViewer(pfs::Frame *frame, QWidget *parent = 0, bool ns = false);
55     virtual ~HdrViewer();
56 
57     LuminanceRangeWidget *lumRange();
58 
59     QString getFileNamePostFix();
60     QString getExifComment();
61 
62     //! \brief virtual function
63     //! \return always return TRUE
64     bool isHDR();
65 
66     //! \brief returns max value of the handled frame
67     float getMaxLuminanceValue();
68 
69     //! \brief returns min value of the handled frame
70     float getMinLuminanceValue();
71 
72     RGBMappingType getLuminanceMappingMethod();
73 
74    public Q_SLOTS:
75     void updateRangeWindow();
76     int getLumMappingMethod();
77     void setLumMappingMethod(int method);
78 
79    protected Q_SLOTS:
80     virtual void updatePixmap();
81 
82    protected:
83     // Methods
84     virtual void retranslateUi();
85     void setRangeWindow(float min, float max);
86     void keyPressEvent(QKeyEvent *event);
87 
88     // UI
89     LuminanceRangeWidget *m_lumRange;
90     QComboBox *m_mappingMethodCB;
91     QLabel *m_mappingMethodLabel;
92     QLabel *m_histLabel;
93 
94    private:
95     void initUi();
96     void refreshPixmap();
97 
98     RGBMappingType m_mappingMethod;
99     float m_minValue;
100     float m_maxValue;
101 
102     QImage *mapFrameToImage(pfs::Frame *in_frame);
103 };
104 
isHDR()105 inline bool HdrViewer::isHDR() { return true; }
106 
107 #endif
108