Krita Source Code Documentation
Loading...
Searching...
No Matches
KisRoundMarkerOpSettings Class Reference

#include <kis_roundmarkerop_settings.h>

+ Inheritance diagram for KisRoundMarkerOpSettings:

Classes

struct  Private
 

Public Member Functions

qreal airbrushInterval () const override
 
KisOptimizedBrushOutline brushOutline (const KisPaintInformation &info, const OutlineMode &mode, qreal alignForZoom) override
 
bool isAirbrushing () const override
 
 KisRoundMarkerOpSettings (KisResourcesInterfaceSP resourcesInterface)
 
bool paintIncremental () override
 
qreal paintOpAngle () const override
 
qreal paintOpSize () const override
 
void setPaintOpAngle (qreal value) override
 
void setPaintOpSize (qreal value) override
 
QList< KisUniformPaintOpPropertySPuniformProperties (KisPaintOpSettingsSP settings, QPointer< KisPaintOpPresetUpdateProxy > updateProxy) override
 
 ~KisRoundMarkerOpSettings () override
 
- Public Member Functions inherited from KisOutlineGenerationPolicy< KisPaintOpSettings >
 KisOutlineGenerationPolicy (KisCurrentOutlineFetcher::Options options, KisResourcesInterfaceSP resourcesInterface)
 
void onPropertyChanged () override
 
const KisCurrentOutlineFetcheroutlineFetcher () const
 
 ~KisOutlineGenerationPolicy () override
 
- Public Member Functions inherited from KisPaintOpSettings
virtual void activate ()
 
KoCanvasResourcesInterfaceSP canvasResourcesInterface () const
 
virtual KisPaintOpSettingsSP clone () const
 
KisPaintOpSettingsSP createMaskingSettings () const
 
QString effectivePaintOpCompositeOp ()
 
bool eraserMode ()
 
bool hasMaskingSettings () const
 
virtual bool hasPatternSettings () const
 
virtual QString indirectPaintingCompositeOp () const
 
virtual bool isValid () const
 
 KisPaintOpSettings (const KisPaintOpSettings &rhs)
 
 KisPaintOpSettings (KisResourcesInterfaceSP resourcesInterface)
 
qreal lodSizeThreshold () const
 
virtual bool lodSizeThresholdSupported () const
 
QString maskingBrushCompositeOp () const
 
virtual QString modelName () const
 
virtual bool mousePressEvent (const KisPaintInformation &paintInformation, Qt::KeyboardModifiers modifiers, KisNodeWSP currentNode)
 
virtual bool mouseReleaseEvent ()
 
virtual bool needsAsynchronousUpdates () const
 
KisNodeSP node () const
 
QString paintOpCompositeOp ()
 
qreal paintOpFade ()
 
qreal paintOpFlow ()
 
virtual qreal paintOpOpacity ()
 
virtual qreal paintOpPatternSize ()
 
qreal paintOpScatter ()
 
 Private ()
 
 Private (const Private &rhs)
 
virtual void regenerateResourceCache (KoResourceCacheInterfaceSP cacheInterface)
 
virtual QList< int > requiredCanvasResources () const
 
virtual void resetSettings (const QStringList &preserveProperties=QStringList())
 
KoResourceCacheInterfaceSP resourceCacheInterface () const
 
KisResourcesInterfaceSP resourcesInterface () const
 
quint64 sanityVersionCookie () const
 
qreal savedBrushOpacity () const
 
qreal savedBrushSize () const
 
qreal savedEraserOpacity () const
 
qreal savedEraserSize () const
 
void setCanvasResourcesInterface (KoCanvasResourcesInterfaceSP canvasResourcesInterface)
 
void setEraserMode (bool value)
 
void setLodSizeThreshold (qreal value)
 
void setModelName (const QString &modelName)
 
void setPaintOpCompositeOp (const QString &value)
 
void setPaintOpFade (qreal value)
 
void setPaintOpFlow (qreal value)
 
virtual void setPaintOpOpacity (qreal value)
 
void setPaintOpScatter (qreal value)
 
void setProperty (const QString &name, const QVariant &value) override
 
virtual void setRandomOffset (const KisPaintInformation &paintInformation)
 
virtual void setResourceCacheInterface (KoResourceCacheInterfaceSP cacheInterface)
 
void setResourcesInterface (KisResourcesInterfaceSP resourcesInterface)
 
void setSavedBrushOpacity (qreal value)
 
void setSavedBrushSize (qreal value)
 
void setSavedEraserOpacity (qreal value)
 
void setSavedEraserSize (qreal value)
 
void setUpdateListener (UpdateListenerWSP listener)
 
UpdateListenerWSP updateListener () const
 
virtual bool useSpacingUpdates () const
 
 ~KisPaintOpSettings () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KisPropertiesConfiguration
void clearProperties ()
 Clear the map of properties.
 
virtual bool compareTo (const KisPropertiesConfiguration *rhs) const
 
virtual void dump () const
 
void fromXML (const QDomElement &) override
 
bool fromXML (const QString &xml, bool clear=true) override
 
bool getBool (const QString &name, bool def=false) const
 
KoColor getColor (const QString &name, const KoColor &color=KoColor()) const
 getColor fetch the given property as a KoColor.
 
KisCubicCurve getCubicCurve (const QString &name, const KisCubicCurve &curve=KisCubicCurve()) const
 
double getDouble (const QString &name, double def=0.0) const
 
float getFloat (const QString &name, float def=0.0) const
 
int getInt (const QString &name, int def=0) const
 
void getPrefixedProperties (const QString &prefix, KisPropertiesConfiguration *config) const
 
void getPrefixedProperties (const QString &prefix, KisPropertiesConfigurationSP config) const
 
virtual QMap< QString, QVariant > getProperties () const
 
virtual QList< QString > getPropertiesKeys () const
 
virtual QVariant getProperty (const QString &name) const
 
virtual bool getProperty (const QString &name, QVariant &value) const
 
QString getPropertyLazy (const QString &name, const char *defaultValue) const
 
QStringList getPropertyLazy (const QString &name, const QStringList &defaultValue) const
 
template<typename T >
getPropertyLazy (const QString &name, const T &defaultValue) const
 
QString getString (const QString &name, const QString &def=QString()) const
 
QStringList getStringList (const QString &name, const QStringList &defaultValue=QStringList()) const
 
virtual bool hasProperty (const QString &name) const
 
 KisPropertiesConfiguration ()
 
 KisPropertiesConfiguration (const KisPropertiesConfiguration &rhs)
 
KisPropertiesConfigurationoperator= (const KisPropertiesConfiguration &rhs)
 
void removeProperty (const QString &name)
 
void setPrefixedProperties (const QString &prefix, const KisPropertiesConfiguration *config)
 
void setPrefixedProperties (const QString &prefix, const KisPropertiesConfigurationSP config)
 
void setProperty (const QString &name, const QStringList &value)
 
void setPropertyNotSaved (const QString &name)
 Marks a property that should not be saved by toXML.
 
QString toXML () const override
 
void toXML (QDomDocument &, QDomElement &) const override
 
 ~KisPropertiesConfiguration () override
 
- Public Member Functions inherited from KisSerializableConfiguration
 KisSerializableConfiguration ()
 
 KisSerializableConfiguration (const KisSerializableConfiguration &rhs)
 
virtual ~KisSerializableConfiguration ()
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Private Attributes

const QScopedPointer< Privatem_d
 

Additional Inherited Members

- Public Types inherited from KisPaintOpSettings
using UpdateListenerSP = QSharedPointer<UpdateListener>
 
using UpdateListenerWSP = QWeakPointer<UpdateListener>
 
- Static Public Member Functions inherited from KisPaintOpSettings
static KisOptimizedBrushOutline ellipseOutline (qreal width, qreal height, qreal scale, qreal rotation)
 
static bool isLodUserAllowed (const KisPropertiesConfigurationSP config)
 
static QPainterPath makeTiltIndicator (KisPaintInformation const &info, QPointF const &start, qreal lengthScale, qreal angle)
 
static void setLodUserAllowed (KisPropertiesConfigurationSP config, bool value)
 
- Static Public Member Functions inherited from KisPropertiesConfiguration
static QString escapeString (const QString &string)
 
static QString extractedPrefixKey ()
 
static QString unescapeString (const QString &string)
 
- Public Attributes inherited from KisPaintOpSettings
KoCanvasResourcesInterfaceSP canvasResourcesInterface
 
bool disableDirtyNotifications
 
QString modelName
 
KoResourceCacheInterfaceSP resourceCacheInterface
 
KisResourcesInterfaceSP resourcesInterface
 
QPointer< KisPaintOpConfigWidgetsettingsWidget
 
QList< KisUniformPaintOpPropertyWSPuniformProperties
 
UpdateListenerWSP updateListener
 
quint64 versionCookie
 
KisRandomSource versionRandomSource
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- Public Attributes inherited from KisPropertiesConfiguration
QSet< QString > notSavedProperties
 
QMap< QString, QVariant > properties
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Detailed Description

Definition at line 15 of file kis_roundmarkerop_settings.h.

Constructor & Destructor Documentation

◆ KisRoundMarkerOpSettings()

◆ ~KisRoundMarkerOpSettings()

KisRoundMarkerOpSettings::~KisRoundMarkerOpSettings ( )
override

Definition at line 27 of file kis_roundmarkerop_settings.cpp.

28{
29}

Member Function Documentation

◆ airbrushInterval()

qreal KisRoundMarkerOpSettings::airbrushInterval ( ) const
inlineoverridevirtual

Indicates the minimum time interval that might be needed between airbrush dabs, in milliseconds. A lower value means painting updates need to happen more frequently. This value should be ignored if isAirbrushing() is false.

The default implementation uses the property AIRBRUSH_RATE, defaulting to an interval of one second if the property is not found. This should be suitable for most paintops.

Reimplemented from KisPaintOpSettings.

Definition at line 34 of file kis_roundmarkerop_settings.h.

35 {
36 return 1000.0;
37 }

◆ brushOutline()

KisOptimizedBrushOutline KisRoundMarkerOpSettings::brushOutline ( const KisPaintInformation & info,
const OutlineMode & mode,
qreal alignForZoom )
overridevirtual

Returns the brush outline in pixel coordinates. Tool is responsible for conversion into view coordinates. Outline mode has to be passed to the paintop which builds the outline as some paintops have to paint outline always like clone paintop indicating the duplicate position

Reimplemented from KisPaintOpSettings.

Definition at line 60 of file kis_roundmarkerop_settings.cpp.

61{
63
64 if (mode.isVisible) {
65 qreal finalScale = 1.0;
66
68 option.read(this);
69 // Adding 1 for the antialiasing/fade.
70 const qreal radius = (0.5 * option.diameter) + 1;
71
72 QPainterPath realOutline;
73 realOutline.addEllipse(QPointF(), radius, radius);
74
75 path = outlineFetcher()->fetchOutline(info, this, realOutline, mode, alignForZoom, finalScale);
76
77 if (mode.showTiltDecoration) {
78 QPainterPath tiltLine = makeTiltIndicator(info,
79 realOutline.boundingRect().center(),
80 realOutline.boundingRect().width() * 0.5,
81 3.0);
82 path.addPath(outlineFetcher()->fetchOutline(info, this, tiltLine, mode, alignForZoom, finalScale, 0.0, true, realOutline.boundingRect().center().x(), realOutline.boundingRect().center().y()));
83 }
84 }
85
86 return path;
87}
KisOptimizedBrushOutline fetchOutline(const KisPaintInformation &info, const KisPaintOpSettingsSP settings, const KisOptimizedBrushOutline &originalOutline, const KisPaintOpSettings::OutlineMode &mode, qreal alignForZoom, qreal additionalScale=1.0, qreal additionalRotation=0.0, bool tilt=false, qreal tiltcenterx=1.0, qreal tiltcentery=1.0) const
const KisCurrentOutlineFetcher * outlineFetcher() const
static QPainterPath makeTiltIndicator(KisPaintInformation const &info, QPointF const &start, qreal lengthScale, qreal angle)
bool read(const KisPropertiesConfiguration *setting)

References KisRoundMarkerOpOptionData::diameter, KisCurrentOutlineFetcher::fetchOutline(), KisPaintOpSettings::OutlineMode::isVisible, KisPaintOpSettings::makeTiltIndicator(), KisOutlineGenerationPolicy< KisPaintOpSettings >::outlineFetcher(), KisRoundMarkerOpOptionData::read(), and KisPaintOpSettings::OutlineMode::showTiltDecoration.

◆ isAirbrushing()

bool KisRoundMarkerOpSettings::isAirbrushing ( ) const
inlineoverridevirtual

Whether this paintop wants to deposit paint even when not moving, i.e. the tool needs to activate its timer. If this is true, painting updates need to be generated at regular intervals even in the absence of input device events, e.g. when the cursor is not moving.

The default implementation checks the property AIRBRUSH_ENABLED, defaulting to false if the property is not found. This should be suitable for most paintops.

Reimplemented from KisPaintOpSettings.

Definition at line 29 of file kis_roundmarkerop_settings.h.

30 {
31 return false;
32 }

◆ paintIncremental()

bool KisRoundMarkerOpSettings::paintIncremental ( )
overridevirtual

XXX: Remove this after 2.0, when the paint operation (incremental/non incremental) will be completely handled in the paintop, not in the tool. This is a filthy hack to move the option to the right place, at least.

Returns
true if we paint incrementally, false if we paint like Photoshop. By default, paintops do not support non-incremental.

Reimplemented from KisPaintOpSettings.

Definition at line 31 of file kis_roundmarkerop_settings.cpp.

31 {
32 return false;
33}

◆ paintOpAngle()

qreal KisRoundMarkerOpSettings::paintOpAngle ( ) const
overridevirtual
Returns
paintop angle (in degrees) saved in the properties

Implements KisPaintOpSettings.

Definition at line 55 of file kis_roundmarkerop_settings.cpp.

56{
57 return 0.0;
58}

◆ paintOpSize()

qreal KisRoundMarkerOpSettings::paintOpSize ( ) const
overridevirtual
Returns
size saved in the properties

Implements KisPaintOpSettings.

Definition at line 43 of file kis_roundmarkerop_settings.cpp.

44{
46 option.read(this);
47 return option.diameter;
48}

References KisRoundMarkerOpOptionData::diameter, and KisRoundMarkerOpOptionData::read().

◆ setPaintOpAngle()

void KisRoundMarkerOpSettings::setPaintOpAngle ( qreal value)
overridevirtual

Set paintop angle (in degrees) directly in the properties. Increasing the angle corresponds to a counter-clockwise rotation.

Implements KisPaintOpSettings.

Definition at line 50 of file kis_roundmarkerop_settings.cpp.

51{
52 Q_UNUSED(value);
53}
float value(const T *src, size_t ch)

References value().

◆ setPaintOpSize()

void KisRoundMarkerOpSettings::setPaintOpSize ( qreal value)
overridevirtual

Set paintop size directly in the properties

Implements KisPaintOpSettings.

Definition at line 35 of file kis_roundmarkerop_settings.cpp.

36{
38 option.read(this);
39 option.diameter = value;
40 option.write(this);
41}
void write(KisPropertiesConfiguration *setting) const

References KisRoundMarkerOpOptionData::diameter, KisRoundMarkerOpOptionData::read(), value(), and KisRoundMarkerOpOptionData::write().

◆ uniformProperties()

QList< KisUniformPaintOpPropertySP > KisRoundMarkerOpSettings::uniformProperties ( KisPaintOpSettingsSP settings,
QPointer< KisPaintOpPresetUpdateProxy > updateProxy )
overridevirtual

Reimplemented from KisPaintOpSettings.

Definition at line 93 of file kis_roundmarkerop_settings.cpp.

94{
96 listWeakToStrong(m_d->uniformProperties);
97
98 if (props.isEmpty()) {
99 {
101 new KisUniformPaintOpPropertyCallback(KisUniformPaintOpPropertyCallback::Bool, KoID("auto_spacing", i18n("Auto Spacing")), settings, 0);
102
103 prop->setReadCallback(
104 [](KisUniformPaintOpProperty *prop) {
106 data.read(prop->settings().data());
107
108 prop->setValue(data.useAutoSpacing);
109 });
110 prop->setWriteCallback(
111 [](KisUniformPaintOpProperty *prop) {
113 data.read(prop->settings().data());
114 data.useAutoSpacing = prop->value().toBool();
115 data.write(prop->settings().data());
116 });
117
118 QObject::connect(updateProxy, SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue()));
119 prop->requestReadValue();
120 props << toQShared(prop);
121 }
122
123 {
125 new KisDoubleSliderBasedPaintOpPropertyCallback(KisDoubleSliderBasedPaintOpPropertyCallback::Double,
126 KoID("spacing", i18n("Spacing")),
127 settings,
128 0);
129
130 prop->setRange(0.01, 10);
131 prop->setSingleStep(0.01);
132 prop->setExponentRatio(3.0);
133
134 prop->setReadCallback(
135 [](KisUniformPaintOpProperty *prop) {
137 data.read(prop->settings().data());
138
139 prop->setValue(data.autoSpacingCoeff);
140 });
141 prop->setWriteCallback(
142 [](KisUniformPaintOpProperty *prop) {
144 data.read(prop->settings().data());
145 data.autoSpacingCoeff = prop->value().toBool();
146 data.write(prop->settings().data());
147 });
148
149 QObject::connect(updateProxy, SIGNAL(sigSettingsChanged()), prop, SLOT(requestReadValue()));
150 prop->requestReadValue();
151 props << toQShared(prop);
152 }
153 }
154
155 return KisPaintOpSettings::uniformProperties(settings, updateProxy) + props;
156}
void setValue(const QVariant &value)
KisPaintOpSettingsSP settings() const
Definition KoID.h:30
QSharedPointer< T > toQShared(T *ptr)
Container< QSharedPointer< T > > listWeakToStrong(const Container< QWeakPointer< T > > &container, bool allOrNothing=true)
KisCallbackBasedPaintopProperty< KisSliderBasedPaintOpProperty< qreal > > KisDoubleSliderBasedPaintOpPropertyCallback
KisCallbackBasedPaintopProperty< KisUniformPaintOpProperty > KisUniformPaintOpPropertyCallback
QList< KisUniformPaintOpPropertyWSP > uniformProperties

References KisRoundMarkerOpOptionData::autoSpacingCoeff, listWeakToStrong(), m_d, KisRoundMarkerOpOptionData::read(), KisCallbackBasedPaintopProperty< ParentClass >::setReadCallback(), KisCallbackBasedPaintopProperty< ParentClass >::setWriteCallback(), toQShared(), KisPaintOpSettings::uniformProperties, KisRoundMarkerOpOptionData::useAutoSpacing, and KisRoundMarkerOpOptionData::write().

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisRoundMarkerOpSettings::m_d
private

Definition at line 45 of file kis_roundmarkerop_settings.h.


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