FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
ConvertPixelFormat.hpp
1 /*
2  * Copyright 2011, 2012 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 CONVERTPIXELFORMAT_H
20 #define CONVERTPIXELFORMAT_H
21 
22 #include "ImageOperation.hpp"
23 #include "ImageBuffer.hpp"
24 
25 namespace FotoSHOCKcore {
26 
28  public:
29  ConvertPixelFormatDescr(cmsUInt32Number intent = INTENT_PERCEPTUAL);
30 
31  virtual const char* name() {return "Pixel format Conversion";}
32  virtual const char* description() {return "Converts the format of an image.";}
34  virtual ImageOperation* operation();
35  virtual InputProto inputPrototype();
36  virtual OutputProto outputPrototype();
37  private:
38  cmsUInt32Number m_intent;
39 };
40 
42  public:
43  ConvertPixelFormat(cmsUInt32Number intent = INTENT_PERCEPTUAL);
44 
45  void intent(cmsUInt32Number intent);
46 
47  virtual void runOperation(const Inputs& sources, const Outputs& dest, vector<UpdateInfo>& ROI, const long stamp);
48  private:
49  cmsUInt32Number m_intent;
50 
51  template<ValueType::Enum SrcFormat>
52  void selectDestPixelFormat(MipMap* src, MipMap* dest, vector<UpdateInfo>& ROI, const long stamp);
53  template<ValueType::Enum SrcFormat, ValueType::Enum DestFormat>
54  void convertPixelFormat(MipMap* src, MipMap* dest, vector<UpdateInfo>& ROI, const long stamp);
55 
56  template<ValueType::Enum SrcFormat, ValueType::Enum DestFormat>
57  void convertValueType(MipMap* src, MipMap* dest, vector<UpdateInfo>& ROI, const long stamp);
58  template<ValueType::Enum SrcFormat, ValueType::Enum DestFormat>
59  void convertColorSpace(MipMap* src, MipMap* dest, vector<UpdateInfo>& ROI, const long stamp);
60 };
61 
62 }
63 
64 #endif