Commit f3012ab7 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Added texturing capabilities to other dab-based paint ops

That is to:
1) Duplicate Op
2) Color Smudge Op
3) Hatching Op

BUG:313831
parent 6ed82cac
......@@ -123,6 +123,10 @@ qreal KisColorSmudgeOp::paintAt(const KisPaintInformation& info)
const KoCompositeOp* oldMode = painter()->compositeOp();
qreal fpOpacity = (qreal(oldOpacity) / 255.0) * m_opacityOption.getOpacityf(info);
// update the brush mask if needed. the mask is then stored in m_maskDab
// and the extends of the mask is stored in m_maskBounds
updateMask(info, scale, rotation);
if(!m_firstRun) {
// if color is disabled (only smudge) and "overlay mode is enabled
// then first blit the region under the brush from the image projection
......@@ -146,10 +150,6 @@ qreal KisColorSmudgeOp::paintAt(const KisPaintInformation& info)
}
else m_firstRun = false;
// update the brush mask if needed. the mask is then stored in m_maskDab
// and the extends of the mask is stored in m_maskBounds
updateMask(info, scale, rotation);
if(m_image && m_overlayModeOption.isChecked()) {
m_tempPainter->setCompositeOp(COMPOSITE_COPY);
m_tempPainter->setOpacity(OPACITY_OPAQUE_U8);
......
......@@ -41,8 +41,6 @@ KisColorSmudgeOpSettingsWidget::KisColorSmudgeOpSettingsWidget(QWidget* parent):
setObjectName("brush option widget");
setPrecisionEnabled(true);
// KisSmudgeOptionWidget* opt =
addPaintOpOption(new KisCompositeOpOption(true));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureSizeOption()));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption()));
......@@ -51,9 +49,10 @@ KisColorSmudgeOpSettingsWidget::KisColorSmudgeOpSettingsWidget(QWidget* parent):
addPaintOpOption(new KisRateOptionWidget(i18n("Color Rate") , i18n("Rate: "), "ColorRate" , false));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureRotationOption()));
addPaintOpOption(new KisPressureScatterOptionWidget());
// addPaintOpOption(new KisAirbrushOption(false));
addPaintOpOption(new KisOverlayModeOptionWidget());
addPaintOpOption(new KisCurveOptionWidget(new KisPressureGradientOption()));
addTextureOptions();
}
KisColorSmudgeOpSettingsWidget::~KisColorSmudgeOpSettingsWidget() { }
......
......@@ -76,8 +76,6 @@ KisBrushOp::KisBrushOp(const KisBrushBasedPaintOpSettings *settings, KisPainter
m_rotationOption.readOptionSetting(settings);
m_mixOption.readOptionSetting(settings);
m_scatterOption.readOptionSetting(settings);
m_mirrorOption.readOptionSetting(settings);
m_textureProperties.fillProperties(settings);
m_opacityOption.sensor()->reset();
m_sizeOption.sensor()->reset();
......@@ -90,7 +88,6 @@ KisBrushOp::KisBrushOp(const KisBrushBasedPaintOpSettings *settings, KisPainter
m_dabCache->setMirrorPostprocessing(&m_mirrorOption);
m_dabCache->setSharpnessPostprocessing(&m_sharpnessOption);
m_dabCache->setTexturePostprocessing(&m_textureProperties);
}
KisBrushOp::~KisBrushOp()
......
......@@ -36,7 +36,7 @@
#include <kis_pressure_sharpness_option.h>
#include <kis_color_source_option.h>
#include <kis_pressure_spacing_option.h>
#include <kis_texture_option.h>
class KisBrushBasedPaintOpSettings;
......@@ -70,7 +70,6 @@ private:
KisPressureMixOption m_mixOption;
KisPressureScatterOption m_scatterOption;
QList<KisPressureHSVOption*> m_hsvOptions;
KisTextureProperties m_textureProperties;
KoColorTransformation *m_hsvTransformation;
KisPaintDeviceSP m_dab;
......
......@@ -39,8 +39,6 @@
#include <kis_pressure_spacing_option.h>
#include <kis_compositeop_option.h>
#include <kis_pressure_flow_opacity_option_widget.h>
#include <kis_texture_option.h>
#include "kis_pressure_texture_strength_option.h"
KisBrushOpSettingsWidget::KisBrushOpSettingsWidget(QWidget* parent)
......@@ -59,7 +57,7 @@ KisBrushOpSettingsWidget::KisBrushOpSettingsWidget(QWidget* parent)
addPaintOpOption(new KisPressureSharpnessOptionWidget());
addPaintOpOption(new KisCurveOptionWidget(new KisPressureRotationOption()));
addPaintOpOption(new KisPressureScatterOptionWidget());
// Colors options
addPaintOpOption(new KisColorSourceOptionWidget());
addPaintOpOption(new KisCurveOptionWidget(new KisPressureDarkenOption()));
......@@ -70,9 +68,7 @@ KisBrushOpSettingsWidget::KisBrushOpSettingsWidget(QWidget* parent)
addPaintOpOption(new KisAirbrushOption(false));
addPaintOpOption(new KisPaintActionTypeOption());
// Texture options
addPaintOpOption(new KisTextureOption());
addPaintOpOption(new KisCurveOptionWidget(new KisPressureTextureStrengthOption()));
addTextureOptions();
}
KisBrushOpSettingsWidget::~KisBrushOpSettingsWidget()
......
......@@ -44,6 +44,8 @@ KisDuplicateOpSettingsWidget::KisDuplicateOpSettingsWidget(QWidget* parent)
addPaintOpOption(new KisCurveOptionWidget(new KisPressureSizeOption()));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption()));
addPaintOpOption(m_duplicateOption);
addTextureOptions();
}
KisDuplicateOpSettingsWidget::~KisDuplicateOpSettingsWidget()
......
......@@ -55,6 +55,8 @@ KisHatchingPaintOpSettingsWidget:: KisHatchingPaintOpSettingsWidget(QWidget* par
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption()));
addPaintOpOption(new KisPaintActionTypeOption());
addTextureOptions();
//-----Useful to read first:------
/*
Below you will encounter a reasonably correct solution to the problem of changing
......
......@@ -34,6 +34,9 @@ KisBrushBasedPaintOp::KisBrushBasedPaintOp(const KisPropertiesConfiguration* set
m_precisionOption.readOptionSetting(settings);
m_dabCache = new KisDabCache(m_brush);
m_dabCache->setPrecisionOption(&m_precisionOption);
m_textureProperties.fillProperties(settings);
m_dabCache->setTexturePostprocessing(&m_textureProperties);
}
KisBrushBasedPaintOp::~KisBrushBasedPaintOp()
......
......@@ -22,6 +22,7 @@
#include "kis_paintop.h"
#include "kis_dab_cache.h"
#include "kis_brush.h"
#include "kis_texture_option.h"
#include "kis_precision_option.h"
......@@ -47,6 +48,7 @@ public:
protected: // XXX: make private!
KisBrushSP m_brush;
KisTextureProperties m_textureProperties;
KisPrecisionOption m_precisionOption;
KisDabCache *m_dabCache;
};
......
......@@ -19,6 +19,10 @@
#include "kis_brush_based_paintop_options_widget.h"
#include "kis_brush_option_widget.h"
#include "krita_export.h"
#include "kis_texture_option.h"
#include "kis_curve_option_widget.h"
#include "kis_pressure_texture_strength_option.h"
KisBrushBasedPaintopOptionWidget::KisBrushBasedPaintopOptionWidget(QWidget* parent)
: KisPaintOpOptionsWidget(parent)
......@@ -36,6 +40,12 @@ void KisBrushBasedPaintopOptionWidget::setPrecisionEnabled(bool value)
m_brushOption->setPrecisionEnabled(value);
}
void KisBrushBasedPaintopOptionWidget::addTextureOptions()
{
addPaintOpOption(new KisTextureOption());
addPaintOpOption(new KisCurveOptionWidget(new KisPressureTextureStrengthOption()));
}
KisBrushSP KisBrushBasedPaintopOptionWidget::brush()
{
return m_brushOption->brush();
......
......@@ -33,6 +33,7 @@ public:
virtual ~KisBrushBasedPaintopOptionWidget();
void setPrecisionEnabled(bool value);
void addTextureOptions();
KisBrushSP brush();
......
......@@ -180,7 +180,7 @@ bool KisDabCache::needSeparateOriginal()
m_d->mirrorOption->isChecked() &&
(m_d->mirrorOption->isHorizontalMirrorEnabled() ||
m_d->mirrorOption->isVerticalMirrorEnabled())) ||
(m_d->mirrorOption && m_d->textureOption->enabled);
(m_d->textureOption && m_d->textureOption->enabled);
}
inline
......
......@@ -326,6 +326,7 @@ void KisTextureProperties::fillProperties(const KisPropertiesConfiguration *sett
cutoffPolicy = setting->getInt("Texture/Pattern/CutoffPolicy", 0);
m_strengthOption.readOptionSetting(setting);
m_strengthOption.sensor()->reset();
recalculateMask();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment