2
* This file is part of the KDE project
4
* Copyright (c) 2004 Cyrille Berger <cberger@cberger.net>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
#include "kis_custom_convolution_filter.h"
27
#include "kis_convolution_painter.h"
28
#include "kis_custom_convolution_filter_configuration_widget.h"
29
#include "kis_custom_convolution_filter_configuration_base_widget.h"
30
#include "kis_matrix_widget.h"
33
KisFilterConfigWidget * KisCustomConvolutionFilter::createConfigurationWidget(QWidget* parent, KisPaintDeviceSP)
35
KisCustomConvolutionFilterConfigurationWidget* ccfcw = new KisCustomConvolutionFilterConfigurationWidget(this,parent, "custom convolution config widget");
40
KisFilterConfiguration * KisCustomConvolutionFilter::configuration(QWidget* nwidget)
42
KisCustomConvolutionFilterConfigurationWidget* widget = (KisCustomConvolutionFilterConfigurationWidget*) nwidget;
46
// Create the identity matrix:
47
KisKernelSP kernel = new KisKernel();
54
kernel->data = new Q_INT32[9];
65
return new KisConvolutionConfiguration( "custom convolution", kernel );
69
// Create the identity matrices:
70
KisKernelSP kernel = new KisKernel();
74
kernel->data = new Q_INT32[9];
76
KisCustomConvolutionFilterConfigurationBaseWidget* mw = widget->matrixWidget();
78
kernel->data[0] = mw->matrixWidget->m11->value();
79
kernel->data[1] = mw->matrixWidget->m21->value();
80
kernel->data[2] = mw->matrixWidget->m31->value();
81
kernel->data[3] = mw->matrixWidget->m12->value();
82
kernel->data[4] = mw->matrixWidget->m22->value();
83
kernel->data[5] = mw->matrixWidget->m32->value();
84
kernel->data[6] = mw->matrixWidget->m13->value();
85
kernel->data[7] = mw->matrixWidget->m23->value();
86
kernel->data[8] = mw->matrixWidget->m33->value();
88
kernel->factor = mw->spinBoxFactor->value();
89
kernel->offset = mw->spinBoxOffset->value();
91
return new KisConvolutionConfiguration( "custom convolution", kernel );