Commit 9e02d3cd authored by Dmitry Kazakov's avatar Dmitry Kazakov

Rotation for Clone engine brush

Summary: Implemented rotation for Clone brushes. It only rotate brush tip but it's useful without "Source point move" option.

Many thanks for Radian Art for implementing the patch!

Reviewers: #krita, rempt, dkazakov
Reviewed By: #krita, dkazakov
Differential Revision: https://phabricator.kde.org/D6066
parent 2ea69df8
......@@ -73,6 +73,10 @@ KisDuplicateOp::KisDuplicateOp(const KisPaintOpSettingsSP settings, KisPainter *
Q_ASSERT(settings);
Q_ASSERT(painter);
m_sizeOption.readOptionSetting(settings);
m_rotationOption.readOptionSetting(settings);
m_sizeOption.resetAllSensors();
m_rotationOption.resetAllSensors();
m_healing = settings->getBool(DUPLICATE_HEALING);
m_perspectiveCorrection = settings->getBool(DUPLICATE_CORRECT_PERSPECTIVE);
m_moveSourcePoint = settings->getBool(DUPLICATE_MOVE_SOURCE_POINT);
......@@ -122,9 +126,11 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
realSourceDevice = externalSourceNode->projection();
}
qreal rotation = m_rotationOption.apply(info);
qreal scale = m_sizeOption.apply(info);
if (checkSizeTooSmall(scale)) return KisSpacingInformation();
KisDabShape shape(scale, 1.0, 0.0);
KisDabShape shape(scale, 1.0, rotation);
static const KoColorSpace *cs = KoColorSpaceRegistry::instance()->alpha8();
......
......@@ -31,6 +31,7 @@
#include <brushengine/kis_paintop_factory.h>
#include <brushengine/kis_paintop_settings.h>
#include <kis_pressure_size_option.h>
#include <kis_pressure_rotation_option.h>
#include "kis_duplicateop_settings.h"
......@@ -66,6 +67,7 @@ private:
QPointF m_duplicateStart;
bool m_duplicateStartIsSet;
KisPressureSizeOption m_sizeOption;
KisPressureRotationOption m_rotationOption;
bool m_healing;
bool m_perspectiveCorrection;
bool m_moveSourcePoint;
......
......@@ -29,6 +29,7 @@
#include <kis_paintop_settings_widget.h>
#include <kis_pressure_size_option.h>
#include <kis_pressure_opacity_option.h>
#include <kis_pressure_rotation_option.h>
#include <kis_curve_option_widget.h>
#include <kis_compositeop_option.h>
#include "kis_texture_option.h"
......@@ -47,6 +48,7 @@ KisDuplicateOpSettingsWidget::KisDuplicateOpSettingsWidget(QWidget* parent)
addPaintOpOption(new KisCompositeOpOption(true), i18n("Blending Mode"));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureOpacityOption(), i18n("Transparent"), i18n("Opaque")), i18n("Opacity"));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureSizeOption(), i18n("0%"), i18n("100%")), i18n("Size"));
addPaintOpOption(new KisCurveOptionWidget(new KisPressureRotationOption(), i18n("-180°"), i18n("180°")), i18n("Rotation"));
addPaintOpOption(new KisPressureMirrorOptionWidget(), i18n("Mirror"));
addPaintOpOption(new KisDuplicateOpOption(), i18n("Painting Mode"));
addPaintOpOption(new KisTextureOption(), i18n("Pattern"));
......
Markdown is supported
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