File indexing completed on 2025-01-26 04:10:30
0001 /* 0002 * This file is part of Krita 0003 * 0004 * SPDX-FileCopyrightText: 2020 L. E. Segovia <amy@amyspark.me> 0005 * 0006 * SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 #ifndef __KIS_IMAGE_INTERFACE_H 0010 #define __KIS_IMAGE_INTERFACE_H 0011 0012 #include "kritaqmicinterface_export.h" 0013 0014 #include <QDebug> 0015 #include <QMutex> 0016 #include <QObject> 0017 #include <QRect> 0018 #include <QScopedPointer> 0019 #include <QSize> 0020 #include <QVector> 0021 0022 class KisQmicApplicator; 0023 class KisViewManager; 0024 0025 #define KRITA_QMIC_INTERFACE_VERSION 0x05010001 0026 0027 struct KRITAQMICINTERFACE_EXPORT KisQMicImage { 0028 QMutex m_mutex; 0029 QString m_layerName; 0030 int m_width; 0031 int m_height; 0032 int m_spectrum; 0033 float* m_data; 0034 0035 KisQMicImage(QString layerName, int width, int height, int spectrum = 4) 0036 : m_mutex() 0037 , m_layerName(layerName) 0038 , m_width(width) 0039 , m_height(height) 0040 , m_spectrum(spectrum) 0041 , m_data(new float[width * height * spectrum]) 0042 { 0043 } 0044 0045 ~KisQMicImage() { 0046 delete[] m_data; 0047 } 0048 0049 const float* constData() const 0050 { 0051 return m_data; 0052 } 0053 0054 size_t size() const 0055 { 0056 return m_width * m_height * m_spectrum * sizeof(float); 0057 } 0058 }; 0059 0060 QDebug operator<<(QDebug d, const KisQMicImage &model); 0061 0062 using KisQMicImageSP = QSharedPointer<KisQMicImage>; 0063 0064 class KRITAQMICINTERFACE_EXPORT KisImageInterface : public QObject 0065 { 0066 Q_OBJECT 0067 0068 public: 0069 KisImageInterface(KisViewManager *parent = nullptr); 0070 ~KisImageInterface() override; 0071 0072 QSize gmic_qt_get_image_size(int mode); 0073 QVector<KisQMicImageSP> gmic_qt_get_cropped_images(int mode, QRectF &cropRect); 0074 void gmic_qt_output_images(int mode, QVector<KisQMicImageSP> layers); 0075 void gmic_qt_detach(); 0076 0077 private: 0078 struct Private; 0079 const QScopedPointer<Private> p; 0080 }; 0081 0082 #endif