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

0001 /*
0002  *  SPDX-FileCopyrightText: 2009, 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #include "KisBrushSizeOptionData.h"
0007 
0008 #include "kis_properties_configuration.h"
0009 
0010 
0011 const QString BRUSH_SHAPE = "Brush/shape";
0012 const QString BRUSH_DIAMETER = "Brush/diameter";
0013 const QString BRUSH_ASPECT = "Brush/aspect";
0014 const QString BRUSH_SCALE = "Brush/scale";
0015 const QString BRUSH_ROTATION = "Brush/rotation";
0016 const QString BRUSH_SPACING = "Brush/spacing";
0017 const QString BRUSH_DENSITY = "Brush/density";
0018 const QString BRUSH_JITTER_MOVEMENT = "Brush/jitterMovement";
0019 const QString BRUSH_JITTER_MOVEMENT_ENABLED = "Brush/jitterMovementEnabled";
0020 
0021 
0022 bool KisBrushSizeOptionData::read(const KisPropertiesConfiguration *setting)
0023 {
0024     brushDiameter = setting->getDouble(BRUSH_DIAMETER, 20.0);
0025     brushAspect = setting->getDouble(BRUSH_ASPECT, 1.0);
0026     brushRotation = setting->getDouble(BRUSH_ROTATION, 0.0);
0027     brushScale = setting->getDouble(BRUSH_SCALE, 1.0);
0028     brushSpacing = setting->getDouble(BRUSH_SPACING, 0.3);
0029     brushDensity = setting->getDouble(BRUSH_DENSITY, 1.0);
0030     brushJitterMovement = setting->getDouble(BRUSH_JITTER_MOVEMENT, 0.0);
0031     brushJitterMovementEnabled = setting->getBool(BRUSH_JITTER_MOVEMENT_ENABLED, false);
0032 
0033     return true;
0034 }
0035 
0036 void KisBrushSizeOptionData::write(KisPropertiesConfiguration *setting) const
0037 {
0038     setting->setProperty(BRUSH_DIAMETER, brushDiameter);
0039     setting->setProperty(BRUSH_ASPECT, brushAspect);
0040     setting->setProperty(BRUSH_ROTATION, brushRotation);
0041     setting->setProperty(BRUSH_SCALE, brushScale);
0042     setting->setProperty(BRUSH_SPACING, brushSpacing);
0043     setting->setProperty(BRUSH_DENSITY, brushDensity);
0044     setting->setProperty(BRUSH_JITTER_MOVEMENT, brushJitterMovement);
0045     setting->setProperty(BRUSH_JITTER_MOVEMENT_ENABLED, brushJitterMovementEnabled);
0046 }