1 /*******************************************************************************
2 **
3 ** Photivo
4 **
5 ** Copyright (C) 2008 Jos De Laender <jos.de_laender@telenet.be>
6 ** Copyright (C) 2009,2010 Michael Munzert <mail@mm-log.com>
7 **
8 ** This file is part of Photivo.
9 **
10 ** Photivo is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License version 3
12 ** as published by the Free Software Foundation.
13 **
14 ** Photivo is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ** GNU General Public License for more details.
18 **
19 ** You should have received a copy of the GNU General Public License
20 ** along with Photivo.  If not, see <http://www.gnu.org/licenses/>.
21 **
22 *******************************************************************************/
23 
24 #ifndef PTPROCESSOR_H
25 #define PTPROCESSOR_H
26 
27 //==============================================================================
28 
29 #include "ptConstants.h"
30 
31 #include <exiv2/exif.hpp>
32 
33 #include <QString>
34 #include <QTime>
35 #include <QCoreApplication>
36 
37 #include <vector>
38 
39 //==============================================================================
40 
41 // forward for faster compilation
42 class ptDcRaw;
43 class ptImage;
44 
45 //==============================================================================
46 
47 typedef void (*PReportProgressFunc)(const QString);
48 
49 //==============================================================================
50 
51 class ptProcessor {
52   Q_DECLARE_TR_FUNCTIONS(ptProcessor)
53 
54 public:
55   /*! Creates a new processor instance.
56     \param AReportProgress
57       A function pointer to the progress report function.
58     \param ARunLocalSpots
59       A pointer to the \c RunFiltering() function of the “local adjust” spot model.
60       If you do not set a valid pointer in the constructor you MUST call \c setSpotFuncs()
61       before the first run of the processor instance.
62     \param ARunRepairSpots
63       Same as \c ARunLocalSpots, but for “spot repair”.
64   */
65   ptProcessor(PReportProgressFunc AReportProgress);
66   ~ptProcessor();
67 
68   // The associated DcRaw.
69   ptDcRaw* m_DcRaw;
70 
71   /*! Main Graphical Pipe.
72       Look here for all operations and all possible future extensions.
73       As well Gui mode as JobMode are sharing this part of the code.
74       The idea is to have an image object and operating on it.
75       Run the graphical pipe from a certain point on.
76   */
77   void Run(short Phase,
78            short SubPhase      = -1,
79            short WithIdentify  = 1,
80            short ProcessorMode = ptProcessorMode_Preview);
81 
82   /*! Rerun Local Edit stage. */
83   void RunLocalEdit(ptProcessorStopBefore StopBefore = ptProcessorStopBefore::NoStop);
84 
85   /*! Rerun Geometry stage (and stop for crop or rotate tool)
86    Use the ptProcessorStopBefore_{Rotate|Crop} constants to stop early.*/
87   void RunGeometry(ptProcessorStopBefore StopBefore = ptProcessorStopBefore::NoStop);
88 
89   // Exif Related
90   Exiv2::ExifData      m_ExifData;
91   std::vector<uint8_t> m_ExifBuffer;
92   void                 ReadExifBuffer();
93 
94   // Cached image versions at different points.
95   ptImage*  m_Image_AfterDcRaw;
96   ptImage*  m_Image_AfterLocalEdit;
97   ptImage*  m_Image_AfterGeometry;
98   ptImage*  m_Image_AfterRGB;
99   ptImage*  m_Image_AfterLabCC;
100   ptImage*  m_Image_AfterLabSN;
101   ptImage*  m_Image_AfterLabEyeCandy;
102   ptImage*  m_Image_AfterEyeCandy;
103 
104   // Cached image for detail preview
105   ptImage*  m_Image_DetailPreview;
106 
107   // Sidecar image for texture overlay
108   ptImage*  m_Image_TextureOverlay;
109   ptImage*  m_Image_TextureOverlay2;
110 
111   // Reporting back
112   //void (*m_ReportProgress)(const QString Message);
113   PReportProgressFunc m_ReportProgress;
114 
115   // Reporting
116   void ReportProgress(const QString Message);
117 
118   // Factor for size dependend filters
119   float  m_ScaleFactor;
120 
121 //==============================================================================
122 
123 private:
124   QTime FRunTimer;
125 };
126 #endif
127