Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSprayShapeOptionData Struct Reference

#include <KisSprayShapeOptionData.h>

+ Inheritance diagram for KisSprayShapeOptionData:

Public Member Functions

QSize effectiveSize (int diameter, qreal scale) const
 
bool read (const KisPropertiesConfiguration *setting)
 
void write (KisPropertiesConfiguration *setting) const
 

Public Attributes

bool enabled
 
QImage image
 
QString imageUrl
 
bool proportional
 
quint8 shape
 
QSize size
 

Friends

bool operator== (const KisSprayShapeOptionData &lhs, const KisSprayShapeOptionData &rhs)
 

Detailed Description

Definition at line 19 of file KisSprayShapeOptionData.h.

Member Function Documentation

◆ effectiveSize()

QSize KisSprayShapeOptionData::effectiveSize ( int diameter,
qreal scale ) const

Definition at line 61 of file KisSprayShapeOptionData.cpp.

62{
63 return !proportional ? size : size * diameter * scale / 100.0;
64}

References proportional, and size.

◆ read()

bool KisSprayShapeOptionData::read ( const KisPropertiesConfiguration * setting)

Definition at line 21 of file KisSprayShapeOptionData.cpp.

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
29 proportional = settings->getBool(SPRAYSHAPE_PROPORTIONAL);
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}
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

References enabled, KisPropertiesConfiguration::getBool(), KisPropertiesConfiguration::getInt(), KisPropertiesConfiguration::getString(), image, imageUrl, proportional, shape, size, SPRAYSHAPE_ENABLED, SPRAYSHAPE_HEIGHT, SPRAYSHAPE_IMAGE_URL, SPRAYSHAPE_PROPORTIONAL, SPRAYSHAPE_SHAPE, and SPRAYSHAPE_WIDTH.

◆ write()

void KisSprayShapeOptionData::write ( KisPropertiesConfiguration * setting) const

Definition at line 46 of file KisSprayShapeOptionData.cpp.

47{
48 // settings->setProperty(SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT, followDrawingAngleWeight);
49 settings->setProperty(SPRAYSHAPE_ENABLED, enabled);
50
51 settings->setProperty(SPRAYSHAPE_WIDTH, size.width());
52 settings->setProperty(SPRAYSHAPE_HEIGHT, size.height());
53 settings->setProperty(SPRAYSHAPE_PROPORTIONAL, proportional);
54
55 // particle type size
56 settings->setProperty(SPRAYSHAPE_SHAPE, shape);
57 // you have to check if the image is null in client
58 settings->setProperty(SPRAYSHAPE_IMAGE_URL, imageUrl);
59}

References enabled, imageUrl, proportional, KisPropertiesConfiguration::setProperty(), shape, size, SPRAYSHAPE_ENABLED, SPRAYSHAPE_HEIGHT, SPRAYSHAPE_IMAGE_URL, SPRAYSHAPE_PROPORTIONAL, SPRAYSHAPE_SHAPE, and SPRAYSHAPE_WIDTH.

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const KisSprayShapeOptionData & lhs,
const KisSprayShapeOptionData & rhs )
friend

Definition at line 21 of file KisSprayShapeOptionData.h.

21 {
22 return lhs.shape == rhs.shape
23 && lhs.size == rhs.size
24 && lhs.enabled == rhs.enabled
25 && lhs.proportional == rhs.proportional
26 && lhs.imageUrl == rhs.imageUrl;
27 }

Member Data Documentation

◆ enabled

bool KisSprayShapeOptionData::enabled

Definition at line 32 of file KisSprayShapeOptionData.h.

◆ image

QImage KisSprayShapeOptionData::image

Definition at line 36 of file KisSprayShapeOptionData.h.

◆ imageUrl

QString KisSprayShapeOptionData::imageUrl

Definition at line 37 of file KisSprayShapeOptionData.h.

◆ proportional

bool KisSprayShapeOptionData::proportional

Definition at line 33 of file KisSprayShapeOptionData.h.

◆ shape

quint8 KisSprayShapeOptionData::shape

Definition at line 30 of file KisSprayShapeOptionData.h.

◆ size

QSize KisSprayShapeOptionData::size

Definition at line 31 of file KisSprayShapeOptionData.h.


The documentation for this struct was generated from the following files: