FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
exrCodec.hpp
1 /*
2  * Copyright 2013 Lukas Jirkovsky
3  *
4  * This file is part of FotoSHOCKcore.
5  *
6  * FotoSHOCKcore is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * FotoSHOCKcore is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with FotoSHOCKcore. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef EXRCODEC_H
20 #define EXRCODEC_H
21 
22 #include "../Codec.hpp"
23 #include <OpenEXR/ImfRgbaFile.h>
24 
25 namespace FotoSHOCKcore {
26 namespace IO {
27 
28 class ExrDecoder : public Decoder {
29  public:
30  ExrDecoder(const std::string fileName);
31  virtual ~ExrDecoder();
32  static bool canDecode(const std::string fileName);
33  virtual ImageBufferBase* loadImage(unsigned int tileExtent);
34  virtual ImageBufferBase* loadImage(unsigned int tileExtent, PixelData format);
35  private:
36  Imf::RgbaInputFile file;
37 
38  template <typename ValueType::Enum PixelFormat>
39  ImageBufferBase* loadImage(unsigned int tileExtent, PixelData format);
40 };
41 
42 class ExrEncoder : public Encoder {
43  public:
44  ExrEncoder(const std::string fileName);
45  virtual ~ExrEncoder();
46  static Formats::Enum format();
47  virtual void saveImage(ImageBufferBase* image, int quality);
48 };
49 
50 }
51 }
52 
53 #endif