Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtengine / imageio.h
blob8880fcf6493ef326d1f42b0a37f3e0b09af23463
1 /*
2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _IMAGEIO_
20 #define _IMAGEIO_
22 #define IMIO_SUCCESS 0
23 #define IMIO_CANNOTREADFILE 1
24 #define IMIO_INVALIDHEADER 2
25 #define IMIO_HEADERERROR 3
26 #define IMIO_READERROR 4
27 #define IMIO_VARIANTNOTSUPPORTED 5
29 #include <rtengine.h>
30 #include <glibmm.h>
31 #include <procparams.h>
32 #include <libiptcdata/iptc-data.h>
33 #include <rtexif.h>
35 namespace rtengine {
37 class ImageIO {
39 protected:
40 ProgressListener* pl;
41 cmsHPROFILE embProfile;
42 char* profileData;
43 int profileLength;
44 char* loadedProfileData;
45 int loadedProfileLength;
46 std::vector<std::pair<std::string,std::string> > exifChange;
47 IptcData* iptc;
48 const rtexif::TagDirectory* exifRoot;
49 Glib::Mutex imutex;
51 public:
52 static Glib::ustring errorMsg[6];
54 ImageIO () : pl (NULL), embProfile(NULL), profileData(NULL), exifRoot (NULL), iptc(NULL), loadedProfileData(NULL), loadedProfileLength(0) {}
56 virtual ~ImageIO ();
58 void setProgressListener (ProgressListener* l) { pl = l; }
60 virtual int getW () {}
61 virtual int getH () {}
62 virtual void allocate (int width, int height) {}
63 virtual int getBPS () {}
64 virtual void getScanline (int row, unsigned char* buffer, int bps) {}
65 virtual void setScanline (int row, unsigned char* buffer, int bps) {}
67 int load (Glib::ustring fname);
68 int save (Glib::ustring fname);
70 int loadPNG (Glib::ustring fname);
71 int loadJPEG (Glib::ustring fname);
72 int loadTIFF (Glib::ustring fname);
74 int savePNG (Glib::ustring fname, int compression = -1, int bps = -1);
75 int saveJPEG (Glib::ustring fname, int quality = 100);
76 int saveTIFF (Glib::ustring fname, int bps = -1);
78 cmsHPROFILE getEmbeddedProfile () { return embProfile; }
79 void getEmbeddedProfileData (int& length, unsigned char*& pdata) { length = loadedProfileLength; pdata = (unsigned char*)loadedProfileData; }
81 void setMetadata (const rtexif::TagDirectory* eroot, const std::vector<rtengine::procparams::ExifPair>& exif, const std::vector<rtengine::procparams::IPTCPair>& iptcc);
82 void setOutputProfile (char* pdata, int plen);
83 Glib::Mutex& mutex () { return imutex; }
87 #endif