[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: Trivial patch for the duplicate tool
From: Bart Coppens <kde () bartcoppens ! be>
Date: 2007-02-09 16:38:43
Message-ID: 200702091738.43382.kde () bartcoppens ! be
[Download RAW message or body]
In order to make it a lot more usable, attached patch. Can be applied to 1.6
branch after the branching of 1.6.2 (adds a new 'feature'). I'm posting it
here so that I don't lose it or forget it. This is the behaviour that the
Gimp has, btw, and it makes a lot of sense.
What it does: the source layer for the duplicate tool is now the layer where
you clicked for selecting the source, instead of the current layer. (Best
would be even to an option to also have sample merged, but that changes GUI.)
Usecase: You can now duplicate parts of an image to a new layer. So that you
can roughly copy a part, and then start working with layer masks on that
layer, so you can be a bit 'messy' at the edges without ruining your image.
Bart
["duplicate_source.diff" (text/x-diff)]
Index: kis_tool_duplicate.cc
===================================================================
--- kis_tool_duplicate.cc (revision 622073)
+++ kis_tool_duplicate.cc (working copy)
@@ -75,6 +75,9 @@
if (e->state() == ShiftButton) {
m_position = e->pos();
m_isOffsetNotUptodate = true;
+ if (m_currentImage) {
+ m_sourceDevice = m_currentImage->activeDevice();
+ }
} else {
if (m_position != QPoint(-1, -1)) {
super::buttonPress(e);
@@ -111,8 +114,12 @@
super::initPaint(e);
painter()->setDuplicateOffset( m_offset );
KisPaintOp * op = KisPaintOpRegistry::instance()->paintOp("duplicate", 0, painter());
- if (op && m_source) {
- op->setSource(m_source);
+ if (!m_sourceDevice) {
+ kdDebug() << "No real source for the Duplication... using fallback" << endl;
+ m_sourceDevice = m_source;
+ }
+ if (op && m_sourceDevice) {
+ op->setSource(m_sourceDevice);
painter()->setPaintOp(op);
}
m_positionStartPainting = e->pos();
Index: kis_tool_duplicate.h
===================================================================
--- kis_tool_duplicate.h (revision 622073)
+++ kis_tool_duplicate.h (working copy)
@@ -64,6 +64,7 @@
bool m_isOffsetNotUptodate; // Tells if the offset is update
KisPoint m_position; // Give the position of the last alt-click
KisPoint m_positionStartPainting;
+ KisPaintDeviceSP m_sourceDevice;
QCheckBox* m_healing;
KIntNumInput* m_healingRadius;
QCheckBox* m_perspectiveCorrection;
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic