File indexing completed on 2025-03-09 04:10:14
0001 /* 0002 * SPDX-FileCopyrightText: 2010 Lukáš Tvrdý <lukast.dev@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "KisSketchOpOptionData.h" 0007 0008 #include "kis_properties_configuration.h" 0009 #include <kis_paintop_lod_limitations.h> 0010 0011 0012 const QString SKETCH_PROBABILITY = "Sketch/probability"; 0013 const QString SKETCH_DISTANCE_DENSITY = "Sketch/distanceDensity"; 0014 const QString SKETCH_OFFSET = "Sketch/offset"; 0015 const QString SKETCH_USE_SIMPLE_MODE = "Sketch/simpleMode"; 0016 const QString SKETCH_MAKE_CONNECTION = "Sketch/makeConnection"; 0017 const QString SKETCH_MAGNETIFY = "Sketch/magnetify"; 0018 const QString SKETCH_LINE_WIDTH = "Sketch/lineWidth"; 0019 const QString SKETCH_RANDOM_RGB = "Sketch/randomRGB"; 0020 const QString SKETCH_RANDOM_OPACITY = "Sketch/randomOpacity"; 0021 const QString SKETCH_DISTANCE_OPACITY = "Sketch/distanceOpacity"; 0022 const QString SKETCH_ANTIALIASING = "Sketch/antiAliasing"; 0023 0024 0025 bool KisSketchOpOptionData::read(const KisPropertiesConfiguration *setting) 0026 { 0027 probability = setting->getDouble(SKETCH_PROBABILITY, 0.50); 0028 offset = setting->getDouble(SKETCH_OFFSET, 30.0); 0029 lineWidth = setting->getInt(SKETCH_LINE_WIDTH, 1); 0030 simpleMode = setting->getBool(SKETCH_USE_SIMPLE_MODE, false); 0031 makeConnection = setting->getBool(SKETCH_MAKE_CONNECTION, true); 0032 magnetify = setting->getBool(SKETCH_MAGNETIFY, true); 0033 randomRGB = setting->getBool(SKETCH_RANDOM_RGB, false); 0034 randomOpacity = setting->getBool(SKETCH_RANDOM_OPACITY, false); 0035 distanceDensity = setting->getBool(SKETCH_DISTANCE_DENSITY, true); 0036 distanceOpacity = setting->getBool(SKETCH_DISTANCE_OPACITY, false); 0037 antiAliasing = setting->getBool(SKETCH_ANTIALIASING, false); 0038 0039 return true; 0040 } 0041 0042 void KisSketchOpOptionData::write(KisPropertiesConfiguration *setting) const 0043 { 0044 setting->setProperty(SKETCH_PROBABILITY, probability); 0045 setting->setProperty(SKETCH_OFFSET, offset); 0046 setting->setProperty(SKETCH_LINE_WIDTH, lineWidth); 0047 setting->setProperty(SKETCH_USE_SIMPLE_MODE, simpleMode); 0048 setting->setProperty(SKETCH_MAKE_CONNECTION, makeConnection); 0049 setting->setProperty(SKETCH_MAGNETIFY, magnetify); 0050 setting->setProperty(SKETCH_RANDOM_RGB, randomRGB); 0051 setting->setProperty(SKETCH_RANDOM_OPACITY, randomOpacity); 0052 setting->setProperty(SKETCH_DISTANCE_DENSITY, distanceDensity); 0053 setting->setProperty(SKETCH_DISTANCE_OPACITY, distanceOpacity); 0054 setting->setProperty(SKETCH_ANTIALIASING, antiAliasing); 0055 } 0056 0057 KisPaintopLodLimitations KisSketchOpOptionData::lodLimitations() const 0058 { 0059 KisPaintopLodLimitations l; 0060 l.limitations << KoID("sketch-brush", i18nc("PaintOp instant preview limitation", "Sketch brush (differences in connecting lines are possible)")); 0061 return l; 0062 }