diff --git a/plugins/paintops/experiment/kis_experiment_paintop.h b/plugins/paintops/experiment/kis_experiment_paintop.h --- a/plugins/paintops/experiment/kis_experiment_paintop.h +++ b/plugins/paintops/experiment/kis_experiment_paintop.h @@ -26,6 +26,8 @@ #include "kis_experiment_paintop_settings.h" #include "kis_experimentop_option.h" +#include + class QPointF; class KisPainter; @@ -85,6 +87,8 @@ bool m_useMirroring; KisPainter *m_originalPainter; KisPaintDeviceSP m_originalDevice; + + KisPainter::FillStyle m_fillStyle; }; #endif // KIS_EXPERIMENT_PAINTOP_H_ diff --git a/plugins/paintops/experiment/kis_experiment_paintop.cpp b/plugins/paintops/experiment/kis_experiment_paintop.cpp --- a/plugins/paintops/experiment/kis_experiment_paintop.cpp +++ b/plugins/paintops/experiment/kis_experiment_paintop.cpp @@ -55,12 +55,25 @@ m_windingFill = m_experimentOption.windingFill; m_hardEdge = m_experimentOption.hardEdge; + //Sets the brush to pattern or foregroundColor + if (m_experimentOption.fillType == ExperimentFillType::Pattern) { + m_fillStyle = KisPainter::FillStylePattern; + } else { + m_fillStyle = KisPainter::FillStyleForegroundColor; + } + + // Mirror options set with appropriate color, pattern, and fillStyle if (m_useMirroring) { - m_originalDevice = source()->createCompositionSourceDevice(); + m_originalDevice = source()->createCompositionSourceDevice(); m_originalPainter = new KisPainter(m_originalDevice); m_originalPainter->setCompositeOp(COMPOSITE_COPY); m_originalPainter->setPaintColor(painter->paintColor()); - m_originalPainter->setFillStyle(KisPainter::FillStyleForegroundColor); + m_originalPainter->setPattern(painter->pattern()); + m_originalPainter->setFillStyle(m_fillStyle); + + + + } else { m_originalPainter = 0; @@ -84,10 +97,13 @@ Q_FOREACH (const QRect & rect, changedRegion.rects()) { m_originalPainter->fillPainterPath(m_path, rect); painter()->renderDabWithMirroringNonIncremental(rect, m_originalDevice); + } } else { - painter()->setFillStyle(KisPainter::FillStyleForegroundColor); + //Sets options when mirror is not selected + painter()->setFillStyle(m_fillStyle); + painter()->setCompositeOp(COMPOSITE_COPY); painter()->setAntiAliasPolygonFill(!m_hardEdge); diff --git a/plugins/paintops/experiment/kis_experimentop_option.h b/plugins/paintops/experiment/kis_experimentop_option.h --- a/plugins/paintops/experiment/kis_experimentop_option.h +++ b/plugins/paintops/experiment/kis_experimentop_option.h @@ -29,8 +29,14 @@ const QString EXPERIMENT_SPEED_VALUE = "Experiment/speed"; const QString EXPERIMENT_WINDING_FILL = "Experiment/windingFill"; const QString EXPERIMENT_HARD_EDGE = "Experiment/hardEdge"; +const QString EXPERIMENT_FILL_TYPE = "Experiment/fillType"; +enum ExperimentFillType { + SolidColor, + Pattern +}; + class KisExperimentOpOptionsWidget; @@ -68,6 +74,7 @@ qreal smoothing; bool windingFill; bool hardEdge; + ExperimentFillType fillType; void readOptionSetting(const KisPropertiesConfigurationSP setting) { isDisplacementEnabled = setting->getBool(EXPERIMENT_DISPLACEMENT_ENABLED); @@ -78,6 +85,7 @@ smoothing = setting->getDouble(EXPERIMENT_SMOOTHING_VALUE, 20.0); windingFill = setting->getBool(EXPERIMENT_WINDING_FILL); hardEdge = setting->getBool(EXPERIMENT_HARD_EDGE); + fillType = (ExperimentFillType)setting->getInt(EXPERIMENT_FILL_TYPE, 0); // default to solid color } void writeOptionSetting(KisPropertiesConfigurationSP setting) const { @@ -89,6 +97,7 @@ setting->setProperty(EXPERIMENT_SMOOTHING_VALUE, smoothing); setting->setProperty(EXPERIMENT_WINDING_FILL, windingFill); setting->setProperty(EXPERIMENT_HARD_EDGE, hardEdge); + setting->setProperty(EXPERIMENT_FILL_TYPE, fillType); } diff --git a/plugins/paintops/experiment/kis_experimentop_option.cpp b/plugins/paintops/experiment/kis_experimentop_option.cpp --- a/plugins/paintops/experiment/kis_experimentop_option.cpp +++ b/plugins/paintops/experiment/kis_experimentop_option.cpp @@ -67,6 +67,10 @@ connect(m_options->windingFillCHBox, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); connect(m_options->hardEdgeCHBox, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); + + connect(m_options->patternButton, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); + connect(m_options->solidColorButton, SIGNAL(toggled(bool)), SLOT(emitSettingChanged())); + setConfigurationPage(m_options); } @@ -88,6 +92,12 @@ op.windingFill = m_options->windingFillCHBox->isChecked(); op.hardEdge = m_options->hardEdgeCHBox->isChecked(); + if (m_options->patternButton->isChecked()) { + op.fillType = ExperimentFillType::Pattern; + } else { + op.fillType = ExperimentFillType::SolidColor; + } + op.writeOptionSetting(setting); } @@ -105,6 +115,13 @@ m_options->speedCHBox->setChecked(op.isSpeedEnabled); m_options->smoothCHBox->setChecked(op.isSmoothingEnabled); m_options->displaceCHBox->setChecked(op.isDisplacementEnabled); + + + if (op.fillType == ExperimentFillType::Pattern) { + m_options->patternButton->setChecked(true); + } else { + m_options->solidColorButton->setChecked(true); + } } inline void enableCheckBox(QCheckBox *checkBox, qreal sliderValue) diff --git a/plugins/paintops/experiment/wdgexperimentoptions.ui b/plugins/paintops/experiment/wdgexperimentoptions.ui --- a/plugins/paintops/experiment/wdgexperimentoptions.ui +++ b/plugins/paintops/experiment/wdgexperimentoptions.ui @@ -6,19 +6,19 @@ 0 0 - 425 - 328 + 500 + 317 - + 255 255 - 425 + 500 290 @@ -41,21 +41,18 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - + + - + 0 0 - - Speed - - - + + 0 @@ -71,14 +68,17 @@ - - + + - + 0 0 + + Speed + @@ -100,7 +100,7 @@ - + @@ -122,6 +122,50 @@ + + + + + 0 + 90 + + + + Fill Style + + + false + + + false + + + + 5 + + + 5 + + + + + Foreground Color + + + true + + + + + + + Global Pattern + + + + + +