1 /* This file is part of the KDE project
2  * Copyright (C) Boudewijn Rempt <boud@valdyas.org>, (C) 2008
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 #include "kis_pressure_size_option.h"
20 #include "kis_pressure_opacity_option.h"
21 #include <klocalizedstring.h>
22 #include <kis_painter.h>
23 #include <KoColor.h>
24 #include "kis_dynamic_sensor.h"
25 #include <brushengine/kis_paintop_lod_limitations.h>
26 
27 
KisPressureSizeOption()28 KisPressureSizeOption::KisPressureSizeOption()
29     : KisCurveOption("Size", KisPaintOpOption::GENERAL, true)
30 {
31 
32 }
33 
34 
apply(const KisPaintInformation & info) const35 double KisPressureSizeOption::apply(const KisPaintInformation & info) const
36 {
37     if (!isChecked()) return 1.0;
38     return computeSizeLikeValue(info);
39 }
40 
lodLimitations(KisPaintopLodLimitations * l) const41 void KisPressureSizeOption::lodLimitations(KisPaintopLodLimitations *l) const
42 {
43     // HINT: FUZZY_PER_STROKE doesn't affect instant preview
44     if (sensor(FUZZY_PER_DAB, true)) {
45         l->limitations << KoID("size-fade", i18nc("PaintOp instant preview limitation", "Size -> Fuzzy (sensor)"));
46     }
47 
48     if (sensor(FADE, true)) {
49         l->blockers << KoID("size-fuzzy", i18nc("PaintOp instant preview limitation", "Size -> Fade (sensor)"));
50     }
51 }
52