Formatted all .cc and .h code in rtengine, rtexif and rtgui using astyle
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* RawTherapee is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@@ -17,63 +17,71 @@
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "rtengine.h"
|
||||
#include <iostream>
|
||||
#include <iostream>
|
||||
//#include <giomm.h>
|
||||
#include <helpers.h>
|
||||
|
||||
class PListener : public rtengine::ProgressListener {
|
||||
|
||||
public:
|
||||
void setProgressStr (Glib::ustring str) {
|
||||
std::cout << str << std::endl;
|
||||
}
|
||||
void setProgress (double p) {
|
||||
std::cout << p << std::endl;
|
||||
}
|
||||
class PListener : public rtengine::ProgressListener
|
||||
{
|
||||
|
||||
public:
|
||||
void setProgressStr (Glib::ustring str)
|
||||
{
|
||||
std::cout << str << std::endl;
|
||||
}
|
||||
void setProgress (double p)
|
||||
{
|
||||
std::cout << p << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
class MyPrevImgListener : public rtengine::PreviewImageListener {
|
||||
|
||||
class MyPrevImgListener : public rtengine::PreviewImageListener
|
||||
{
|
||||
|
||||
IImage8* i;
|
||||
|
||||
public:
|
||||
// this method is called when the staged image processor creates a new image to store the resulting preview image (this does not happen too often)
|
||||
// usually you just have to store it
|
||||
void setImage (IImage8* img, double scale, procparams::CropParams cp) {
|
||||
i = img;
|
||||
public:
|
||||
// this method is called when the staged image processor creates a new image to store the resulting preview image (this does not happen too often)
|
||||
// usually you just have to store it
|
||||
void setImage (IImage8* img, double scale, procparams::CropParams cp)
|
||||
{
|
||||
i = img;
|
||||
}
|
||||
// if the staged image processor wants to delete the image that stores the preview image, it calls this method. You have to destroy the image.
|
||||
void delImage (IImage8* img)
|
||||
{
|
||||
if (img) {
|
||||
// make sure we dont use this image in an other thread
|
||||
IImage8* temp = i;
|
||||
i->getMutex().lock ();
|
||||
i = NULL;
|
||||
temp->getMutex().unlock ();
|
||||
// free it
|
||||
img->free ();
|
||||
}
|
||||
// if the staged image processor wants to delete the image that stores the preview image, it calls this method. You have to destroy the image.
|
||||
void delImage (IImage8* img) {
|
||||
if (img) {
|
||||
// make sure we dont use this image in an other thread
|
||||
IImage8* temp = i;
|
||||
i->getMutex().lock ();
|
||||
i = NULL;
|
||||
temp->getMutex().unlock ();
|
||||
// free it
|
||||
img->free ();
|
||||
}
|
||||
}
|
||||
// if the preview image changes, this method is called
|
||||
void imageReady (procparams::CropParams cp) {
|
||||
// initiate a redraw in the background and return as fast as possible
|
||||
}
|
||||
// a possible redraw function:
|
||||
//void redraw () {
|
||||
// if (i) {
|
||||
// i->lock ();
|
||||
// int w = i->getWidth ();
|
||||
// int h = i->getHeigt ();
|
||||
// const char* data = i->getData ();
|
||||
// ... draw it ...
|
||||
// i->unlock ();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// if the preview image changes, this method is called
|
||||
void imageReady (procparams::CropParams cp)
|
||||
{
|
||||
// initiate a redraw in the background and return as fast as possible
|
||||
}
|
||||
// a possible redraw function:
|
||||
//void redraw () {
|
||||
// if (i) {
|
||||
// i->lock ();
|
||||
// int w = i->getWidth ();
|
||||
// int h = i->getHeigt ();
|
||||
// const char* data = i->getData ();
|
||||
// ... draw it ...
|
||||
// i->unlock ();
|
||||
// }
|
||||
// }
|
||||
};
|
||||
|
||||
int main (int argc, char* argv[]) {
|
||||
int main (int argc, char* argv[])
|
||||
{
|
||||
|
||||
if (argc<4) {
|
||||
if (argc < 4) {
|
||||
std::cout << "Usage: rtcmd <infile> <paramfile> <outfile>" << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
@@ -90,7 +98,7 @@ int main (int argc, char* argv[]) {
|
||||
// init rtengine
|
||||
rtengine::init (s);
|
||||
// the settings can be modified later through the "s" pointer without calling any api function
|
||||
|
||||
|
||||
// Create a listener object. Any class is appropriate that inherits from rtengine::ProgressListener
|
||||
PListener pl;
|
||||
|
||||
@@ -98,14 +106,17 @@ int main (int argc, char* argv[]) {
|
||||
rtengine::InitialImage* ii;
|
||||
int errorCode;
|
||||
ii = rtengine::InitialImage::load (argv[1], true, errorCode, &pl);
|
||||
if (!ii)
|
||||
|
||||
if (!ii) {
|
||||
ii = rtengine::InitialImage::load (argv[1], false, errorCode, &pl);
|
||||
}
|
||||
|
||||
if (!ii) {
|
||||
std::cout << "Input file not supported." << std::endl;
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* Second scenario. Create a stagedimageprocessor with a preview scale of 1:5 and change few things */
|
||||
/* Second scenario. Create a stagedimageprocessor with a preview scale of 1:5 and change few things */
|
||||
MyPrevImgListener myPrevImgListener;
|
||||
|
||||
StagedImageProcessor* ipc = StagedImageProcessor::create (ii);
|
||||
@@ -123,16 +134,16 @@ int main (int argc, char* argv[]) {
|
||||
// you have to tell it what has changed. At the first time tell it EvPhotoLoaded so a full processing will be performed
|
||||
rtengine::procparams::ProcParams* params = ipc->beginUpdateParams ();
|
||||
// change this and that...
|
||||
params->toneCurve.brightness = 1.0;
|
||||
params->toneCurve.brightness = 1.0;
|
||||
// you can load it, too, from a file: params->load (argv[2]);
|
||||
// finally you have to call this non-blocking method, and the image processing starts in the background. When finished, the preview image listener will be notified
|
||||
ipc->endUpdateParams (rtengine::EvPhotoLoaded);
|
||||
// you can go on with changing of the settings, following the gui actions
|
||||
// now we know that only the brightness has changed compared to the previous settings, to only a part of the processing has to be repeated
|
||||
params = ipc->beginUpdateParams ();
|
||||
params->toneCurve.brightness = 1.2;
|
||||
params->toneCurve.brightness = 1.2;
|
||||
ipc->endUpdateParams (rtengine::EvBrightness);
|
||||
|
||||
|
||||
// ... and so on. If you dont need it any more, you can destroy it (make sure that no processing is happening when you destroy it!)
|
||||
StagedImageProcessor::destroy (ipc);
|
||||
}
|
||||
|
Reference in New Issue
Block a user