File indexing completed on 2024-05-12 15:58:12
0001 /* 0002 * SPDX-FileCopyrightText: 2005, 2008 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef _KIS_CONVOLUTION_KERNEL_H_ 0008 #define _KIS_CONVOLUTION_KERNEL_H_ 0009 0010 #include <cstddef> 0011 #include <Eigen/Core> 0012 #include "kis_shared.h" 0013 #include "kritaimage_export.h" 0014 #include "kis_types.h" 0015 0016 class KisMaskGenerator; 0017 class QImage; 0018 0019 class KRITAIMAGE_EXPORT KisConvolutionKernel : public KisShared 0020 { 0021 0022 public: 0023 KisConvolutionKernel(quint32 width, quint32 height, qreal offset, qreal factor); 0024 virtual ~KisConvolutionKernel(); 0025 0026 quint32 width() const; 0027 quint32 height() const; 0028 /** 0029 * Change the size of a kernel, it won't reallocate, and therefore it must keep the same kernel size ( oldwidth * oldheight = newwidth*newheight) 0030 */ 0031 void setSize(quint32 width, quint32 height); 0032 qreal offset() const; 0033 qreal factor() const; 0034 void setFactor(qreal); 0035 Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic>& data(); 0036 const Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic> * data() const; 0037 0038 static KisConvolutionKernelSP fromQImage(const QImage& image); 0039 static KisConvolutionKernelSP fromMaskGenerator(KisMaskGenerator *, qreal angle = 0.0); 0040 static KisConvolutionKernelSP fromMatrix(Eigen::Matrix<qreal, Eigen::Dynamic, Eigen::Dynamic> matrix, qreal offset, qreal factor); 0041 private: 0042 struct Private; 0043 Private* const d; 0044 0045 }; 0046 0047 class QDebug; 0048 0049 QDebug operator<<(QDebug debug, const KisConvolutionKernel &c); 0050 #endif