Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit eebaf389 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Make color pick tools pick from a special device

(which is coloring device for colorize masks)

It means that from now on, "Pick from layer" color picker mode will pick
from the filled area, not from the key strokes

BUG:392241
CC:kimageshop@kde.org
parent 1e513a17
......@@ -107,6 +107,11 @@ KisBaseNode::~KisBaseNode()
delete m_d;
}
KisPaintDeviceSP KisBaseNode::colorPickSourceDevice() const
{
return projection();
}
quint8 KisBaseNode::opacity() const
{
if (m_d->opacityChannel) {
......
......@@ -156,6 +156,13 @@ public:
*/
virtual KisPaintDeviceSP projection() const = 0;
/**
* @return a special device from where the color picker tool should pick
* color when in layer-only mode. For most of the nodes just shortcuts
* to projection() device. TODO: can it be null?
*/
virtual KisPaintDeviceSP colorPickSourceDevice() const;
virtual const KoColorSpace *colorSpace() const = 0;
/**
......
......@@ -462,6 +462,13 @@ KisPaintDeviceSP KisColorizeMask::coloringProjection() const
return m_d->coloringProjection;
}
KisPaintDeviceSP KisColorizeMask::colorPickSourceDevice() const
{
return
m_d->shouldShowColoring() && !m_d->coloringProjection->extent().isEmpty() ?
m_d->coloringProjection : projection();
}
QIcon KisColorizeMask::icon() const
{
return KisIconUtils::loadIcon("colorizeMask");
......
......@@ -62,6 +62,8 @@ public:
KisPaintDeviceSP paintDevice() const override;
KisPaintDeviceSP coloringProjection() const;
KisPaintDeviceSP colorPickSourceDevice() const override;
KisNodeSP clone() const override {
return KisNodeSP(new KisColorizeMask(*this));
}
......
......@@ -397,7 +397,7 @@ void KisToolPaint::addPickerJob(const PickingJob &pickingJob)
}
KisPaintDeviceSP device = fromCurrentNode ?
currentNode()->projection() : image()->projection();
currentNode()->colorPickSourceDevice() : image()->projection();
image()->addJob(m_pickerStrokeId,
new KisColorPickerStrokeStrategy::Data(device, imagePoint));
......
......@@ -139,8 +139,8 @@ void KisToolColorPicker::pickColor(const QPointF& pos)
KisPaintDeviceSP dev;
if (m_optionsWidget->cmbSources->currentIndex() != SAMPLE_MERGED &&
currentNode() && currentNode()->projection()) {
dev = currentNode()->projection();
currentNode() && currentNode()->colorPickSourceDevice()) {
dev = currentNode()->colorPickSourceDevice();
}
else {
imageLocker.reset(new boost::lock_guard<KisImage>(*currentImage()));
......
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