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

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Agata Cacko <cacko.azh@gmail.com>
0003  *  SPDX-FileCopyrightText: 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 #include "KisExperimentOpOptionData.h"
0008 
0009 #include "kis_properties_configuration.h"
0010 
0011 
0012 const QString EXPERIMENT_DISPLACEMENT_ENABLED = "Experiment/displacementEnabled";
0013 const QString EXPERIMENT_DISPLACEMENT_VALUE = "Experiment/displacement";
0014 const QString EXPERIMENT_SMOOTHING_ENABLED = "Experiment/smoothing";
0015 const QString EXPERIMENT_SMOOTHING_VALUE = "Experiment/smoothingValue";
0016 const QString EXPERIMENT_SPEED_ENABLED = "Experiment/speedEnabled";
0017 const QString EXPERIMENT_SPEED_VALUE = "Experiment/speed";
0018 const QString EXPERIMENT_WINDING_FILL = "Experiment/windingFill";
0019 const QString EXPERIMENT_HARD_EDGE = "Experiment/hardEdge";
0020 const QString EXPERIMENT_FILL_TYPE = "Experiment/fillType";
0021 
0022 
0023 
0024 bool KisExperimentOpOptionData::read(const KisPropertiesConfiguration *setting)
0025 {
0026     isDisplacementEnabled = setting->getBool(EXPERIMENT_DISPLACEMENT_ENABLED);
0027     displacement = setting->getDouble(EXPERIMENT_DISPLACEMENT_VALUE, 50.0);
0028     isSpeedEnabled = setting->getBool(EXPERIMENT_SPEED_ENABLED);
0029     speed = setting->getDouble(EXPERIMENT_SPEED_VALUE, 50.0);
0030     isSmoothingEnabled = setting->getBool(EXPERIMENT_SMOOTHING_ENABLED);
0031     smoothing = setting->getDouble(EXPERIMENT_SMOOTHING_VALUE, 20.0);
0032     windingFill = setting->getBool(EXPERIMENT_WINDING_FILL);
0033     hardEdge = setting->getBool(EXPERIMENT_HARD_EDGE);
0034     fillType = (ExperimentFillType)setting->getInt(EXPERIMENT_FILL_TYPE, 0); // default to solid color
0035 
0036     return true;
0037 }
0038 
0039 void KisExperimentOpOptionData::write(KisPropertiesConfiguration *setting) const
0040 {
0041     setting->setProperty(EXPERIMENT_DISPLACEMENT_ENABLED, isDisplacementEnabled);
0042     setting->setProperty(EXPERIMENT_DISPLACEMENT_VALUE, displacement);
0043     setting->setProperty(EXPERIMENT_SPEED_ENABLED, isSpeedEnabled);
0044     setting->setProperty(EXPERIMENT_SPEED_VALUE, speed);
0045     setting->setProperty(EXPERIMENT_SMOOTHING_ENABLED, isSmoothingEnabled);
0046     setting->setProperty(EXPERIMENT_SMOOTHING_VALUE, smoothing);
0047     setting->setProperty(EXPERIMENT_WINDING_FILL, windingFill);
0048     setting->setProperty(EXPERIMENT_HARD_EDGE, hardEdge);
0049     setting->setProperty(EXPERIMENT_FILL_TYPE, fillType);
0050 }