~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/plugins/paintops/dynamicbrush/programs/filterslist/transformations/kis_size_transformation.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (c) 2006 Cyrille Berger <cberger@cberger.net>
3
 
 *
4
 
 *  This program is free software; you can redistribute it and/or modify
5
 
 *  it under the terms of the GNU Lesser General Public License as published by
6
 
 *  the Free Software Foundation; version 2 of the License.
7
 
 *
8
 
 *  This program is distributed in the hope that it will be useful,
9
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
 *  GNU General Public License for more details.
12
 
 *
13
 
 *  You should have received a copy of the GNU Lesser General Public License
14
 
 *  along with this program; if not, write to the Free Software
15
 
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16
 
 */
17
 
 
18
 
#include "kis_size_transformation.h"
19
 
#include <KoIntegerMaths.h>
20
 
 
21
 
#include "kis_dynamic_shape.h"
22
 
#include "kis_dynamic_sensor.h"
23
 
 
24
 
#include "ui_SizeTransformationEditor.h"
25
 
 
26
 
KisSizeTransformation::KisSizeTransformation(KisDynamicSensor* hTransfoParameter, KisDynamicSensor* vTransfoParameter)
27
 
        : KisDynamicTransformation(KisDynamicTransformation::SizeTransformationID),
28
 
        m_horizTransfoParameter(hTransfoParameter), m_vertiTransfoParameter(vTransfoParameter),
29
 
        m_hmax(2.0), m_hmin(0.5), m_vmax(2.0), m_vmin(0.5)
30
 
{
31
 
}
32
 
KisSizeTransformation::~KisSizeTransformation()
33
 
{
34
 
    if (m_horizTransfoParameter != m_vertiTransfoParameter)
35
 
        delete m_vertiTransfoParameter;
36
 
    delete m_horizTransfoParameter;
37
 
}
38
 
 
39
 
void KisSizeTransformation::transformBrush(KisDynamicShape* dabsrc, const KisPaintInformation& info)
40
 
{
41
 
    dabsrc->resize(m_horizTransfoParameter->parameter(info) *(m_hmax - m_hmin) + m_hmin,
42
 
                   m_vertiTransfoParameter->parameter(info) *(m_vmax - m_vmin) + m_vmin);
43
 
}
44
 
 
45
 
void KisSizeTransformation::transformColoring(KisDynamicColoring* coloringsrc, const KisPaintInformation& info)
46
 
{
47
 
    Q_UNUSED(coloringsrc);
48
 
    Q_UNUSED(info);
49
 
    // TODO: implement it
50
 
}
51
 
 
52
 
void KisSizeTransformation::setHSensor(KisDynamicSensor* sensor)
53
 
{
54
 
    delete m_horizTransfoParameter;
55
 
    m_horizTransfoParameter = sensor;
56
 
}
57
 
 
58
 
void KisSizeTransformation::setVSensor(KisDynamicSensor* sensor)
59
 
{
60
 
    delete m_vertiTransfoParameter;
61
 
    m_vertiTransfoParameter = sensor;
62
 
}
63
 
 
64
 
QWidget* KisSizeTransformation::createConfigWidget(QWidget* parent)
65
 
{
66
 
    QWidget* editorWidget = new QWidget(parent);
67
 
    Ui_SizeTransformationEditor ste;
68
 
    ste.setupUi(editorWidget);
69
 
    // Setup the horizontal parameter
70
 
    // horizontal sensor
71
 
    connect(ste.comboBoxHorizontalSensor, SIGNAL(sensorChanged(KisDynamicSensor*)), this, SLOT(setHSensor(KisDynamicSensor*)));
72
 
    ste.comboBoxHorizontalSensor->setCurrent(m_horizTransfoParameter);
73
 
    // horizontal maximum
74
 
    ste.spinBoxHorizontalMaximum->setValue(m_hmax);
75
 
    connect(ste.spinBoxHorizontalMaximum, SIGNAL(valueChanged(double)), this, SLOT(setHMaximum(double)));
76
 
    // horizontal minimum
77
 
    ste.spinBoxHorizontalMinimum->setValue(m_hmin);
78
 
    connect(ste.spinBoxHorizontalMinimum, SIGNAL(valueChanged(double)), this, SLOT(setHMinimum(double)));
79
 
    // Setup the vertical parameter
80
 
    // vertical sensor
81
 
    connect(ste.comboBoxVerticalSensor, SIGNAL(sensorChanged(KisDynamicSensor*)), this, SLOT(setVSensor(KisDynamicSensor*)));
82
 
    ste.comboBoxVerticalSensor->setCurrent(m_vertiTransfoParameter);
83
 
    // vertical maximum
84
 
    ste.spinBoxVerticalMaximum->setValue(m_hmax);
85
 
    connect(ste.spinBoxVerticalMaximum, SIGNAL(valueChanged(double)), this, SLOT(setHMaximum(double)));
86
 
    // Vertical minimum
87
 
    ste.spinBoxVerticalMinimum->setValue(m_hmin);
88
 
    connect(ste.spinBoxVerticalMinimum, SIGNAL(valueChanged(double)), this, SLOT(setHMinimum(double)));
89
 
    return editorWidget;
90
 
}
91
 
 
92
 
void KisSizeTransformation::setHMaximum(double v)
93
 
{
94
 
    m_hmax = v;
95
 
}
96
 
void KisSizeTransformation::setVMaximum(double v)
97
 
{
98
 
    m_vmax = v;
99
 
}
100
 
void KisSizeTransformation::setHMinimum(double v)
101
 
{
102
 
    m_hmin = v;
103
 
}
104
 
void KisSizeTransformation::setVMinimum(double v)
105
 
{
106
 
    m_vmin = v;
107
 
}
108
 
 
109
 
#include "kis_size_transformation.moc"