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/>.
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
31 #include <procparams.h>
32 #include <libiptcdata/iptc-data.h>
41 cmsHPROFILE embProfile
;
44 char* loadedProfileData
;
45 int loadedProfileLength
;
46 std::vector
<std::pair
<std::string
,std::string
> > exifChange
;
48 const rtexif::TagDirectory
* exifRoot
;
52 static Glib::ustring errorMsg
[6];
54 ImageIO () : pl (NULL
), embProfile(NULL
), profileData(NULL
), exifRoot (NULL
), iptc(NULL
), loadedProfileData(NULL
), loadedProfileLength(0) {}
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
; }