Add facility to read frames in RGB & RGBA format
[imageviewer.git] / view.h
blobf868b0a4adde9aa88522a678a67a0bcc2bec1e9e
1 /* ***** BEGIN LICENSE BLOCK *****
3 * $Id$
5 * The MIT License
7 * Copyright (c) 2008 BBC Research
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 * THE SOFTWARE.
27 * ***** END LICENSE BLOCK ***** */
29 #ifndef VIEW_H
30 #define VIEW_H
32 #include "rawFrame.h"
33 #include "colourSpace.h"
34 #include "sequenceReader.h"
36 #include <QGraphicsView>
38 class QGraphicsScene;
40 class View : public QGraphicsView
42 Q_OBJECT
43 public:
44 View(QWidget *parent = 0);
46 enum ProcessType {processResample=0, processColour, processDisplay, processScene};
49 enum YUVdisplayMode {
50 YUVdisplayColour,
51 YUVdisplayYOnly,
52 YUVdisplayPlanar
55 float getZoom(void);
56 int getRotation(void);
58 signals:
59 void pixelInfoMessage(const QString &, int);
60 void zoomChanged(float);
62 public slots:
63 void setZoom(float);
64 void setYUVRGBScaling(bool scaled);
65 void setYUVColourMatrix(ColourSpace::MatrixType);
66 void setYUVdisplayMode(YUVdisplayMode);
67 void setYUVbitDepth(int); //the bit depth from the gui menu
68 void setYUVnativeBitDepth(int); //the bit depth of the original file, or 0 if unknown
70 private slots:
71 void setupMatrix();
72 void showFrame(const RawFrame*);
74 private:
75 void invalidateFrame();
76 void processImage(const ProcessType type);
78 //deal with mouse interaction
79 void wheelEvent(QWheelEvent* wheelEvent);
80 void mouseDoubleClickEvent(QMouseEvent * e);
82 float zoom;
83 int rotation;
85 //QGraphicsView *graphicsView;
86 QGraphicsScene *scene;
88 //information for displaying a YUV image from a headerless file
89 int yuvImageBitDepth;
90 int yuvImageNativeBitDepth;
91 bool yuvImageRGBScaling;
92 ColourSpace::MatrixType yuvImageColourMatrix;
93 RawFrame::Chroma inChroma;
94 SequenceReader::RawType yuvFormat;
96 //stores for loading, resampling and colour converting the input
97 RawFrame *inFrame;
98 RawFrame *frame444;
99 RawFrame *frameRGB;
101 //settings that change the appearance of the image
102 YUVdisplayMode yuvDisplayMode;
105 #endif