Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
/*
* SPDX-FileCopyrightText: 2013 Lukáš Tvrdý <[email protected]>
* SPDX-FileCopyrightText: 2022 L. E. Segovia <[email protected]>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef __KIS_QMIC_SIMPLE_CONVERTOR_H
#define __KIS_QMIC_SIMPLE_CONVERTOR_H
#include <QRect>
#include <kis_paint_device.h>
#include "kis_qmic_interface.h"
class QImage;
class KisQmicSimpleConvertor
{
public:
static QString blendingModeToString(QString blendMode);
static QString stringToBlendingMode(QString str);
/**
* A special function that removes all parenthesis from
* the layer name, since parenthesis are used in GMic to
* encode layer properties.
*
* The function basically replaces '(' and ')' symbols
* with \u0015 and \u0016 correspondingly.
*/
static QString nameToGMicName(QString name);
/**
* Decode the GMic-encoded name back into the one with
* parenthesis
*
* \see nameToGMicName()
*/
static QString gMicNameToName(QString name);
static QImage convertToQImage(const KisQMicImage &gmicImage,
float gmicMaxChannelValue = 255.0);
static void convertFromQImage(const QImage &image,
KisQMicImage &gmicImage,
float gmicUnitValue = 1.0);
// output gmic image will have max channel 255.0
static void convertToGmicImage(KisPaintDeviceSP dev,
KisQMicImage &gmicImage,
QRect rc = QRect());
// gmicMaxChannelValue indicates if the gmic image pixels rgb has range 0..255 or 0..1.0
static void convertFromGmicImage(const KisQMicImage &gmicImage,
KisPaintDeviceSP dst,
float gmicMaxChannelValue);
/// Fast versions
static void convertFromGmicFast(const KisQMicImage &gmicImage,
KisPaintDeviceSP dst,
float gmicUnitValue);
static void convertToGmicImageFast(KisPaintDeviceSP dev,
KisQMicImage &gmicImage,
QRect rc = QRect());
};
#endif