File indexing completed on 2024-12-22 04:16:07

0001 /*
0002  *  SPDX-FileCopyrightText: 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #include "KisDeformOptionData.h"
0007 
0008 #include "kis_properties_configuration.h"
0009 #include <kis_paintop_lod_limitations.h>
0010 
0011 
0012 const QString DEFORM_AMOUNT = "Deform/deformAmount";
0013 const QString DEFORM_ACTION = "Deform/deformAction";
0014 const QString DEFORM_USE_BILINEAR = "Deform/bilinear";
0015 const QString DEFORM_USE_MOVEMENT_PAINT = "Deform/useMovementPaint";
0016 const QString DEFORM_USE_COUNTER = "Deform/useCounter";
0017 const QString DEFORM_USE_OLD_DATA = "Deform/useOldData";
0018 
0019 
0020 bool KisDeformOptionData::read(const KisPropertiesConfiguration *setting)
0021 {
0022     deformAmount = setting->getDouble(DEFORM_AMOUNT, 0.2);
0023     deformUseBilinear = setting->getBool(DEFORM_USE_BILINEAR, false);
0024     deformUseCounter = setting->getBool(DEFORM_USE_COUNTER, false);
0025     deformUseOldData = setting->getBool(DEFORM_USE_OLD_DATA, false);
0026     deformAction = (DeformModes)setting->getInt(DEFORM_ACTION, 1);
0027 
0028     return true;
0029 }
0030 
0031 void KisDeformOptionData::write(KisPropertiesConfiguration *setting) const
0032 {
0033     setting->setProperty(DEFORM_AMOUNT, deformAmount);
0034     setting->setProperty(DEFORM_ACTION, deformAction);
0035     setting->setProperty(DEFORM_USE_BILINEAR, deformUseBilinear);
0036     setting->setProperty(DEFORM_USE_COUNTER, deformUseCounter);
0037     setting->setProperty(DEFORM_USE_OLD_DATA, deformUseOldData);
0038 }
0039 
0040 KisPaintopLodLimitations KisDeformOptionData::lodLimitations() const
0041 {
0042     KisPaintopLodLimitations l;
0043     l.blockers << KoID("deform-brush", i18nc("PaintOp instant preview limitation", "Deform Brush (unsupported)"));
0044     return l;
0045 }