Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSprayShapeOptionData.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Agata Cacko <cacko.azh@gmail.com>
3 * SPDX-FileCopyrightText: 2008, 2009, 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
8
10
11
12const QString SPRAYSHAPE_ENABLED = "SprayShape/enabled";
13const QString SPRAYSHAPE_SHAPE = "SprayShape/shape";
14const QString SPRAYSHAPE_PROPORTIONAL = "SprayShape/proportional";
15const QString SPRAYSHAPE_WIDTH = "SprayShape/width";
16const QString SPRAYSHAPE_HEIGHT = "SprayShape/height";
17const QString SPRAYSHAPE_IMAGE_URL = "SprayShape/imageUrl";
18const QString SPRAYSHAPE_USE_ASPECT = "SprayShape/useAspect";
19
20
22{
23 enabled = settings->getBool(SPRAYSHAPE_ENABLED, true);
24
25
26 size.setWidth(settings->getInt(SPRAYSHAPE_WIDTH));
27 size.setHeight(settings->getInt(SPRAYSHAPE_HEIGHT));
28
30
31 // particle type size
32 shape = settings->getInt(SPRAYSHAPE_SHAPE);
33 // you have to check if the image is null in client
34 QString url = settings->getString(SPRAYSHAPE_IMAGE_URL);
35 if (url.isEmpty()) {
36 image = QImage();
37 }
38 else {
39 image = QImage(url);
40 }
41 imageUrl = url;
42
43 return true;
44}
45
47{
48 // settings->setProperty(SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT, followDrawingAngleWeight);
50
51 settings->setProperty(SPRAYSHAPE_WIDTH, size.width());
52 settings->setProperty(SPRAYSHAPE_HEIGHT, size.height());
54
55 // particle type size
57 // you have to check if the image is null in client
59}
60
61QSize KisSprayShapeOptionData::effectiveSize(int diameter, qreal scale) const
62{
63 return !proportional ? size : size * diameter * scale / 100.0;
64}
const QString SPRAYSHAPE_USE_ASPECT
const QString SPRAYSHAPE_HEIGHT
const QString SPRAYSHAPE_SHAPE
const QString SPRAYSHAPE_IMAGE_URL
const QString SPRAYSHAPE_PROPORTIONAL
const QString SPRAYSHAPE_WIDTH
const QString SPRAYSHAPE_ENABLED
QString getString(const QString &name, const QString &def=QString()) const
virtual void setProperty(const QString &name, const QVariant &value)
bool getBool(const QString &name, bool def=false) const
int getInt(const QString &name, int def=0) const
QSize effectiveSize(int diameter, qreal scale) const
void write(KisPropertiesConfiguration *setting) const
bool read(const KisPropertiesConfiguration *setting)