Krita Source Code Documentation
Loading...
Searching...
No Matches
EnhancedPathParameter.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2007 Jan Hambrecht <jaham@gmx.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KOENHANCEDPATHPARAMETER_H
8#define KOENHANCEDPATHPARAMETER_H
9
10#include <QString>
11
13
31
34{
35public:
37 virtual ~EnhancedPathParameter();
39 virtual qreal evaluate() = 0;
41 virtual void modify(qreal value);
43 virtual QString toString() const = 0;
44protected:
46private:
48};
49
52{
53public:
56 qreal evaluate() override;
57 QString toString() const override;
58private:
59 qreal m_value;
60};
61
64{
65public:
69 EnhancedPathNamedParameter(const QString &identifier, EnhancedPathShape *parent);
70 qreal evaluate() override;
72 static Identifier identifierFromString(const QString &text);
73 QString toString() const override;
74private:
76};
77
80{
81public:
83 explicit EnhancedPathReferenceParameter(const QString &reference, EnhancedPathShape *parent);
84 qreal evaluate() override;
85 void modify(qreal value) override;
86 QString toString() const override;
87private:
88 QString m_reference;
89};
90
91#endif // KOENHANCEDPATHPARAMETER_H
Identifier
the different possible identifiers, taken from the odf spec
@ IdentifierYstretch
The value of draw:path-stretchpoint-y is used.
@ IdentifierLogwidth
The width of the svg:viewBox in 1/100th mm is used.
@ IdentifierTop
top of svg:viewBox or draw:coordinate-origin-y
@ IdentifierRight
right of svg:viewBox or draw:coordinate-origin-x + draw:coordinate-width
@ IdentifierXstretch
The value of draw:path-stretchpoint-x is used.
@ IdentifierBottom
bottom of svg:viewBox or draw:coordinate-origin-y + draw:coordinate-height
@ IdentifierHasStroke
If the shape has a line style, a value of 1 is used.
@ IdentifierPi
value of pi.
@ IdentifierHasFill
If the shape has a fill style, a value of 1 is used.
@ IdentifierHeight
The height of the svg:viewBox is used.
@ IdentifierLogheight
The height of the svg:viewBox in 1/100th mm is used.
@ IdentifierLeft
left of svg:viewBox or draw:coordinate-origin-x
@ IdentifierWidth
The width of the svg:viewBox is used.
@ IdentifierUnknown
unknown identifier
float value(const T *src, size_t ch)
A constant parameter, a fixed value (i.e. 5, 11.3, -7)
EnhancedPathConstantParameter(qreal value, EnhancedPathShape *parent)
Constructs the constant parameter with the given value.
qreal evaluate() override
evaluates the parameter using the given path
QString toString() const override
returns string representation of the parameter
A named parameter, one that refers to a variable of the path.
EnhancedPathNamedParameter(Identifier identifier, EnhancedPathShape *parent)
Constructs named parameter from given identifier.
qreal evaluate() override
evaluates the parameter using the given path
QString toString() const override
returns string representation of the parameter
static Identifier identifierFromString(const QString &text)
Returns identifier type from given string.
Identifier m_identifier
the identifier type
The abstract parameter class.
virtual qreal evaluate()=0
evaluates the parameter using the given path
EnhancedPathParameter(EnhancedPathShape *parent)
virtual void modify(qreal value)
modifies the parameter if possible, using the new value
EnhancedPathShape * parent()
EnhancedPathShape * m_parent
virtual QString toString() const =0
returns string representation of the parameter
A referencing parameter, one that references another formula or a modifier.
QString m_reference
the reference, formula or modifier
void modify(qreal value) override
modifies the parameter if possible, using the new value
QString toString() const override
returns string representation of the parameter
qreal evaluate() override
evaluates the parameter using the given path
EnhancedPathReferenceParameter(const QString &reference, EnhancedPathShape *parent)
Constructs reference parameter from the given reference string.