FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
ConvertFunctors.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 CONVERTFUNCTORS_H
20 #define CONVERTFUNCTORS_H
21 
22 #include "PixelData.hpp"
23 
24 #include <lcms2.h>
25 
26 namespace FotoSHOCKcore {
27 
29 
40  public:
42 
50  ConvertColorSpaceFunctor(const PixelData& in, const PixelData& out,
51  cmsUInt32Number intent);
54  void operator()(const void* in, void* out);
55  private:
56  cmsHTRANSFORM transform;
57 
58  // do not allow assignment
59  void operator=(const ConvertColorSpaceFunctor& other);
60 };
61 
62 template <typename PixelFormatIn, typename PixelFormatOut>
64  public:
65  ConvertValueTypeFunctor(unsigned int bands) : m_bands(bands) {};
66  void operator()(PixelFormatIn* in, PixelFormatOut* out) {
67  for (unsigned int i = 0; i < m_bands; i++) {
68  out[i] = (PixelFormatOut) in[i];
69  }
70  }
71  private:
72  const unsigned int m_bands;
73 };
74 
75 }
76 
77 #endif