12#include <QApplication>
16#include <ksharedconfig.h>
41 KisCursor::load(
"tool_similar_selection_cursor.png", 6, 6),
42 i18n(
"Similar Color Selection"))
44 , m_opacitySpread(100)
72 !(currentNode()->projection()) ||
73 !selectionEditable()) {
90 KisStrokeId strokeId = image()->startStroke(strategy);
104 const int currentTime = image()->animationInterface()->currentTime();
112 newReferenceNodeList,
114 newReferencePaintDevice,
132 const QPoint pos = convertToImagePixelCoordFloored(event);
143 *referenceColor = sourceDevice->
pixel(pos);
155 QRect
bounds = currentImage()->bounds();
169 tmpSel, referenceColor, sourceDevice,
170 bounds,
nullptr, progressHelper
174 image()->addJob(strokeId, job);
193 image()->endStroke(strokeId);
231 sliderThreshold->setPrefix(i18nc(
232 "The 'threshold' spinbox prefix in similar selection tool options",
235 sliderThreshold->setSingleStep(1);
236 sliderThreshold->setToolTip(
237 i18n(
"Set the color similarity tolerance of the selection. "
238 "Increasing threshold increases the range of similar colors to be selected."));
243 i18nc(
"The 'spread' spinbox in similar color selection tool options; {n} is the "
244 "number value, % is the percent sign",
248 sliderThreshold->setToolTip(
249 i18n(
"Set the color similarity tolerance of the selection. "
250 "Increasing threshold increases the range of similar colors to be selected."));
251 sliderSpread->setToolTip(
252 i18n(
"Set the extent of the opaque portion of the selection. "
253 "Decreasing spread decreases opacity of selection areas depending on color similarity."));
258 i18nc(
"The 'selection extent' section label in similar selection "
260 "Selection extent"));
261 sectionSelectionExtent->
appendWidget(
"sliderThreshold", sliderThreshold);
262 sectionSelectionExtent->
appendWidget(
"sliderSpread", sliderSpread);
263 selectionWidget->
insertWidget(3,
"sectionSelectionExtent", sectionSelectionExtent);
278 SIGNAL(valueChanged(
int)),
282 SIGNAL(valueChanged(
int)),
286 return selectionWidget;
292 useCursor(
KisCursor::load(
"tool_similar_selection_cursor_add.png", 6, 6));
294 useCursor(
KisCursor::load(
"tool_similar_selection_cursor_sub.png", 6, 6));
296 useCursor(
KisCursor::load(
"tool_similar_selection_cursor_inter.png", 6, 6));
298 useCursor(
KisCursor::load(
"tool_similar_selection_cursor_symdiff.png", 6, 6));
300 KisToolSelect::resetCursorStyle();
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
static QCursor load(const QString &cursorName, int hotspotX=-1, int hotspotY=-1)
static QCursor waitCursor()
void setSizemod(int sizemod)
void setFillThreshold(int threshold)
void setFeather(int feather)
QVector< KisStrokeJobData * > createSimilarColorsSelectionJobs(KisPixelSelectionSP outSelection, const QSharedPointer< KoColor > referenceColor, KisPaintDeviceSP referenceDevice, const QRect &rect, KisPixelSelectionSP mask, QSharedPointer< KisProcessingVisitor::ProgressHelper > progressHelper=nullptr)
void setAntiAlias(bool antiAlias)
void setStopGrowingAtDarkestPixel(bool stopGrowingAtDarkestPixel)
void setOpacitySpread(int opacitySpread)
static KisPaintDeviceSP createRefPaintDevice(KisImageSP originalImage, QString name="Merge Labeled Layers Reference Paint Device")
@ GroupSelectionPolicy_SelectIfColorLabeled
Groups will be taken into account only if they have set an explicit color label. This ignores groups ...
const KoColorSpace * colorSpace() const
bool pixel(qint32 x, qint32 y, QColor *c) const
void setStopGrowingAtDarkestPixelButtonVisible(bool visible)
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setValue(int newValue)
void setRange(int newMinimum, int newMaximum, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range, computing a new "fast slider step" based on the ...
void setSupportsWrapAroundMode(bool value)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
QSharedPointer< KUndo2Command > KUndo2CommandSP
KUndo2MagicString kundo2_i18n(const char *text)
void setText(QSpinBox *spinBox, const QStringView textTemplate)
The LambdaCommand struct is a shorthand for creation of AggregateCommand commands using C++ lambda fe...
void invalidateOutlineCache()