1 /*
2  * Copyright (c) 2013 Lukáš Tvrdý <lukast.dev@gmail.com
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef __KIS_QMIC_SIMPLE_CONVERTOR_H
20 #define __KIS_QMIC_SIMPLE_CONVERTOR_H
21 
22 #include <QVector>
23 #include <QRect>
24 #include <kis_paint_device.h>
25 #include <gmic.h>
26 
27 class QImage;
28 
29 class KisQmicSimpleConvertor
30 {
31 public:
32     static QImage convertToQImage(gmic_image<float>& gmicImage, float gmicMaxChannelValue = 255.0);
33     static void convertFromQImage(const QImage &image, gmic_image<float> *gmicImage, float gmicUnitValue = 1.0);
34 
35     // output gmic image will have max channel 255.0
36     static void convertToGmicImage(KisPaintDeviceSP dev, gmic_image<float> *gmicImage, QRect rc = QRect());
37     // gmicMaxChannelValue indicates if the gmic image pixels rgb has range 0..255 or 0..1.0
38     static void convertFromGmicImage(gmic_image<float>& gmicImage, KisPaintDeviceSP dst, float gmicMaxChannelValue);
39 
40     /// Fast versions
41     static void convertFromGmicFast(gmic_image<float>& gmicImage, KisPaintDeviceSP dst, float gmicUnitValue);
42     static void convertToGmicImageFast(KisPaintDeviceSP dev, gmic_image<float> *gmicImage, QRect rc = QRect());
43 };
44 
45 #endif
46