File indexing completed on 2025-01-26 04:10:27

0001 /*
0002  *  SPDX-FileCopyrightText: 2012 Dmitry Kazakov <dimula73@gmail.com>
0003  *  SPDX-FileCopyrightText: 2013 Sven Langkamp <sven.langkamp@gmail.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #include "modify_selection_operations.h"
0009 #include <kis_selection_filters.h>
0010 
0011 void GrowSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config)
0012 {
0013     int xradius = config.getInt("x-radius", 1);
0014     int yradius = config.getInt("y-radius", 1);
0015     KisSelectionFilter* filter = new KisGrowSelectionFilter(xradius, yradius);
0016     runFilter(filter, view, config);
0017 }
0018 
0019 void ShrinkSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config)
0020 {
0021     int xradius = config.getInt("x-radius", 1);
0022     int yradius = config.getInt("y-radius", 1);
0023     bool edgeLock = config.getBool("edgeLock", false);
0024     KisSelectionFilter* filter = new KisShrinkSelectionFilter(xradius, yradius, edgeLock);
0025     runFilter(filter, view, config);
0026 }
0027 
0028 void BorderSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config)
0029 {
0030     int xradius = config.getInt("x-radius", 1);
0031     int yradius = config.getInt("y-radius", 1);
0032     bool antialiasing = config.getInt("antialiasing", false);
0033     KisSelectionFilter* filter = new KisBorderSelectionFilter(xradius, yradius, antialiasing);
0034     runFilter(filter, view, config);
0035 }
0036 
0037 void FeatherSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config)
0038 {
0039     int radius = config.getInt("radius", 1);
0040     KisSelectionFilter* filter = new KisFeatherSelectionFilter(radius);
0041     runFilter(filter, view, config);
0042 }
0043 
0044 void SmoothSelectionOperation::runFromXML(KisViewManager* view, const KisOperationConfiguration& config)
0045 {
0046     Q_UNUSED(config);
0047     KisSelectionFilter* filter = new KisSmoothSelectionFilter();
0048     runFilter(filter, view, config);
0049 }
0050