Krita Source Code Documentation
Loading...
Searching...
No Matches
KisToolFill Class Reference

#include <kis_tool_fill.h>

+ Inheritance diagram for KisToolFill:

Public Types

enum  ContiguousFillMode { ContiguousFillMode_FloodFill , ContiguousFillMode_BoundaryFill }
 
enum  ContinuousFillMode { ContinuousFillMode_DoNotUse , ContinuousFillMode_FillAnyRegion , ContinuousFillMode_FillSimilarRegions }
 
enum  FillMode { FillMode_FillSelection , FillMode_FillContiguousRegion , FillMode_FillSimilarRegions }
 
enum  FillType { FillType_FillWithForegroundColor , FillType_FillWithBackgroundColor , FillType_FillWithPattern }
 
enum  Reference { Reference_CurrentLayer , Reference_AllLayers , Reference_ColorLabeledLayers }
 
- Public Types inherited from KisTool
enum  { FLAG_USES_CUSTOM_PRESET =0x01 , FLAG_USES_CUSTOM_COMPOSITEOP =0x02 , FLAG_USES_CUSTOM_SIZE =0x04 }
 
enum  AlternateAction {
  ChangeSize = AlternateChangeSize , ChangeSizeSnap = AlternateChangeSizeSnap , SampleFgNode = AlternateSampleFgNode , SampleBgNode = AlternateSampleBgNode ,
  SampleFgImage = AlternateSampleFgImage , SampleBgImage = AlternateSampleBgImage , Secondary = AlternateSecondary , Third = AlternateThird ,
  Fourth = AlternateFourth , Fifth = AlternateFifth , NONE = 10000
}
 
enum  NodePaintAbility {
  VECTOR , CLONE , PAINT , UNPAINTABLE ,
  MYPAINTBRUSH_UNPAINTABLE
}
 
enum  ToolAction {
  Primary , AlternateChangeSize , AlternateChangeSizeSnap , AlternateSampleFgNode ,
  AlternateSampleBgNode , AlternateSampleFgImage , AlternateSampleBgImage , AlternateSecondary ,
  AlternateThird , AlternateFourth , AlternateFifth , Alternate_NONE = 10000
}
 

Public Slots

void activate (const QSet< KoShape * > &shapes) override
 
void deactivate () override
 
- Public Slots inherited from KisToolPaint
void activate (const QSet< KoShape * > &shapes) override
 
void deactivate () override
 
- Public Slots inherited from KisTool
void activate (const QSet< KoShape * > &shapes) override
 
void canvasResourceChanged (int key, const QVariant &res) override
 
void deactivate () override
 
virtual void updateSettingsViews ()
 
- Public Slots inherited from KoToolBase
virtual void activate (const QSet< KoShape * > &shapes)
 
virtual void deactivate ()
 
virtual void documentResourceChanged (int key, const QVariant &res)
 
virtual void repaintDecorations ()
 
virtual void requestRedoDuringStroke ()
 
virtual void requestStrokeCancellation ()
 
virtual void requestStrokeEnd ()
 
virtual void requestUndoDuringStroke ()
 
void setStatusText (const QString &statusText)
 
void updateOptionsWidgetIcons ()
 

Public Member Functions

void beginAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
void beginPrimaryAction (KoPointerEvent *event) override
 
void continueAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
void continuePrimaryAction (KoPointerEvent *event) override
 
QWidget * createOptionWidget () override
 
void endAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
void endPrimaryAction (KoPointerEvent *event) override
 
 KisToolFill (KoCanvasBase *canvas)
 
 ~KisToolFill () override
 
- Public Member Functions inherited from KisToolPaint
int flags () const override
 
 KisToolPaint (KoCanvasBase *canvas, const QCursor &cursor)
 
void mouseMoveEvent (KoPointerEvent *event) override
 
void mousePressEvent (KoPointerEvent *event) override
 
void mouseReleaseEvent (KoPointerEvent *event) override
 
KisPopupWidgetInterfacepopupWidget () override
 
 ~KisToolPaint () override
 
- Public Member Functions inherited from KisTool
virtual bool alternateActionSupportsHiResEvents (AlternateAction action) const
 
virtual void beginAlternateDoubleClickAction (KoPointerEvent *event, AlternateAction action)
 
virtual void beginPrimaryDoubleClickAction (KoPointerEvent *event)
 
void deleteSelection () override
 
bool isActive () const
 
 KisTool (KoCanvasBase *canvas, const QCursor &cursor)
 
void mouseDoubleClickEvent (KoPointerEvent *event) override
 
void mouseTripleClickEvent (KoPointerEvent *event) override
 
virtual void newActivationWithExternalSource (KisPaintDeviceSP externalSource)
 newActivationWithExternalSource Makes sure that the tool is active and starts a new stroke, which will be able to access the pixels from the specified external source.
 
KisTool::NodePaintAbility nodePaintAbility ()
 
virtual bool primaryActionSupportsHiResEvents () const
 
virtual bool supportsPaintingAssistants () const
 
 ~KisTool () override
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 
- Public Member Functions inherited from KoToolBase
QAction * action (const QString &name) const
 
KoCanvasBasecanvas () const
 Returns the canvas the tool is working on.
 
virtual void copy () const
 
QCursor cursor () const
 return the last emitted cursor
 
virtual void customMoveEvent (KoPointerEvent *event)
 
virtual void customPressEvent (KoPointerEvent *event)
 
virtual void customReleaseEvent (KoPointerEvent *event)
 
virtual void cut ()
 
virtual QRectF decorationsRect () const
 
int decorationThickness () const
 decorationThickness The minimum thickness for tool decoration lines, this is derived from the screen magnification, thus the HiDPI settings. Note: to use this effectively, also set the pen to isCosmetic(true);
 
virtual void deselect ()
 deselect the tool should clear the selection if it has one.
 
virtual void dragLeaveEvent (QDragLeaveEvent *event)
 
virtual void dragMoveEvent (QDragMoveEvent *event, const QPointF &point)
 
virtual void dropEvent (QDropEvent *event, const QPointF &point)
 
virtual void explicitUserStrokeEndRequest ()
 explicitUserStrokeEndRequest is called by the input manager when the user presses Enter key or any equivalent. This callback comes before requestStrokeEnd(), which comes from a different source.
 
KoToolFactoryBasefactory () const
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual bool hasSelection ()
 
virtual void inputMethodEvent (QInputMethodEvent *event)
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
bool isInTextMode () const
 
bool isOpacityPresetMode () const
 
virtual void keyPressEvent (QKeyEvent *event)
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
 KoToolBase (KoCanvasBase *canvas)
 
bool maskSyntheticEvents () const
 
QList< QPointer< QWidget > > optionWidgets ()
 
virtual bool paste ()
 
virtual QMenu * popupActionsMenu ()
 
virtual bool selectAll ()
 selectAll select all data the tool can select.
 
virtual KoToolSelectionselection ()
 
Q_INVOKABLE QString toolId () const
 
 ~KoToolBase () override
 

Protected Slots

void resetCursorStyle () override
 
void slotUpdateFill ()
 
- Protected Slots inherited from KisTool
virtual void resetCursorStyle ()
 

Protected Member Functions

bool wantsAutoScroll () const override
 
- Protected Member Functions inherited from KisToolPaint
void activateAlternateAction (AlternateAction action) override
 
void activatePrimaryAction () override
 
void addOptionWidgetLayout (QLayout *layout)
 Add the tool-specific layout to the default option widget layout.
 
virtual void addOptionWidgetOption (QWidget *control, QWidget *label=nullptr)
 Add a widget and a label to the current option widget layout.
 
void beginAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
void canvasResourceChanged (int key, const QVariant &v) override
 
void continueAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
QWidget * createOptionWidget () override
 
void deactivateAlternateAction (AlternateAction action) override
 
void deactivatePrimaryAction () override
 
void enableControl (QWidget *control, bool value)
 
void endAlternateAction (KoPointerEvent *event, AlternateAction action) override
 
virtual KisOptimizedBrushOutline getOutlinePath (const QPointF &documentPos, const KoPointerEvent *event, KisPaintOpSettings::OutlineMode outlineMode)
 
bool isEraser () const
 
bool isOutlineEnabled () const
 
bool isOutlineVisible () const
 
void paint (QPainter &gc, const KoViewConverter &converter) override
 
virtual QString quickHelp () const
 
virtual void requestUpdateOutline (const QPointF &outlineDocPoint, const KoPointerEvent *event)
 
void setMode (ToolMode mode) override
 
void setOutlineEnabled (bool enabled)
 
void setOutlineVisible (bool visible)
 
void setSupportOutline (bool supportOutline)
 
void showControl (QWidget *control, bool value)
 
- Protected Member Functions inherited from KisTool
bool blockUntilOperationsFinished ()
 
void blockUntilOperationsFinishedForced ()
 
QPointF convertDocumentToWidget (const QPointF &pt)
 
QPoint convertToImagePixelCoordFloored (KoPointerEvent *e)
 
QPointF convertToPixelCoord (const QPointF &pt)
 
QPointF convertToPixelCoord (KoPointerEvent *e)
 
QPointF convertToPixelCoordAndAlignOnWidget (const QPointF &pt)
 
QPointF convertToPixelCoordAndSnap (const QPointF &pt, const QPointF &offset=QPointF())
 
QPointF convertToPixelCoordAndSnap (KoPointerEvent *e, const QPointF &offset=QPointF(), bool useModifiers=true)
 
QRectF convertToPt (const QRectF &rect)
 
qreal convertToPt (qreal value)
 
KoColor currentBgColor ()
 
KoColor currentFgColor ()
 
KisFilterConfigurationSP currentGenerator ()
 
KoAbstractGradientSP currentGradient ()
 
KisImageWSP currentImage ()
 
KisNodeSP currentNode () const
 
KisPaintOpPresetSP currentPaintOpPreset ()
 
KoPatternSP currentPattern ()
 
QCursor cursor () const
 
KisImageWSP image () const
 
virtual bool listeningToModifiers ()
 
virtual void listenToModifiers (bool listen)
 
virtual ToolMode mode () const
 
bool nodeEditable ()
 Checks checks if the current node is editable.
 
bool overrideCursorIfNotEditable ()
 Override the cursor appropriately if current node is not editable.
 
void paintToolOutline (QPainter *painter, const KisOptimizedBrushOutline &path)
 
KisOptimizedBrushOutline pixelToView (const KisOptimizedBrushOutline &path) const
 
QPainterPath pixelToView (const QPainterPath &pixelPath) const
 Convert a pixel path into a view path.
 
QPointF pixelToView (const QPoint &pixelCoord) const
 
QPointF pixelToView (const QPointF &pixelCoord) const
 Convert a floating point pixel coordinate into a view coordinate.
 
QPolygonF pixelToView (const QPolygonF &pixelPolygon) const
 Convert a pixel polygon into a view path.
 
QRectF pixelToView (const QRectF &pixelRect) const
 Convert a pixel rectangle into a view rectangle.
 
KisNodeList selectedNodes () const
 
bool selectionEditable ()
 Checks checks if the selection is editable, only applies to local selection as global selection is always editable.
 
void setCursor (const QCursor &cursor)
 
void updateCanvasPixelRect (const QRectF &pixelRect)
 Update the canvas for the given rectangle in image pixel coordinates.
 
void updateCanvasViewRect (const QRectF &viewRect)
 Update the canvas for the given rectangle in view coordinates.
 
QPointF viewToPixel (const QPointF &viewCoord) const
 
QPointF widgetCenterInWidgetPixels ()
 
- Protected Member Functions inherited from KoToolBase
virtual QList< QPointer< QWidget > > createOptionWidgets ()
 
int grabSensitivity () const
 Convenience function to get the current grab sensitivity.
 
qreal handleDocRadius () const
 
QRectF handleGrabRect (const QPointF &position) const
 
QRectF handlePaintRect (const QPointF &position) const
 
int handleRadius () const
 Convenience function to get the current handle radius.
 
bool isActivated () const
 
 KoToolBase (KoToolBasePrivate &dd)
 
KoPointerEventlastDeliveredPointerEvent () const
 
void setAbstractResource (KoAbstractCanvasResourceInterfaceSP abstractResource)
 
void setConverter (KoDerivedResourceConverterSP converter)
 
void setIsOpacityPresetMode (bool value)
 
void setMaskSyntheticEvents (bool value)
 
void setTextMode (bool value)
 
QHash< int, KoAbstractCanvasResourceInterfaceSPtoolAbstractResources ()
 
QHash< int, KoDerivedResourceConverterSPtoolConverters ()
 
void useCursor (const QCursor &cursor)
 

Private Slots

void slot_angleSelectorPatternRotation_angleChanged (double value)
 
void slot_buttonContiguousFillBoundaryColor_changed (const KoColor &color)
 
void slot_buttonReset_clicked ()
 
void slot_buttonStopGrowingAtDarkestPixel_toggled (bool enabled)
 
void slot_checkBoxAntiAlias_toggled (bool checked)
 
void slot_checkBoxSelectionAsBoundary_toggled (bool checked)
 
void slot_checkBoxUseActiveLayer_toggled (bool checked)
 
void slot_checkBoxUseCustomBlendingOptions_toggled (bool checked)
 
void slot_colorSpaceChanged (const KoColorSpace *colorSpace)
 
void slot_comboBoxCustomCompositeOp_currentIndexChanged (int index)
 
void slot_currentNodeChanged (const KisNodeSP node)
 
void slot_optionButtonStripContiguousFillMode_buttonToggled (KoGroupButton *button, bool checked)
 
void slot_optionButtonStripDragFill_buttonToggled (KoGroupButton *button, bool checked)
 
void slot_optionButtonStripFillWith_buttonToggled (KoGroupButton *button, bool checked)
 
void slot_optionButtonStripReference_buttonToggled (KoGroupButton *button, bool checked)
 
void slot_optionButtonStripWhatToFill_buttonToggled (KoGroupButton *button, bool checked)
 
void slot_sliderCloseGap_valueChanged (int value)
 
void slot_sliderCustomOpacity_valueChanged (int value)
 
void slot_sliderFeather_valueChanged (int value)
 
void slot_sliderGrow_valueChanged (int value)
 
void slot_sliderPatternScale_valueChanged (double value)
 
void slot_sliderSpread_valueChanged (int value)
 
void slot_sliderThreshold_valueChanged (int value)
 
void slot_widgetLabels_selectionChanged ()
 

Private Member Functions

void addFillingOperation (const QPoint &seedPoint)
 
void addFillingOperation (const QVector< QPoint > &seedPoints)
 
void addUpdateOperation ()
 
void beginFilling (const QPoint &seedPoint)
 
void endFilling ()
 
void loadConfiguration ()
 
KoColor loadContiguousFillBoundaryColorFromConfig ()
 

Private Attributes

KisAngleSelectorm_angleSelectorPatternRotation {nullptr}
 
bool m_antiAlias {true}
 
KisColorButtonm_buttonContiguousFillBoundaryColor {nullptr}
 
KoGroupButtonm_buttonContiguousFillModeBoundaryFill {nullptr}
 
KoGroupButtonm_buttonContiguousFillModeFloodFill {nullptr}
 
KoGroupButtonm_buttonDragFillAny {nullptr}
 
KoGroupButtonm_buttonDragFillDoNotUse {nullptr}
 
KoGroupButtonm_buttonDragFillSimilar {nullptr}
 
KoGroupButtonm_buttonFillWithBG {nullptr}
 
KoGroupButtonm_buttonFillWithFG {nullptr}
 
KoGroupButtonm_buttonFillWithPattern {nullptr}
 
KoGroupButtonm_buttonReferenceAll {nullptr}
 
KoGroupButtonm_buttonReferenceCurrent {nullptr}
 
KoGroupButtonm_buttonReferenceLabeled {nullptr}
 
QToolButton * m_buttonStopGrowingAtDarkestPixel {nullptr}
 
KoGroupButtonm_buttonWhatToFillContiguous {nullptr}
 
KoGroupButtonm_buttonWhatToFillSelection {nullptr}
 
KoGroupButtonm_buttonWhatToFillSimilar {nullptr}
 
QCheckBox * m_checkBoxAntiAlias {nullptr}
 
QCheckBox * m_checkBoxCustomBlendingOptions {nullptr}
 
QCheckBox * m_checkBoxSelectionAsBoundary {nullptr}
 
QCheckBox * m_checkBoxUseActiveLayer {nullptr}
 
int m_closeGap {0}
 
KisCompositeOpComboBoxm_comboBoxCustomCompositeOp {nullptr}
 
KisSignalCompressor m_compressorFillUpdate
 
KConfigGroup m_configGroup
 
KoColor m_contiguousFillBoundaryColor
 
ContiguousFillMode m_contiguousFillMode {ContiguousFillMode_FloodFill}
 
ContinuousFillMode m_continuousFillMode {ContinuousFillMode_FillAnyRegion}
 
QString m_customCompositeOp {COMPOSITE_OVER}
 
int m_customOpacity {100}
 
QSharedPointer< QRect > m_dirtyRect
 
FillMode m_effectiveFillMode {FillMode_FillSelection}
 
int m_feather {0}
 
KisSelectionSP m_fillMask
 
FillMode m_fillMode {FillMode_FillContiguousRegion}
 
QPoint m_fillStartWidgetPosition
 
KisStrokeId m_fillStrokeId
 
FillType m_fillType {FillType_FillWithForegroundColor}
 
bool m_isDragging {false}
 
bool m_isFilling {false}
 
int m_opacitySpread {100}
 
KisOptionCollectionWidgetm_optionWidget {nullptr}
 
qreal m_patternRotation {0.0}
 
qreal m_patternScale {100.0}
 
KisNodeSP m_previousNode {nullptr}
 
int m_previousTime
 
Reference m_reference {Reference_CurrentLayer}
 
QSharedPointer< KoColorm_referenceColor
 
KisMergeLabeledLayersCommand::ReferenceNodeInfoListSP m_referenceNodeList
 
KisPaintDeviceSP m_referencePaintDevice
 
KisResourcesSnapshotSP m_resourcesSnapshot
 
QVector< QPoint > m_seedPoints
 
QList< int > m_selectedColorLabels
 
int m_sizemod {0}
 
KisSliderSpinBoxm_sliderCloseGap {nullptr}
 
KisSliderSpinBoxm_sliderCustomOpacity {nullptr}
 
KisSliderSpinBoxm_sliderFeather {nullptr}
 
KisSliderSpinBoxm_sliderGrow {nullptr}
 
KisDoubleSliderSpinBoxm_sliderPatternScale {nullptr}
 
KisSliderSpinBoxm_sliderSpread {nullptr}
 
KisSliderSpinBoxm_sliderThreshold {nullptr}
 
int m_stopGrowingAtDarkestPixel {false}
 
int m_threshold {8}
 
QTransform m_transform
 
bool m_useActiveLayer {false}
 
bool m_useCustomBlendingOptions {false}
 
bool m_useSelectionAsBoundary {true}
 
KisColorLabelSelectorWidgetm_widgetLabels {nullptr}
 

Static Private Attributes

static constexpr int minimumDragDistance {4}
 
static constexpr int minimumDragDistanceSquared {minimumDragDistance * minimumDragDistance}
 

Additional Inherited Members

- Signals inherited from KisToolPaint
void sigPaintingFinished ()
 
- Signals inherited from KisTool
void isActiveChanged (bool isActivated)
 
- Signals inherited from KoToolBase
void activateTool (const QString &id)
 
void cursorChanged (const QCursor &cursor)
 
void selectionChanged (bool hasSelection)
 
void statusTextChanged (const QString &statusText)
 
void textModeChanged (bool inTextMode)
 
- Static Public Member Functions inherited from KisTool
static AlternateAction actionToAlternateAction (ToolAction action)
 
- Public Attributes inherited from KisTool
KoColor currentBgColor
 
float currentExposure {1.0}
 
KoColor currentFgColor
 
KisFilterConfigurationSP currentGenerator
 
KoAbstractGradientSP currentGradient
 
KoPatternSP currentPattern
 
QCursor cursor
 
bool m_isActive {false}
 
ToolMode m_mode {HOVER_MODE}
 
QWidget * optionWidget {0}
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 
- Protected Types inherited from KisTool
enum  ToolMode : int {
  HOVER_MODE , PAINT_MODE , SECONDARY_PAINT_MODE , MIRROR_AXIS_SETUP_MODE ,
  GESTURE_MODE , PAN_MODE , OTHER , OTHER_1
}
 
- Protected Attributes inherited from KisToolPaint
KisOptimizedBrushOutline m_currentOutline
 
QRectF m_oldColorPreviewUpdateRect
 
QRectF m_oldOutlineRect
 
QPointF m_outlineDocPoint
 
bool m_paintOutline {false}
 
- Protected Attributes inherited from KoToolBase
KoToolBasePrivated_ptr
 
- Properties inherited from KisTool
bool isActive
 

Detailed Description

Definition at line 40 of file kis_tool_fill.h.

Member Enumeration Documentation

◆ ContiguousFillMode

Enumerator
ContiguousFillMode_FloodFill 
ContiguousFillMode_BoundaryFill 

Definition at line 59 of file kis_tool_fill.h.

◆ ContinuousFillMode

Enumerator
ContinuousFillMode_DoNotUse 
ContinuousFillMode_FillAnyRegion 
ContinuousFillMode_FillSimilarRegions 

Definition at line 72 of file kis_tool_fill.h.

◆ FillMode

Enumerator
FillMode_FillSelection 
FillMode_FillContiguousRegion 
FillMode_FillSimilarRegions 

Definition at line 45 of file kis_tool_fill.h.

◆ FillType

Enumerator
FillType_FillWithForegroundColor 
FillType_FillWithBackgroundColor 
FillType_FillWithPattern 

Definition at line 52 of file kis_tool_fill.h.

◆ Reference

Enumerator
Reference_CurrentLayer 
Reference_AllLayers 
Reference_ColorLabeledLayers 

Definition at line 65 of file kis_tool_fill.h.

Constructor & Destructor Documentation

◆ KisToolFill()

KisToolFill::KisToolFill ( KoCanvasBase * canvas)

Definition at line 67 of file kis_tool_fill.cc.

68 : KisToolPaint(canvas, KisCursor::load("tool_fill_cursor.png", 6, 6))
69 , m_fillMask(nullptr)
70 , m_referencePaintDevice(nullptr)
71 , m_referenceNodeList(nullptr)
74 , m_dirtyRect(nullptr)
75 , m_fillStrokeId(nullptr)
76{
77 setObjectName("tool_fill");
78 connect(&m_compressorFillUpdate, SIGNAL(timeout()), SLOT(slotUpdateFill()));
79
80 KisCanvas2 *kritaCanvas = dynamic_cast<KisCanvas2*>(canvas);
81
82 connect(kritaCanvas->viewManager()->canvasResourceProvider(), SIGNAL(sigEffectiveCompositeOpChanged()), SLOT(resetCursorStyle()));
83}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisViewManager * viewManager() const
static QCursor load(const QString &cursorName, int hotspotX=-1, int hotspotY=-1)
KisSignalCompressor m_compressorFillUpdate
void resetCursorStyle() override
KisStrokeId m_fillStrokeId
KisSelectionSP m_fillMask
void slotUpdateFill()
KisPaintDeviceSP m_referencePaintDevice
QSharedPointer< QRect > m_dirtyRect
KisMergeLabeledLayersCommand::ReferenceNodeInfoListSP m_referenceNodeList
KisToolPaint(KoCanvasBase *canvas, const QCursor &cursor)
KisCanvasResourceProvider * canvasResourceProvider()
KisCanvas2 * canvas

References Private::canvas, KisViewManager::canvasResourceProvider(), connect(), m_compressorFillUpdate, resetCursorStyle(), slotUpdateFill(), and KisCanvas2::viewManager().

◆ ~KisToolFill()

KisToolFill::~KisToolFill ( )
override

Definition at line 85 of file kis_tool_fill.cc.

86{
87}

Member Function Documentation

◆ activate

void KisToolFill::activate ( const QSet< KoShape * > & shapes)
overrideslot

Definition at line 100 of file kis_tool_fill.cc.

101{
103 m_configGroup = KSharedConfig::openConfig()->group(toolId());
104 KisCanvas2 *kisCanvas = static_cast<KisCanvas2*>(canvas());
105 KisCanvasResourceProvider *resourceProvider = kisCanvas->viewManager()->canvasResourceProvider();
106 if (resourceProvider) {
107 connect(resourceProvider,
108 SIGNAL(sigNodeChanged(const KisNodeSP)),
109 this,
112 }
113}
KConfigGroup m_configGroup
void slot_currentNodeChanged(const KisNodeSP node)
void activate(const QSet< KoShape * > &shapes) override
Q_INVOKABLE QString toolId() const
KisNodeSP currentNode() const
Definition kis_tool.cc:370

References KisToolPaint::activate(), Private::canvas, KisViewManager::canvasResourceProvider(), connect(), KisTool::currentNode(), m_configGroup, slot_currentNodeChanged(), KoToolBase::toolId(), and KisCanvas2::viewManager().

◆ addFillingOperation() [1/2]

void KisToolFill::addFillingOperation ( const QPoint & seedPoint)
private

Definition at line 342 of file kis_tool_fill.cc.

343{
344 const QVector<QPoint> seedPoints({seedPoint});
345 addFillingOperation(seedPoints);
346}
void addFillingOperation(const QPoint &seedPoint)

References addFillingOperation().

◆ addFillingOperation() [2/2]

void KisToolFill::addFillingOperation ( const QVector< QPoint > & seedPoints)
private

Definition at line 348 of file kis_tool_fill.cc.

349{
351
352 const qreal customOpacity = m_customOpacity / 100.0;
353
358
359 const bool blendingOptionsAreNoOp = m_useCustomBlendingOptions
360 ? (qFuzzyCompare(customOpacity, OPACITY_OPAQUE_F) &&
362 : (qFuzzyCompare(m_resourcesSnapshot->opacity(), OPACITY_OPAQUE_F) &&
363 m_resourcesSnapshot->compositeOpId() == COMPOSITE_OVER);
364
365 const bool useFastMode = !m_resourcesSnapshot->activeSelection() &&
366 blendingOptionsAreNoOp &&
368 m_opacitySpread == 100 &&
369 m_useSelectionAsBoundary == false &&
370 !m_antiAlias && m_sizemod == 0 && m_feather == 0 &&
371 m_closeGap == 0 &&
373
374 visitor->setSeedPoints(seedPoints);
375 visitor->setUseFastMode(useFastMode);
381 visitor->setCustomOpacity(customOpacity);
383 }
384 visitor->setRegionFillingMode(
387 : KisFillPainter::RegionFillingMode_BoundaryFill
388 );
391 }
394 visitor->setCloseGap(m_closeGap);
396 visitor->setAntiAlias(m_antiAlias);
397 visitor->setSizeMod(m_sizemod);
399 visitor->setFeather(m_feather);
400 if (m_isDragging) {
401 visitor->setContinuousFillMode(
405 );
408 }
410
411 image()->addJob(
415 false,
418 )
419 );
420 } else {
421 KisSelectionSP fillMask = m_fillMask;
424
425 {
427 KisFillPainter painter;
428 QRect bounds = currentImage()->bounds();
429 if (selection) {
430 bounds = bounds.intersected(selection->projection()->selectedRect());
431 }
432
435 painter.setAntiAlias(m_antiAlias);
436 painter.setSizemod(m_sizemod);
438 painter.setFeather(m_feather);
439
443 bounds, selection ? selection->projection() : nullptr, progressHelper
444 );
445
446 for (KisStrokeJobData *job : jobs) {
447 image()->addJob(m_fillStrokeId, job);
448 }
449 }
450
451 {
452 FillProcessingVisitor *visitor = new FillProcessingVisitor(nullptr,
453 fillMask,
455
456 visitor->setSeedPoints(seedPoints);
457 visitor->setSelectionOnly(true);
462 visitor->setCustomOpacity(customOpacity);
464 }
466 visitor->setProgressHelper(progressHelper);
467
468 image()->addJob(
472 false,
475 )
476 );
477 }
478 }
479}
const qreal OPACITY_OPAQUE_F
const QString COMPOSITE_OVER
void setOutDirtyRect(QSharedPointer< QRect > outDirtyRect)
void setSeedPoints(const QVector< QPoint > &seedPoints)
void setStopGrowingAtDarkestPixel(bool stopGrowingAtDarkestPixel)
void setUseFastMode(bool useFastMode)
void setUseCustomBlendingOptions(bool useCustomBlendingOptions)
void setCustomCompositeOp(const QString &customCompositeOp)
void setProgressHelper(QSharedPointer< ProgressHelper > progressHelper)
void setOpacitySpread(int opacitySpread)
void setAntiAlias(bool antiAlias)
void setSelectionOnly(bool selectionOnly)
void setUseBgColor(bool useBgColor)
void setContinuousFillMask(KisSelectionSP continuousFillMask)
void setFillThreshold(int fillThreshold)
void setRegionFillingBoundaryColor(const KoColor &regionFillingBoundaryColor)
void setUsePattern(bool usePattern)
void setCustomOpacity(qreal customOpacity)
void setContinuousFillReferenceColor(const QSharedPointer< KoColor > continuousFillReferenceColor)
void setRegionFillingMode(KisFillPainter::RegionFillingMode regionFillingMode)
void setContinuousFillMode(ContinuousFillMode continuousFillMode)
void setUseSelectionAsBoundary(bool useSelectionAsBoundary)
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)
void addJob(KisStrokeId id, KisStrokeJobData *data) override
QRect bounds() const override
KisSelectionSP activeSelection() const
int m_stopGrowingAtDarkestPixel
QString m_customCompositeOp
QSharedPointer< KoColor > m_referenceColor
FillType m_fillType
KoColor m_contiguousFillBoundaryColor
Reference m_reference
KisResourcesSnapshotSP m_resourcesSnapshot
FillMode m_effectiveFillMode
ContiguousFillMode m_contiguousFillMode
bool m_useSelectionAsBoundary
bool m_useCustomBlendingOptions
ContinuousFillMode m_continuousFillMode
virtual KoToolSelection * selection()
static bool qFuzzyCompare(half p1, half p2)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define bounds(x, a, b)
QSharedPointer< KUndo2Command > KUndo2CommandSP
Definition kis_types.h:262
KisPixelSelectionSP pixelSelection
KisImageWSP currentImage()
Definition kis_tool.cc:393
KisImageWSP image() const
Definition kis_tool.cc:332

References KisResourcesSnapshot::activeSelection(), KisImage::addJob(), KisImage::bounds(), bounds, COMPOSITE_OVER, KisResourcesSnapshot::compositeOpId(), ContiguousFillMode_BoundaryFill, ContiguousFillMode_FloodFill, FillProcessingVisitor::ContinuousFillMode_FillAnyRegion, ContinuousFillMode_FillAnyRegion, FillProcessingVisitor::ContinuousFillMode_FillSimilarRegions, KisFillPainter::createSimilarColorsSelectionJobs(), KisTool::currentImage(), KisTool::currentNode(), KisStrokeJobData::EXCLUSIVE, FillMode_FillSelection, FillMode_FillSimilarRegions, FillType_FillWithBackgroundColor, FillType_FillWithPattern, KisTool::image(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_antiAlias, m_closeGap, m_contiguousFillBoundaryColor, m_contiguousFillMode, m_continuousFillMode, m_customCompositeOp, m_customOpacity, m_dirtyRect, m_effectiveFillMode, m_feather, m_fillMask, m_fillStrokeId, m_fillType, m_isDragging, m_opacitySpread, m_reference, m_referenceColor, m_referencePaintDevice, m_resourcesSnapshot, m_sizemod, m_stopGrowingAtDarkestPixel, m_threshold, m_useCustomBlendingOptions, m_useSelectionAsBoundary, KisResourcesSnapshot::opacity(), OPACITY_OPAQUE_F, KisSelection::pixelSelection, qFuzzyCompare(), Reference_CurrentLayer, KisFillPainter::RegionFillingMode_BoundaryFill, KisFillPainter::RegionFillingMode_FloodFill, KoToolBase::selection(), KisStrokeJobData::SEQUENTIAL, KisFillPainter::setAntiAlias(), FillProcessingVisitor::setAntiAlias(), FillProcessingVisitor::setCloseGap(), FillProcessingVisitor::setContinuousFillMask(), FillProcessingVisitor::setContinuousFillMode(), FillProcessingVisitor::setContinuousFillReferenceColor(), FillProcessingVisitor::setCustomCompositeOp(), FillProcessingVisitor::setCustomOpacity(), KisFillPainter::setFeather(), FillProcessingVisitor::setFeather(), FillProcessingVisitor::setFillThreshold(), KisFillPainter::setFillThreshold(), KisFillPainter::setOpacitySpread(), FillProcessingVisitor::setOpacitySpread(), FillProcessingVisitor::setOutDirtyRect(), FillProcessingVisitor::setProgressHelper(), FillProcessingVisitor::setRegionFillingBoundaryColor(), FillProcessingVisitor::setRegionFillingMode(), FillProcessingVisitor::setSeedPoints(), FillProcessingVisitor::setSelectionOnly(), KisFillPainter::setSizemod(), FillProcessingVisitor::setSizeMod(), KisFillPainter::setStopGrowingAtDarkestPixel(), FillProcessingVisitor::setStopGrowingAtDarkestPixel(), FillProcessingVisitor::setUseBgColor(), FillProcessingVisitor::setUseCustomBlendingOptions(), FillProcessingVisitor::setUseFastMode(), FillProcessingVisitor::setUsePattern(), and FillProcessingVisitor::setUseSelectionAsBoundary().

◆ addUpdateOperation()

◆ beginAlternateAction()

void KisToolFill::beginAlternateAction ( KoPointerEvent * event,
AlternateAction action )
overridevirtual

Reimplemented from KisTool.

Definition at line 220 of file kis_tool_fill.cc.

221{
222 if (action == ChangeSize) {
223 beginPrimaryAction(event);
224 return;
225 }
227}
void beginPrimaryAction(KoPointerEvent *event) override
void beginAlternateAction(KoPointerEvent *event, AlternateAction action) override
QAction * action(const QString &name) const
@ ChangeSize
Definition kis_tool.h:135

References KoToolBase::action(), KisToolPaint::beginAlternateAction(), beginPrimaryAction(), and KisTool::ChangeSize.

◆ beginFilling()

void KisToolFill::beginFilling ( const QPoint & seedPoint)
private

Definition at line 247 of file kis_tool_fill.cc.

248{
250
252 new KisStrokeStrategyUndoCommandBased(kundo2_i18n("Flood Fill"), false, image().data());
253 strategy->setSupportsWrapAroundMode(true);
254 m_fillStrokeId = image()->startStroke(strategy);
256
257 m_resourcesSnapshot = new KisResourcesSnapshot(image(), currentNode(), this->canvas()->resourceManager());
258
259 KisPaintDeviceSP referencePaintDevice = nullptr;
262 referencePaintDevice = currentNode()->paintDevice();
263 } else if (m_reference == Reference_AllLayers) {
264 referencePaintDevice = currentImage()->projection();
266 if (!m_referenceNodeList) {
267 referencePaintDevice = KisMergeLabeledLayersCommand::createRefPaintDevice(image(), "Fill Tool Reference Result Paint Device");
269 } else {
270 referencePaintDevice = m_referencePaintDevice;
271 }
272 KisPaintDeviceSP newReferencePaintDevice = KisMergeLabeledLayersCommand::createRefPaintDevice(image(), "Fill Tool Reference Result Paint Device");
274 const int currentTime = image()->animationInterface()->currentTime();
275 image()->addJob(
279 image(),
281 newReferenceNodeList,
282 referencePaintDevice,
283 newReferencePaintDevice,
286 m_previousTime != currentTime,
287 m_useActiveLayer ? currentNode() : nullptr
288 )),
289 false,
290 KisStrokeJobData::SEQUENTIAL,
291 KisStrokeJobData::EXCLUSIVE
292 )
293 );
294 referencePaintDevice = newReferencePaintDevice;
295 m_referenceNodeList = newReferenceNodeList;
296 m_previousTime = currentTime;
297 }
298
299 QSharedPointer<KoColor> referenceColor(new KoColor);
301 // We need to obtain the reference color from the reference paint
302 // device, but it is produced in a stroke, so we must get the color
303 // after the device is ready. So we get it in the stroke
304 image()->addJob(
308 [referencePaintDevice, referenceColor, seedPoint]() -> KUndo2Command*
309 {
310 *referenceColor = referencePaintDevice->pixel(seedPoint);
311 return 0;
312 }
313 )),
314 false,
317 )
318 );
319 } else {
320 // Here the reference device is already ready, so we obtain the
321 // reference color directly
322 *referenceColor = referencePaintDevice->pixel(seedPoint);
323 // Reset this so that the device from color labeled layers gets
324 // regenerated when that mode is selected again
325 m_referenceNodeList.reset();
326 }
327
328 m_referencePaintDevice = referencePaintDevice;
329 m_referenceColor = referenceColor;
330
332 }
333
334 m_dirtyRect.reset(new QRect);
335 m_transform.reset();
337 const qreal normalizedScale = m_patternScale * 0.01;
338 m_transform.scale(normalizedScale, normalizedScale);
340}
KisImageAnimationInterface * animationInterface() const
KisPaintDeviceSP projection() const
KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override
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 ...
bool pixel(qint32 x, qint32 y, QColor *c) const
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
void setFillTransform(QTransform transform)
qreal m_patternRotation
bool m_useActiveLayer
QList< int > m_selectedColorLabels
QTransform m_transform
qreal m_patternScale
void setMode(ToolMode mode) override
KUndo2MagicString kundo2_i18n(const char *text)
virtual KisPaintDeviceSP paintDevice() const =0
The LambdaCommand struct is a shorthand for creation of AggregateCommand commands using C++ lambda fe...
@ PAINT_MODE
Definition kis_tool.h:300

References KisImage::addJob(), KisImage::animationInterface(), Private::canvas, KisMergeLabeledLayersCommand::createRefPaintDevice(), KisTool::currentImage(), KisTool::currentNode(), KisImageAnimationInterface::currentTime(), KisStrokeJobData::EXCLUSIVE, FillMode_FillSelection, KisMergeLabeledLayersCommand::GroupSelectionPolicy_SelectIfColorLabeled, KisTool::image(), KIS_SAFE_ASSERT_RECOVER_RETURN, kundo2_i18n(), m_dirtyRect, m_effectiveFillMode, m_fillMask, m_fillStrokeId, m_patternRotation, m_patternScale, m_previousTime, m_reference, m_referenceColor, m_referenceNodeList, m_referencePaintDevice, m_resourcesSnapshot, m_selectedColorLabels, m_transform, m_useActiveLayer, KisTool::PAINT_MODE, KisBaseNode::paintDevice(), KisPaintDevice::pixel(), KisImage::projection(), Reference_AllLayers, Reference_ColorLabeledLayers, Reference_CurrentLayer, KisStrokeJobData::SEQUENTIAL, KisResourcesSnapshot::setFillTransform(), KisToolPaint::setMode(), KisStrokeStrategyUndoCommandBased::setSupportsWrapAroundMode(), and KisImage::startStroke().

◆ beginPrimaryAction()

void KisToolFill::beginPrimaryAction ( KoPointerEvent * event)
overridevirtual

Called by KisToolProxy when a primary action for the tool is started. The event stores the original event that started the stroke. The event is accepted by default. If the tool decides to ignore this particular action (e.g. when the node is not editable), it should call event->ignore(). Then no further continuePrimaryAction() or endPrimaryAction() will be called until the next user action.

Reimplemented from KisTool.

Definition at line 131 of file kis_tool_fill.cc.

132{
133 // cannot use fill tool on non-painting layers.
134 // this logic triggers with multiple layer types like vector layer, clone layer, file layer, group layer
135 if (currentNode().isNull() || currentNode()->inherits("KisShapeLayer") || nodePaintAbility()!=NodePaintAbility::PAINT ) {
136 KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(canvas());
137 kiscanvas->viewManager()->
138 showFloatingMessage(
139 i18n("You cannot use this tool with the selected layer type"),
140 QIcon(), 2000, KisFloatingMessage::Medium, Qt::AlignCenter);
141 event->ignore();
142 return;
143 }
144
145 if (!nodeEditable()) {
146 event->ignore();
147 return;
148 }
149
150 m_fillStartWidgetPosition = event->pos();
151 const QPoint lastImagePosition = convertToImagePixelCoordFloored(event);
152
153 if (!currentNode() ||
154 (!image()->wrapAroundModePermitted() &&
155 !image()->bounds().contains(lastImagePosition))) {
156 return;
157 }
158
159 // Switch the fill mode if shift or alt modifiers are pressed
160 if (event->modifiers() == Qt::ShiftModifier) {
163 } else {
165 }
166 } else if (event->modifiers() == Qt::AltModifier) {
169 } else {
171 }
172 } else {
174 }
175
176 m_seedPoints.append(lastImagePosition);
177 beginFilling(lastImagePosition);
178 m_isFilling = true;
179
181}
QPoint m_fillStartWidgetPosition
QVector< QPoint > m_seedPoints
void beginFilling(const QPoint &seedPoint)
FillMode m_fillMode
Qt::KeyboardModifiers modifiers() const
KisTool::NodePaintAbility nodePaintAbility()
Definition kis_tool.cc:539
bool nodeEditable()
Checks checks if the current node is editable.
Definition kis_tool.cc:651
QPoint convertToImagePixelCoordFloored(KoPointerEvent *e)
Definition kis_tool.cc:236

References beginFilling(), bounds, Private::canvas, KisTool::convertToImagePixelCoordFloored(), KisTool::currentNode(), FillMode_FillContiguousRegion, FillMode_FillSelection, FillMode_FillSimilarRegions, KisTool::image(), m_effectiveFillMode, m_fillMode, m_fillStartWidgetPosition, m_isFilling, m_seedPoints, KisFloatingMessage::Medium, KoPointerEvent::modifiers(), KisTool::nodeEditable(), KisTool::nodePaintAbility(), KisTool::PAINT, slotUpdateFill(), and KisCanvas2::viewManager().

◆ continueAlternateAction()

void KisToolFill::continueAlternateAction ( KoPointerEvent * event,
AlternateAction action )
overridevirtual

Reimplemented from KisTool.

Definition at line 229 of file kis_tool_fill.cc.

230{
231 if (action == ChangeSize) {
233 return;
234 }
236}
void continuePrimaryAction(KoPointerEvent *event) override
void continueAlternateAction(KoPointerEvent *event, AlternateAction action) override

References KoToolBase::action(), KisTool::ChangeSize, KisToolPaint::continueAlternateAction(), and continuePrimaryAction().

◆ continuePrimaryAction()

void KisToolFill::continuePrimaryAction ( KoPointerEvent * event)
overridevirtual

Called by KisToolProxy when the primary action is in progress of pointer movement. If the tool has ignored the event in beginPrimaryAction(), this method will not be called.

Reimplemented from KisTool.

Definition at line 183 of file kis_tool_fill.cc.

184{
187 return;
188 }
189
190 if (!m_isDragging) {
191 const int dragDistanceSquared =
192 pow2(event->pos().x() - m_fillStartWidgetPosition.x()) +
193 pow2(event->pos().y() - m_fillStartWidgetPosition.y());
194
195 if (dragDistanceSquared < minimumDragDistanceSquared) {
196 return;
197 }
198
199 m_isDragging = true;
200 }
201
202 const QPoint newImagePosition = convertToImagePixelCoordFloored(event);
203 m_seedPoints.append(newImagePosition);
204
206}
static constexpr int minimumDragDistanceSquared
QPoint pos() const
return the position in widget coordinates
T pow2(const T &x)
Definition kis_global.h:166

References ContinuousFillMode_DoNotUse, KisTool::convertToImagePixelCoordFloored(), FillMode_FillContiguousRegion, m_compressorFillUpdate, m_continuousFillMode, m_effectiveFillMode, m_fillStartWidgetPosition, m_isDragging, m_isFilling, m_seedPoints, minimumDragDistanceSquared, KoPointerEvent::pos(), pow2(), and KisSignalCompressor::start().

◆ createOptionWidget()

QWidget * KisToolFill::createOptionWidget ( )
overridevirtual

Reimplement this if your tool actually has an option widget. Sets the option widget to 0 by default.

Reimplemented from KisTool.

Definition at line 522 of file kis_tool_fill.cc.

523{
525
526 // Create widgets
527 KisOptionButtonStrip *optionButtonStripWhatToFill =
529 m_buttonWhatToFillSelection = optionButtonStripWhatToFill->addButton(
530 KisIconUtils::loadIcon("tool_outline_selection"));
531 m_buttonWhatToFillContiguous = optionButtonStripWhatToFill->addButton(
532 KisIconUtils::loadIcon("contiguous-selection"));
533 m_buttonWhatToFillSimilar = optionButtonStripWhatToFill->addButton(
534 KisIconUtils::loadIcon("similar-selection"));
535 m_buttonWhatToFillContiguous->setChecked(true);
536
537 KisOptionButtonStrip *optionButtonStripFillWith = new KisOptionButtonStrip;
538 m_buttonFillWithFG = optionButtonStripFillWith->addButton(
539 KisIconUtils::loadIcon("object-order-lower-calligra"));
540 m_buttonFillWithBG = optionButtonStripFillWith->addButton(
541 KisIconUtils::loadIcon("object-order-raise-calligra"));
543 optionButtonStripFillWith->addButton(KisIconUtils::loadIcon("pattern"));
544 m_buttonFillWithFG->setChecked(true);
546 m_sliderPatternScale->setRange(0, 10000, 2);
550 i18nc("The pattern 'scale' spinbox in fill tool options; {n} is the number value, % is the percent sign",
551 "Scale: {n}%"));
555 m_checkBoxCustomBlendingOptions = new QCheckBox(i18n("Use custom blending options"));
559 i18nc("{n} is the number value, % is the percent sign", "Opacity: {n}%"));
561
562 KisOptionButtonStrip *optionButtonStripContiguousFillMode = new KisOptionButtonStrip;
563 m_buttonContiguousFillModeFloodFill = optionButtonStripContiguousFillMode->addButton(
564 KisIconUtils::loadIcon("region-filling-flood-fill"));
565 m_buttonContiguousFillModeBoundaryFill = optionButtonStripContiguousFillMode->addButton(
566 KisIconUtils::loadIcon("region-filling-boundary-fill"));
567 m_buttonContiguousFillModeFloodFill->setChecked(true);
570 m_sliderThreshold->setPrefix(i18nc("The 'threshold' spinbox prefix in fill tool options", "Threshold: "));
573 m_sliderSpread->setRange(0, 100);
576 i18nc("The 'spread' spinbox in fill tool options; {n} is the number value, % is the percent sign",
577 "Spread: {n}%"));
578
580 m_sliderCloseGap->setPrefix(i18nc("The 'close gap' spinbox prefix in fill tool options", "Close Gap: "));
582 m_sliderCloseGap->setSuffix(i18n(" px"));
583
585 new QCheckBox(
586 i18nc("The 'use selection as boundary' checkbox in fill tool to use selection borders as boundary when filling",
587 "Use selection as boundary")
588 );
589 m_checkBoxSelectionAsBoundary->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
590
591 m_checkBoxAntiAlias = new QCheckBox(i18nc("The anti-alias checkbox in fill tool options", "Anti-aliasing"));
592
595 m_sliderGrow->setPrefix(i18nc("The 'grow/shrink' spinbox prefix in fill tool options", "Grow: "));
596 m_sliderGrow->setRange(-400, 400);
597 m_sliderGrow->setSoftRange(-40, 40);
598 m_sliderGrow->setSuffix(i18n(" px"));
599 m_buttonStopGrowingAtDarkestPixel = new QToolButton;
600 m_buttonStopGrowingAtDarkestPixel->setAutoRaise(true);
601 m_buttonStopGrowingAtDarkestPixel->setCheckable(true);
602 m_buttonStopGrowingAtDarkestPixel->setIcon(KisIconUtils::loadIcon("stop-at-boundary"));
603 containerGrow->appendWidget("sliderGrow", m_sliderGrow);
604 containerGrow->appendWidget("buttonStopGrowingAtDarkestPixel", m_buttonStopGrowingAtDarkestPixel);
605 containerGrow->setOrientation(Qt::Horizontal);
607 m_sliderFeather->setPrefix(i18nc("The 'feather' spinbox prefix in fill tool options", "Feather: "));
608 m_sliderFeather->setRange(0, 400);
610 m_sliderFeather->setSuffix(i18n(" px"));
611
612 KisOptionButtonStrip *optionButtonStripReference = new KisOptionButtonStrip;
613 m_buttonReferenceCurrent = optionButtonStripReference->addButton(
614 KisIconUtils::loadIcon("current-layer"));
615 m_buttonReferenceAll = optionButtonStripReference->addButton(
616 KisIconUtils::loadIcon("all-layers"));
618 optionButtonStripReference->addButton(KisIconUtils::loadIcon("tag"));
619 m_buttonReferenceCurrent->setChecked(true);
625 m_checkBoxUseActiveLayer = new QCheckBox(i18n("Use active layer"));
626
627 KisOptionButtonStrip *optionButtonStripDragFill =
629 m_buttonDragFillDoNotUse = optionButtonStripDragFill->addButton(
630 KisIconUtils::loadIcon("dialog-cancel"));
631 m_buttonDragFillAny = optionButtonStripDragFill->addButton(
632 KisIconUtils::loadIcon("different-regions"));
633 m_buttonDragFillSimilar = optionButtonStripDragFill->addButton(
634 KisIconUtils::loadIcon("similar-regions"));
635 m_buttonDragFillAny->setChecked(true);
636
637 QPushButton *buttonReset = new QPushButton(i18nc("The 'reset' button in fill tool options", "Reset"));
638
639 // Set the tooltips
640 m_buttonWhatToFillSelection->setToolTip(i18n("Fill the active selection, or the entire canvas"));
641 m_buttonWhatToFillContiguous->setToolTip(i18n("Fill a contiguous region"));
642 m_buttonWhatToFillSimilar->setToolTip(i18n("Fill all regions of a similar color"));
643
644 m_buttonFillWithFG->setToolTip(i18n("Foreground color"));
645 m_buttonFillWithBG->setToolTip(i18n("Background color"));
646 m_buttonFillWithPattern->setToolTip(i18n("Pattern"));
647 m_sliderPatternScale->setToolTip(i18n("Set the scale of the pattern"));
648 m_angleSelectorPatternRotation->setToolTip(i18n("Set the rotation of the pattern"));
649 m_checkBoxCustomBlendingOptions->setToolTip(i18n("Set custom blending options instead of using the brush ones"));
650 m_sliderCustomOpacity->setToolTip(i18n("Set a custom opacity for the fill"));
651 m_comboBoxCustomCompositeOp->setToolTip(i18n("Set a custom blend mode for the fill"));
652
653 m_buttonContiguousFillModeFloodFill->setToolTip(i18n("Fill regions similar in color to the clicked region"));
654 m_buttonContiguousFillModeBoundaryFill->setToolTip(i18n("Fill all regions until a specific boundary color"));
655 m_buttonContiguousFillBoundaryColor->setToolTip(i18n("Boundary color"));
656 m_sliderThreshold->setToolTip(i18n("Set the color similarity tolerance of the fill. Increasing threshold increases the range of similar colors to be filled."));
657 m_sliderSpread->setToolTip(i18n("Set the extent of the opaque portion of the fill. Decreasing spread decreases opacity of fill areas depending on color similarity."));
658 m_sliderCloseGap->setToolTip(i18n("Close gaps in lines up to the set amount"));
659 m_checkBoxSelectionAsBoundary->setToolTip(i18n("Set if the contour of the active selection should be treated as a boundary when filling the region"));
660
661 m_checkBoxAntiAlias->setToolTip(i18n("Smooths the edges of the fill"));
662 m_sliderGrow->setToolTip(i18n("Grow or shrink the fill by the set amount"));
663 m_buttonStopGrowingAtDarkestPixel->setToolTip(i18n("Stop growing at the darkest and/or most opaque pixels"));
664 m_sliderFeather->setToolTip(i18n("Blur the fill by the set amount"));
665
666 m_buttonReferenceCurrent->setToolTip(i18n("Fill regions found from the active layer"));
667 m_buttonReferenceAll->setToolTip(i18n("Fill regions found from the merging of all layers"));
668 m_buttonReferenceLabeled->setToolTip(i18n("Fill regions found from the merging of layers with specific color labels"));
669 m_checkBoxUseActiveLayer->setToolTip(i18n("Includes the active layer in regions found from merging of layers with specific color labels"));
670
671 m_buttonDragFillDoNotUse->setToolTip(i18n("Dragging will not fill different regions"));
672 m_buttonDragFillAny->setToolTip(i18n("Dragging will fill regions of any color"));
673 m_buttonDragFillSimilar->setToolTip(i18n("Dragging will fill only regions similar in color to the initial region (useful for filling line-art)"));
674
675 buttonReset->setToolTip(i18n("Reset the options to their default values"));
676
677 // Construct the option widget
679 m_optionWidget->setContentsMargins(0, 10, 0, 10);
681
682 KisOptionCollectionWidgetWithHeader *sectionWhatToFill =
684 i18nc("The 'fill mode' section label in fill tool options", "Fill mode")
685 );
686 sectionWhatToFill->setPrimaryWidget(optionButtonStripWhatToFill);
687 m_optionWidget->appendWidget("sectionWhatToFill", sectionWhatToFill);
688
689 KisOptionCollectionWidgetWithHeader *sectionFillWith =
691 i18nc("The 'fill source' section label in fill tool options", "Fill source")
692 );
693 sectionFillWith->setPrimaryWidget(optionButtonStripFillWith);
694 sectionFillWith->appendWidget("sliderPatternScale", m_sliderPatternScale);
695 sectionFillWith->appendWidget("angleSelectorPatternRotation", m_angleSelectorPatternRotation);
696 sectionFillWith->appendWidget("checkBoxCustomBlendingOptions", m_checkBoxCustomBlendingOptions);
697 sectionFillWith->appendWidget("sliderCustomOpacity", m_sliderCustomOpacity);
698 sectionFillWith->appendWidget("comboBoxCustomCompositeOp", m_comboBoxCustomCompositeOp);
699 sectionFillWith->setWidgetVisible("sliderPatternScale", false);
700 sectionFillWith->setWidgetVisible("angleSelectorPatternRotation", false);
701 m_optionWidget->appendWidget("sectionFillWith", sectionFillWith);
702
704 widgetLabelsGroup->appendWidget("labelWidget", m_widgetLabels);
705 widgetLabelsGroup->appendWidget("checkBoxUseActiveLayer", m_checkBoxUseActiveLayer);
706 widgetLabelsGroup->setWidgetsMargin(0);
707
708 KisOptionCollectionWidgetWithHeader *sectionReference =
710 i18nc("The 'reference' section label in fill tool options", "Reference")
711 );
712 sectionReference->setPrimaryWidget(optionButtonStripReference);
713 sectionReference->appendWidget("widgetLabels", widgetLabelsGroup);
714 sectionReference->setWidgetVisible("widgetLabels", false);
715 m_optionWidget->appendWidget("sectionReference", sectionReference);
716
717 KisOptionCollectionWidgetWithHeader *sectionRegionExtent =
719 i18nc("The 'fill extent' section label in fill tool options", "Fill extent")
720 );
721 sectionRegionExtent->setPrimaryWidget(optionButtonStripContiguousFillMode);
722 sectionRegionExtent->appendWidget("buttonContiguousFillBoundaryColor", m_buttonContiguousFillBoundaryColor);
723 sectionRegionExtent->setWidgetVisible("buttonContiguousFillBoundaryColor", false);
724 sectionRegionExtent->appendWidget("sliderThreshold", m_sliderThreshold);
725 sectionRegionExtent->appendWidget("sliderSpread", m_sliderSpread);
726 sectionRegionExtent->appendWidget("sliderCloseGap", m_sliderCloseGap);
727 sectionRegionExtent->appendWidget("checkBoxSelectionAsBoundary", m_checkBoxSelectionAsBoundary);
728 m_optionWidget->appendWidget("sectionRegionExtent", sectionRegionExtent);
729
730 KisOptionCollectionWidgetWithHeader *sectionAdjustments =
732 i18nc("The 'adjustments' section label in fill tool options", "Adjustments")
733 );
734 sectionAdjustments->appendWidget("checkBoxAntiAlias", m_checkBoxAntiAlias);
735 sectionAdjustments->appendWidget("containerGrow", containerGrow);
736 sectionAdjustments->appendWidget("sliderFeather", m_sliderFeather);
737 m_optionWidget->appendWidget("sectionAdjustments", sectionAdjustments);
738
739 KisOptionCollectionWidgetWithHeader *sectionDragFill =
741 i18nc("The 'drag-fill mode' section label in fill tool options", "Drag-fill mode")
742 );
743 sectionDragFill->setPrimaryWidget(optionButtonStripDragFill);
744 m_optionWidget->appendWidget("sectionDragFill", sectionDragFill);
745
746 m_optionWidget->appendWidget("buttonReset", buttonReset);
747
748 // Initialize widgets
750 m_buttonWhatToFillSelection->setChecked(true);
751 m_optionWidget->setWidgetVisible("sectionRegionExtent", false);
752 m_optionWidget->setWidgetVisible("sectionAdjustments", false);
753 m_optionWidget->setWidgetVisible("sectionReference", false);
754 m_optionWidget->setWidgetVisible("sectionDragFill", false);
756 m_buttonWhatToFillSimilar->setChecked(true);
757 m_optionWidget->setWidgetVisible("sectionDragFill", false);
758 sectionRegionExtent->setWidgetVisible("checkBoxSelectionAsBoundary", false);
759 sectionRegionExtent->setWidgetVisible("sliderCloseGap", false);
760 }
763 m_buttonFillWithBG->setChecked(true);
764 } else if (m_fillType == FillType_FillWithPattern) {
765 m_buttonFillWithPattern->setChecked(true);
766 sectionFillWith->setWidgetVisible("sliderPatternScale", true);
767 sectionFillWith->setWidgetVisible("angleSelectorPatternRotation", true);
768 }
774 ? currentNode()->paintDevice()->colorSpace()
775 : nullptr);
778 sectionFillWith->setWidgetVisible("sliderCustomOpacity", false);
779 sectionFillWith->setWidgetVisible("comboBoxCustomCompositeOp", false);
780 }
783 sectionRegionExtent->setWidgetVisible("buttonContiguousFillBoundaryColor",
785 }
791 m_checkBoxAntiAlias->setChecked(m_antiAlias);
796 m_buttonReferenceAll->setChecked(true);
798 m_buttonReferenceLabeled->setChecked(true);
799 sectionReference->setWidgetVisible("widgetLabels", true);
800 }
802 m_buttonDragFillDoNotUse->setChecked(true);
804 m_buttonDragFillSimilar->setChecked(true);
805 }
808
809 // Make connections
810 connect(optionButtonStripWhatToFill,
811 SIGNAL(buttonToggled(KoGroupButton *, bool)),
813 connect(optionButtonStripFillWith,
814 SIGNAL(buttonToggled(KoGroupButton *, bool)),
817 SIGNAL(valueChanged(double)),
820 SIGNAL(angleChanged(double)),
823 SIGNAL(toggled(bool)),
826 SIGNAL(valueChanged(int)),
829 SIGNAL(currentIndexChanged(int)),
831 connect(optionButtonStripContiguousFillMode,
832 SIGNAL(buttonToggled(KoGroupButton *, bool)),
835 SIGNAL(changed(const KoColor&)),
837 connect(m_sliderThreshold, SIGNAL(valueChanged(int)), SLOT(slot_sliderThreshold_valueChanged(int)));
838 connect(m_sliderSpread, SIGNAL(valueChanged(int)), SLOT(slot_sliderSpread_valueChanged(int)));
839 connect(m_sliderCloseGap, SIGNAL(valueChanged(int)), SLOT(slot_sliderCloseGap_valueChanged(int)));
841 SIGNAL(toggled(bool)),
843 connect(m_checkBoxAntiAlias, SIGNAL(toggled(bool)), SLOT(slot_checkBoxAntiAlias_toggled(bool)));
844 connect(m_sliderGrow, SIGNAL(valueChanged(int)), SLOT(slot_sliderGrow_valueChanged(int)));
846 SIGNAL(toggled(bool)),
848 connect(m_sliderFeather, SIGNAL(valueChanged(int)), SLOT(slot_sliderFeather_valueChanged(int)));
849 connect(optionButtonStripReference,
850 SIGNAL(buttonToggled(KoGroupButton *, bool)),
853 connect(m_checkBoxUseActiveLayer, SIGNAL(toggled(bool)), SLOT(slot_checkBoxUseActiveLayer_toggled(bool)));
854 connect(
855 optionButtonStripDragFill,
856 SIGNAL(buttonToggled(KoGroupButton *, bool)),
858 connect(buttonReset, SIGNAL(clicked()), SLOT(slot_buttonReset_clicked()));
859
860 return m_optionWidget;
861}
@ IncreasingDirection_Clockwise
A widget with several options to select an angle.
@ FlipOptionsMode_ContextMenu
The flip options are shown only as a context menu when right-clicking the gauge widget.
void setFlipOptionsMode(FlipOptionsMode newMode)
Sets the mode in which the flip options should be shown.
void setIncreasingDirection(KisAngleGauge::IncreasingDirection newIncreasingDirection)
Sets the increasing direction in the angle gauge.
void setAngle(qreal newAngle)
Sets the current angle.
A pushbutton to display or allow user selection of a color.
void setColor(const KoColor &c)
void setButtonSize(int size)
Set the size of the buttons.
void setSelection(const QList< int > &indices)
Set the list of checked button indices.
void setExclusive(bool exclusive)
Set if the button selection is mutually exclusive. This allows switching between single or multiple s...
void setButtonWrapEnabled(bool enabled)
Set if the buttons should wrap in multiple lines if there is no enough space horizontally.
void setMouseDragEnabled(bool enabled)
Set if the user can drag to check/uncheck multiple buttons.
void selectCompositeOp(const KoID &op)
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setValue(qreal newValue)
void setRange(qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range.
void setSoftMaximum(qreal newSoftMaximum)
Provides a list of consecutive tool buttons.
KoGroupButton * addButton(const QIcon &icon, const QString &text=QString())
Wrapper class around a KisOptionCollectionWidget that also provide a header with a title label and an...
void setPrimaryWidget(QWidget *widget)
Set the primary widget. The list widget takes ownership of it.
void appendWidget(const QString &id, QWidget *widget)
Insert the given widget with the given id at the end of the list. The list widget takes ownership of ...
void setPrimaryWidgetVisible(bool visible)
Set the visibility of the primary widget. Use this function instead of the widget one directly to get...
void setWidgetVisible(int index, bool visible)
Set the visibility of the widget that is at the given position.
Class providing a list of widgets with some addons such as separators, orientation or individual widg...
void setWidgetsMargin(int margin)
Set the margins of the widgets. This allows to indent the widgets with respect to the separators....
void setOrientation(Qt::Orientation orientation, bool recursive=false)
Set the orientation of the list of widgets.
void setWidgetVisible(int index, bool visible)
Set the visibility of the widget that is at the given position. Use this function instead of the widg...
void appendWidget(const QString &id, QWidget *widget)
Insert the given widget with the given id at the end of the list. The list widget takes ownership of ...
void setSeparatorsVisible(bool visible)
Set the visibility of the separators.
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setSoftRange(int newSoftMinimum, int newSoftMaximum)
Set the minimum and the maximum values of the soft range.
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 slot_sliderGrow_valueChanged(int value)
KoGroupButton * m_buttonFillWithBG
void slot_colorSpaceChanged(const KoColorSpace *colorSpace)
void slot_optionButtonStripReference_buttonToggled(KoGroupButton *button, bool checked)
KisCompositeOpComboBox * m_comboBoxCustomCompositeOp
void slot_optionButtonStripDragFill_buttonToggled(KoGroupButton *button, bool checked)
KoGroupButton * m_buttonWhatToFillContiguous
void slot_checkBoxUseCustomBlendingOptions_toggled(bool checked)
KisSliderSpinBox * m_sliderCloseGap
void slot_optionButtonStripFillWith_buttonToggled(KoGroupButton *button, bool checked)
void slot_optionButtonStripContiguousFillMode_buttonToggled(KoGroupButton *button, bool checked)
void slot_comboBoxCustomCompositeOp_currentIndexChanged(int index)
KoGroupButton * m_buttonReferenceAll
KisSliderSpinBox * m_sliderCustomOpacity
void slot_angleSelectorPatternRotation_angleChanged(double value)
KisColorButton * m_buttonContiguousFillBoundaryColor
KisSliderSpinBox * m_sliderGrow
KisAngleSelector * m_angleSelectorPatternRotation
void slot_optionButtonStripWhatToFill_buttonToggled(KoGroupButton *button, bool checked)
void slot_sliderThreshold_valueChanged(int value)
void slot_checkBoxSelectionAsBoundary_toggled(bool checked)
void slot_sliderPatternScale_valueChanged(double value)
void slot_sliderCustomOpacity_valueChanged(int value)
KisSliderSpinBox * m_sliderFeather
KoGroupButton * m_buttonFillWithFG
void slot_sliderCloseGap_valueChanged(int value)
void slot_checkBoxUseActiveLayer_toggled(bool checked)
KoGroupButton * m_buttonDragFillAny
void loadConfiguration()
KoGroupButton * m_buttonFillWithPattern
void slot_widgetLabels_selectionChanged()
KoGroupButton * m_buttonDragFillDoNotUse
KisSliderSpinBox * m_sliderThreshold
KoGroupButton * m_buttonContiguousFillModeBoundaryFill
KoGroupButton * m_buttonReferenceCurrent
void slot_buttonStopGrowingAtDarkestPixel_toggled(bool enabled)
void slot_sliderSpread_valueChanged(int value)
QToolButton * m_buttonStopGrowingAtDarkestPixel
KoGroupButton * m_buttonDragFillSimilar
QCheckBox * m_checkBoxSelectionAsBoundary
void slot_checkBoxAntiAlias_toggled(bool checked)
KisSliderSpinBox * m_sliderSpread
KisDoubleSliderSpinBox * m_sliderPatternScale
KoGroupButton * m_buttonWhatToFillSimilar
QCheckBox * m_checkBoxAntiAlias
QCheckBox * m_checkBoxCustomBlendingOptions
KisOptionCollectionWidget * m_optionWidget
void slot_buttonContiguousFillBoundaryColor_changed(const KoColor &color)
KoGroupButton * m_buttonWhatToFillSelection
KoGroupButton * m_buttonReferenceLabeled
void slot_buttonReset_clicked()
QCheckBox * m_checkBoxUseActiveLayer
KoGroupButton * m_buttonContiguousFillModeFloodFill
KisColorLabelSelectorWidget * m_widgetLabels
void slot_sliderFeather_valueChanged(int value)
Definition KoID.h:30
void selectionChanged(bool hasSelection)
QIcon loadIcon(const QString &name)
void setText(QSpinBox *spinBox, const QStringView textTemplate)

References KisOptionButtonStrip::addButton(), KisOptionCollectionWidget::appendWidget(), KisOptionCollectionWidgetWithHeader::appendWidget(), connect(), ContiguousFillMode_BoundaryFill, ContinuousFillMode_DoNotUse, ContinuousFillMode_FillSimilarRegions, KisTool::currentNode(), FillMode_FillContiguousRegion, FillMode_FillSelection, FillMode_FillSimilarRegions, FillType_FillWithBackgroundColor, FillType_FillWithPattern, KisAngleSelector::FlipOptionsMode_ContextMenu, KisAngleGauge::IncreasingDirection_Clockwise, loadConfiguration(), KisIconUtils::loadIcon(), m_angleSelectorPatternRotation, m_antiAlias, m_buttonContiguousFillBoundaryColor, m_buttonContiguousFillModeBoundaryFill, m_buttonContiguousFillModeFloodFill, m_buttonDragFillAny, m_buttonDragFillDoNotUse, m_buttonDragFillSimilar, m_buttonFillWithBG, m_buttonFillWithFG, m_buttonFillWithPattern, m_buttonReferenceAll, m_buttonReferenceCurrent, m_buttonReferenceLabeled, m_buttonStopGrowingAtDarkestPixel, m_buttonWhatToFillContiguous, m_buttonWhatToFillSelection, m_buttonWhatToFillSimilar, m_checkBoxAntiAlias, m_checkBoxCustomBlendingOptions, m_checkBoxSelectionAsBoundary, m_checkBoxUseActiveLayer, m_closeGap, m_comboBoxCustomCompositeOp, m_contiguousFillBoundaryColor, m_contiguousFillMode, m_continuousFillMode, m_customCompositeOp, m_customOpacity, m_feather, m_fillMode, m_fillType, m_opacitySpread, m_optionWidget, m_patternRotation, m_patternScale, m_reference, m_selectedColorLabels, m_sizemod, m_sliderCloseGap, m_sliderCustomOpacity, m_sliderFeather, m_sliderGrow, m_sliderPatternScale, m_sliderSpread, m_sliderThreshold, m_stopGrowingAtDarkestPixel, m_threshold, m_useActiveLayer, m_useCustomBlendingOptions, m_useSelectionAsBoundary, m_widgetLabels, Reference_AllLayers, Reference_ColorLabeledLayers, KisCompositeOpComboBox::selectCompositeOp(), KoToolBase::selectionChanged(), KisAngleSelector::setAngle(), KisColorLabelSelectorWidget::setButtonSize(), KisColorLabelSelectorWidget::setButtonWrapEnabled(), KisColorButton::setColor(), KisColorLabelSelectorWidget::setExclusive(), KisAngleSelector::setFlipOptionsMode(), KisAngleSelector::setIncreasingDirection(), KisColorLabelSelectorWidget::setMouseDragEnabled(), KisOptionCollectionWidget::setOrientation(), KisOptionCollectionWidgetWithHeader::setPrimaryWidget(), KisOptionCollectionWidgetWithHeader::setPrimaryWidgetVisible(), KisSliderSpinBox::setRange(), KisDoubleSliderSpinBox::setRange(), KisColorLabelSelectorWidget::setSelection(), KisOptionCollectionWidget::setSeparatorsVisible(), KisDoubleSliderSpinBox::setSoftMaximum(), KisSliderSpinBox::setSoftRange(), KisSpinBoxI18nHelper::setText(), KisSliderSpinBox::setValue(), KisDoubleSliderSpinBox::setValue(), KisOptionCollectionWidget::setWidgetsMargin(), KisOptionCollectionWidget::setWidgetVisible(), KisOptionCollectionWidgetWithHeader::setWidgetVisible(), slot_angleSelectorPatternRotation_angleChanged(), slot_buttonContiguousFillBoundaryColor_changed(), slot_buttonReset_clicked(), slot_buttonStopGrowingAtDarkestPixel_toggled(), slot_checkBoxAntiAlias_toggled(), slot_checkBoxSelectionAsBoundary_toggled(), slot_checkBoxUseActiveLayer_toggled(), slot_checkBoxUseCustomBlendingOptions_toggled(), slot_colorSpaceChanged(), slot_comboBoxCustomCompositeOp_currentIndexChanged(), slot_optionButtonStripContiguousFillMode_buttonToggled(), slot_optionButtonStripDragFill_buttonToggled(), slot_optionButtonStripFillWith_buttonToggled(), slot_optionButtonStripReference_buttonToggled(), slot_optionButtonStripWhatToFill_buttonToggled(), slot_sliderCloseGap_valueChanged(), slot_sliderCustomOpacity_valueChanged(), slot_sliderFeather_valueChanged(), slot_sliderGrow_valueChanged(), slot_sliderPatternScale_valueChanged(), slot_sliderSpread_valueChanged(), slot_sliderThreshold_valueChanged(), and slot_widgetLabels_selectionChanged().

◆ deactivate

void KisToolFill::deactivate ( )
overrideslot

Definition at line 115 of file kis_tool_fill.cc.

116{
117 m_referencePaintDevice = nullptr;
118 m_referenceNodeList = nullptr;
119 KisCanvas2 *kisCanvas = static_cast<KisCanvas2*>(canvas());
120 KisCanvasResourceProvider *resourceProvider = kisCanvas->viewManager()->canvasResourceProvider();
121 if (resourceProvider) {
122 disconnect(resourceProvider,
123 SIGNAL(sigNodeChanged(const KisNodeSP)),
124 this,
126 }
129}
void deactivate() override

References Private::canvas, KisViewManager::canvasResourceProvider(), KisToolPaint::deactivate(), m_referenceNodeList, m_referencePaintDevice, slot_currentNodeChanged(), and KisCanvas2::viewManager().

◆ endAlternateAction()

void KisToolFill::endAlternateAction ( KoPointerEvent * event,
AlternateAction action )
overridevirtual

Reimplemented from KisTool.

Definition at line 238 of file kis_tool_fill.cc.

239{
240 if (action == ChangeSize) {
241 endPrimaryAction(event);
242 return;
243 }
245}
void endPrimaryAction(KoPointerEvent *event) override
void endAlternateAction(KoPointerEvent *event, AlternateAction action) override

References KoToolBase::action(), KisTool::ChangeSize, KisToolPaint::endAlternateAction(), and endPrimaryAction().

◆ endFilling()

◆ endPrimaryAction()

void KisToolFill::endPrimaryAction ( KoPointerEvent * event)
overridevirtual

Called by KisToolProxy when the primary action is being finished, that is while mouseRelease or tabletRelease event. If the tool has ignored the event in beginPrimaryAction(), this method will not be called.

Reimplemented from KisTool.

Definition at line 208 of file kis_tool_fill.cc.

209{
210 if (m_isFilling) {
212 endFilling();
213 }
214
215 m_isFilling = false;
216 m_isDragging = false;
217 m_seedPoints.clear();
218}

References endFilling(), m_compressorFillUpdate, m_isDragging, m_isFilling, m_seedPoints, and KisSignalCompressor::stop().

◆ loadConfiguration()

void KisToolFill::loadConfiguration ( )
private

Definition at line 863 of file kis_tool_fill.cc.

864{
865 {
866 const QString whatToFillStr = m_configGroup.readEntry<QString>("whatToFill", "");
867 if (whatToFillStr == "fillSelection") {
869 } else if (whatToFillStr == "fillContiguousRegion") {
871 } else if (whatToFillStr == "fillSimilarRegions") {
873 } else {
874 if (m_configGroup.readEntry<bool>("fillSelection", false)) {
876 } else {
878 }
879 }
880 }
881 {
882 const QString fillTypeStr = m_configGroup.readEntry<QString>("fillWith", "");
883 if (fillTypeStr == "foregroundColor") {
885 } else if (fillTypeStr == "backgroundColor") {
887 } else if (fillTypeStr == "pattern") {
889 } else {
890 if (m_configGroup.readEntry<bool>("usePattern", false)) {
892 } else {
894 }
895 }
896 }
897 m_patternScale = m_configGroup.readEntry<qreal>("patternScale", 100.0);
898 m_patternRotation = m_configGroup.readEntry<qreal>("patternRotate", 0.0);
899 m_useCustomBlendingOptions = m_configGroup.readEntry<bool>("useCustomBlendingOptions", false);
900 m_customOpacity = qBound(0, m_configGroup.readEntry<int>("customOpacity", 100), 100);
901 m_customCompositeOp = m_configGroup.readEntry<QString>("customCompositeOp", COMPOSITE_OVER);
904 }
905 {
906 const QString contiguousFillModeStr = m_configGroup.readEntry<QString>("contiguousFillMode", "");
907 m_contiguousFillMode = contiguousFillModeStr == "boundaryFill"
910 }
912 m_threshold = m_configGroup.readEntry<int>("thresholdAmount", 8);
913 m_opacitySpread = m_configGroup.readEntry<int>("opacitySpread", 100);
914 m_closeGap = m_configGroup.readEntry<int>("closeGapAmount", 0);
915 m_useSelectionAsBoundary = m_configGroup.readEntry<bool>("useSelectionAsBoundary", true);
916 m_antiAlias = m_configGroup.readEntry<bool>("antiAlias", false);
917 m_sizemod = m_configGroup.readEntry<int>("growSelection", 0);
918 m_stopGrowingAtDarkestPixel = m_configGroup.readEntry<bool>("stopGrowingAtDarkestPixel", false);
919 m_feather = m_configGroup.readEntry<int>("featherAmount", 0);
920 {
921 const QString sampleLayersModeStr = m_configGroup.readEntry<QString>("sampleLayersMode", "");
922 if (sampleLayersModeStr == "currentLayer") {
924 } else if (sampleLayersModeStr == "allLayers") {
926 } else if (sampleLayersModeStr == "colorLabeledLayers") {
928 } else {
929 if (m_configGroup.readEntry<bool>("sampleMerged", false)) {
931 } else {
933 }
934 }
935 }
936 {
937 const QStringList colorLabelsStr = m_configGroup.readEntry<QString>("colorLabels", "").split(',', Qt::SkipEmptyParts);
938 m_selectedColorLabels.clear();
939 for (const QString &colorLabelStr : colorLabelsStr) {
940 bool ok;
941 const int colorLabel = colorLabelStr.toInt(&ok);
942 if (ok) {
943 m_selectedColorLabels << colorLabel;
944 }
945 }
946 m_useActiveLayer = m_configGroup.readEntry<bool>("useActiveLayer", false);
947 }
948 {
949 const QString continuousFillModeStr = m_configGroup.readEntry<QString>("continuousFillMode", "fillAnyRegion");
950 if (continuousFillModeStr == "doNotUse") {
952 } else if (continuousFillModeStr == "fillSimilarRegions") {
954 } else {
956 }
957 }
958}
KoColor loadContiguousFillBoundaryColorFromConfig()
static const KoCompositeOpRegistry & instance()
KoID getKoID(const QString &compositeOpID) const
QString id() const
Definition KoID.cpp:63
QList< KoSubpath * > split(const KoPathShape &path)

References COMPOSITE_OVER, ContiguousFillMode_BoundaryFill, ContiguousFillMode_FloodFill, ContinuousFillMode_DoNotUse, ContinuousFillMode_FillAnyRegion, ContinuousFillMode_FillSimilarRegions, FillMode_FillContiguousRegion, FillMode_FillSelection, FillMode_FillSimilarRegions, FillType_FillWithBackgroundColor, FillType_FillWithForegroundColor, FillType_FillWithPattern, KoCompositeOpRegistry::getKoID(), KoID::id(), KoCompositeOpRegistry::instance(), loadContiguousFillBoundaryColorFromConfig(), m_antiAlias, m_closeGap, m_configGroup, m_contiguousFillBoundaryColor, m_contiguousFillMode, m_continuousFillMode, m_customCompositeOp, m_customOpacity, m_feather, m_fillMode, m_fillType, m_opacitySpread, m_patternRotation, m_patternScale, m_reference, m_selectedColorLabels, m_sizemod, m_stopGrowingAtDarkestPixel, m_threshold, m_useActiveLayer, m_useCustomBlendingOptions, m_useSelectionAsBoundary, Reference_AllLayers, Reference_ColorLabeledLayers, and Reference_CurrentLayer.

◆ loadContiguousFillBoundaryColorFromConfig()

KoColor KisToolFill::loadContiguousFillBoundaryColorFromConfig ( )
private

Definition at line 960 of file kis_tool_fill.cc.

961{
962 const QString xmlColor = m_configGroup.readEntry("contiguousFillBoundaryColor", QString());
963 QDomDocument doc;
964 if (doc.setContent(xmlColor)) {
965 QDomElement e = doc.documentElement().firstChild().toElement();
966 QString channelDepthID = doc.documentElement().attribute("channeldepth", Integer16BitsColorDepthID.id());
967 bool ok;
968 if (e.hasAttribute("space") || e.tagName().toLower() == "srgb") {
969 return KoColor::fromXML(e, channelDepthID, &ok);
970 } else if (doc.documentElement().hasAttribute("space") || doc.documentElement().tagName().toLower() == "srgb"){
971 return KoColor::fromXML(doc.documentElement(), channelDepthID, &ok);
972 }
973 }
974 return KoColor();
975}
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
static KoColor fromXML(const QDomElement &elt, const QString &channelDepthId)
Definition KoColor.cpp:350

References KoColor::fromXML(), KoID::id(), Integer16BitsColorDepthID, and m_configGroup.

◆ resetCursorStyle

void KisToolFill::resetCursorStyle ( )
overrideprotectedslot

Definition at line 89 of file kis_tool_fill.cc.

90{
92 useCursor(KisCursor::load("tool_fill_eraser_cursor.png", 6, 6));
93 } else {
95 }
96
98}
bool isEraser() const
void useCursor(const QCursor &cursor)
virtual void resetCursorStyle()
Definition kis_tool.cc:613
bool overrideCursorIfNotEditable()
Override the cursor appropriately if current node is not editable.
Definition kis_tool.cc:618

References KisToolPaint::isEraser(), KisCursor::load(), m_useCustomBlendingOptions, KisTool::overrideCursorIfNotEditable(), KisTool::resetCursorStyle(), and KoToolBase::useCursor().

◆ slot_angleSelectorPatternRotation_angleChanged

void KisToolFill::slot_angleSelectorPatternRotation_angleChanged ( double value)
privateslot

Definition at line 1060 of file kis_tool_fill.cc.

1061{
1062 if (value == m_patternRotation) {
1063 return;
1064 }
1066 m_configGroup.writeEntry("patternRotate", value);
1067}
float value(const T *src, size_t ch)

References m_configGroup, m_patternRotation, and value().

◆ slot_buttonContiguousFillBoundaryColor_changed

void KisToolFill::slot_buttonContiguousFillBoundaryColor_changed ( const KoColor & color)
privateslot

Definition at line 1124 of file kis_tool_fill.cc.

1125{
1126 if (color == m_contiguousFillBoundaryColor) {
1127 return;
1128 }
1130 m_configGroup.writeEntry("contiguousFillBoundaryColor", color.toXML());
1131}
void toXML(QDomDocument &doc, QDomElement &colorElt) const
Definition KoColor.cpp:304

References m_configGroup, m_contiguousFillBoundaryColor, and KoColor::toXML().

◆ slot_buttonReset_clicked

void KisToolFill::slot_buttonReset_clicked ( )
privateslot

Definition at line 1268 of file kis_tool_fill.cc.

1269{
1270 m_buttonWhatToFillContiguous->setChecked(true);
1271 m_buttonFillWithFG->setChecked(true);
1274 m_checkBoxCustomBlendingOptions->setChecked(false);
1280 m_checkBoxSelectionAsBoundary->setChecked(true);
1281 m_checkBoxAntiAlias->setChecked(false);
1283 m_buttonStopGrowingAtDarkestPixel->setChecked(false);
1285 m_buttonReferenceCurrent->setChecked(true);
1287 m_buttonDragFillAny->setChecked(true);
1288}

References COMPOSITE_OVER, m_angleSelectorPatternRotation, m_buttonDragFillAny, m_buttonFillWithFG, m_buttonReferenceCurrent, m_buttonStopGrowingAtDarkestPixel, m_buttonWhatToFillContiguous, m_checkBoxAntiAlias, m_checkBoxCustomBlendingOptions, m_checkBoxSelectionAsBoundary, m_comboBoxCustomCompositeOp, m_sliderCloseGap, m_sliderCustomOpacity, m_sliderFeather, m_sliderGrow, m_sliderPatternScale, m_sliderSpread, m_sliderThreshold, m_widgetLabels, KisCompositeOpComboBox::selectCompositeOp(), KisAngleSelector::setAngle(), KisColorLabelSelectorWidget::setSelection(), KisSliderSpinBox::setValue(), and KisDoubleSliderSpinBox::setValue().

◆ slot_buttonStopGrowingAtDarkestPixel_toggled

void KisToolFill::slot_buttonStopGrowingAtDarkestPixel_toggled ( bool enabled)
privateslot

Definition at line 1187 of file kis_tool_fill.cc.

1188{
1189 if (enabled == m_stopGrowingAtDarkestPixel) {
1190 return;
1191 }
1193 m_configGroup.writeEntry("stopGrowingAtDarkestPixel", enabled);
1194}

References m_configGroup, and m_stopGrowingAtDarkestPixel.

◆ slot_checkBoxAntiAlias_toggled

void KisToolFill::slot_checkBoxAntiAlias_toggled ( bool checked)
privateslot

Definition at line 1169 of file kis_tool_fill.cc.

1170{
1171 if (checked == m_antiAlias) {
1172 return;
1173 }
1174 m_antiAlias = checked;
1175 m_configGroup.writeEntry("antiAlias", checked);
1176}

References m_antiAlias, and m_configGroup.

◆ slot_checkBoxSelectionAsBoundary_toggled

void KisToolFill::slot_checkBoxSelectionAsBoundary_toggled ( bool checked)
privateslot

Definition at line 1160 of file kis_tool_fill.cc.

1161{
1162 if (checked == m_useSelectionAsBoundary) {
1163 return;
1164 }
1165 m_useSelectionAsBoundary = checked;
1166 m_configGroup.writeEntry("useSelectionAsBoundary", checked);
1167}

References m_configGroup, and m_useSelectionAsBoundary.

◆ slot_checkBoxUseActiveLayer_toggled

void KisToolFill::slot_checkBoxUseActiveLayer_toggled ( bool checked)
privateslot

Definition at line 1323 of file kis_tool_fill.cc.

1324{
1325 if (checked == m_useActiveLayer) {
1326 return;
1327 }
1328 m_useActiveLayer = checked;
1329 m_configGroup.writeEntry("useActiveLayer", checked);
1330}

References m_configGroup, and m_useActiveLayer.

◆ slot_checkBoxUseCustomBlendingOptions_toggled

void KisToolFill::slot_checkBoxUseCustomBlendingOptions_toggled ( bool checked)
privateslot

Definition at line 1069 of file kis_tool_fill.cc.

1070{
1071 KisOptionCollectionWidgetWithHeader *sectionFillWith =
1073 sectionFillWith->setWidgetVisible("sliderCustomOpacity", checked);
1074 sectionFillWith->setWidgetVisible("comboBoxCustomCompositeOp", checked);
1076 m_configGroup.writeEntry("useCustomBlendingOptions", checked);
1077}
T widgetAs(int index) const
Get the widget that is at the given position casted to some other class.

References m_configGroup, m_optionWidget, m_useCustomBlendingOptions, KisOptionCollectionWidgetWithHeader::setWidgetVisible(), and KisOptionCollectionWidget::widgetAs().

◆ slot_colorSpaceChanged

void KisToolFill::slot_colorSpaceChanged ( const KoColorSpace * colorSpace)
privateslot

Definition at line 1308 of file kis_tool_fill.cc.

1309{
1311 return;
1312 }
1313 const KoColorSpace *compositionSpace = colorSpace;
1314 if (currentNode() && currentNode()->paintDevice()) {
1315 // Currently, composition source is enough to determine the available blending mode,
1316 // because either destination is the same (paint layers), or composition happens
1317 // in source space (masks).
1318 compositionSpace = currentNode()->paintDevice()->compositionSourceColorSpace();
1319 }
1320 m_comboBoxCustomCompositeOp->validate(compositionSpace);
1321}
void validate(const KoColorSpace *cs)
virtual const KoColorSpace * compositionSourceColorSpace() const

References KisPaintDevice::compositionSourceColorSpace(), KisTool::currentNode(), m_comboBoxCustomCompositeOp, KisBaseNode::paintDevice(), and KisCompositeOpComboBox::validate().

◆ slot_comboBoxCustomCompositeOp_currentIndexChanged

void KisToolFill::slot_comboBoxCustomCompositeOp_currentIndexChanged ( int index)
privateslot

Definition at line 1088 of file kis_tool_fill.cc.

1089{
1090 Q_UNUSED(index);
1091 const QString compositeOpId = m_comboBoxCustomCompositeOp->selectedCompositeOp().id();
1092 if (compositeOpId == m_customCompositeOp) {
1093 return;
1094 }
1095 m_customCompositeOp = compositeOpId;
1096 m_configGroup.writeEntry("customCompositeOp", compositeOpId);
1097}

References KoID::id(), m_comboBoxCustomCompositeOp, m_configGroup, m_customCompositeOp, and KisCompositeOpComboBox::selectedCompositeOp().

◆ slot_currentNodeChanged

void KisToolFill::slot_currentNodeChanged ( const KisNodeSP node)
privateslot

Definition at line 1290 of file kis_tool_fill.cc.

1291{
1293 disconnect(m_previousNode->paintDevice().data(),
1294 SIGNAL(colorSpaceChanged(const KoColorSpace*)),
1295 this,
1296 SLOT(slot_colorSpaceChanged(const KoColorSpace*)));
1297 }
1298 if (node && node->paintDevice()) {
1299 connect(node->paintDevice().data(),
1300 SIGNAL(colorSpaceChanged(const KoColorSpace*)),
1301 this,
1302 SLOT(slot_colorSpaceChanged(const KoColorSpace*)));
1304 }
1305 m_previousNode = node;
1306}
const KoColorSpace * colorSpace() const
KisNodeSP m_previousNode

References KisPaintDevice::colorSpace(), connect(), KisSharedPtr< T >::data(), m_previousNode, KisBaseNode::paintDevice(), and slot_colorSpaceChanged().

◆ slot_optionButtonStripContiguousFillMode_buttonToggled

void KisToolFill::slot_optionButtonStripContiguousFillMode_buttonToggled ( KoGroupButton * button,
bool checked )
privateslot

Definition at line 1099 of file kis_tool_fill.cc.

1102{
1103 if (!checked) {
1104 return;
1105 }
1106
1107 const bool visible = button == m_buttonContiguousFillModeBoundaryFill;
1108 KisOptionCollectionWidgetWithHeader *sectionRegionExtent =
1110 sectionRegionExtent->setWidgetVisible("buttonContiguousFillBoundaryColor", visible);
1111
1115
1116 m_configGroup.writeEntry(
1117 "contiguousFillMode",
1119 ? "floodFill"
1120 : "boundaryFill"
1121 );
1122}
QString button(const QWheelEvent &ev)

References button(), ContiguousFillMode_BoundaryFill, ContiguousFillMode_FloodFill, m_buttonContiguousFillModeBoundaryFill, m_buttonContiguousFillModeFloodFill, m_configGroup, m_contiguousFillMode, m_optionWidget, KisOptionCollectionWidgetWithHeader::setWidgetVisible(), and KisOptionCollectionWidget::widgetAs().

◆ slot_optionButtonStripDragFill_buttonToggled

void KisToolFill::slot_optionButtonStripDragFill_buttonToggled ( KoGroupButton * button,
bool checked )
privateslot

Definition at line 1246 of file kis_tool_fill.cc.

1249{
1250 if (!checked) {
1251 return;
1252 }
1258 m_configGroup.writeEntry(
1259 "continuousFillMode",
1261 ? "fillAnyRegion"
1263 ? "doNotUse"
1264 : "fillSimilarRegions"
1265 );
1266}

References button(), ContinuousFillMode_DoNotUse, ContinuousFillMode_FillAnyRegion, ContinuousFillMode_FillSimilarRegions, m_buttonDragFillAny, m_buttonDragFillDoNotUse, m_configGroup, and m_continuousFillMode.

◆ slot_optionButtonStripFillWith_buttonToggled

void KisToolFill::slot_optionButtonStripFillWith_buttonToggled ( KoGroupButton * button,
bool checked )
privateslot

Definition at line 1025 of file kis_tool_fill.cc.

1028{
1029 if (!checked) {
1030 return;
1031 }
1032 const bool visible = button == m_buttonFillWithPattern;
1033 KisOptionCollectionWidgetWithHeader *sectionFillWith =
1035 sectionFillWith->setWidgetVisible("sliderPatternScale", visible);
1036 sectionFillWith->setWidgetVisible("angleSelectorPatternRotation", visible);
1037
1042
1043 m_configGroup.writeEntry(
1044 "fillWith",
1046 ? "foregroundColor"
1047 : (button == m_buttonFillWithBG ? "backgroundColor" : "pattern")
1048 );
1049}

References button(), FillType_FillWithBackgroundColor, FillType_FillWithForegroundColor, FillType_FillWithPattern, m_buttonFillWithBG, m_buttonFillWithFG, m_buttonFillWithPattern, m_configGroup, m_fillType, m_optionWidget, KisOptionCollectionWidgetWithHeader::setWidgetVisible(), and KisOptionCollectionWidget::widgetAs().

◆ slot_optionButtonStripReference_buttonToggled

void KisToolFill::slot_optionButtonStripReference_buttonToggled ( KoGroupButton * button,
bool checked )
privateslot

◆ slot_optionButtonStripWhatToFill_buttonToggled

void KisToolFill::slot_optionButtonStripWhatToFill_buttonToggled ( KoGroupButton * button,
bool checked )
privateslot

Definition at line 977 of file kis_tool_fill.cc.

980{
981 if (!checked) {
982 return;
983 }
984
986 m_optionWidget->setWidgetVisible("sectionRegionExtent", false);
987 m_optionWidget->setWidgetVisible("sectionAdjustments", false);
988 m_optionWidget->setWidgetVisible("sectionReference", false);
989 m_optionWidget->setWidgetVisible("sectionDragFill", false);
991 m_configGroup.writeEntry("whatToFill", "fillSelection");
992 } else if (button == m_buttonWhatToFillContiguous) {
993 m_optionWidget->setWidgetVisible("sectionRegionExtent", true);
994 m_optionWidget->setWidgetVisible("sectionAdjustments", true);
995 m_optionWidget->setWidgetVisible("sectionReference", true);
996 m_optionWidget->setWidgetVisible("sectionDragFill", true);
998 ->setPrimaryWidgetVisible(true);
1000 ->setWidgetVisible("buttonContiguousFillBoundaryColor", m_contiguousFillMode == ContiguousFillMode_BoundaryFill);
1002 ->setWidgetVisible("sliderCloseGap", true);
1004 ->setWidgetVisible("checkBoxSelectionAsBoundary", true);
1006 m_configGroup.writeEntry("whatToFill", "fillContiguousRegion");
1007 } else {
1008 m_optionWidget->setWidgetVisible("sectionRegionExtent", true);
1009 m_optionWidget->setWidgetVisible("sectionAdjustments", true);
1010 m_optionWidget->setWidgetVisible("sectionReference", true);
1011 m_optionWidget->setWidgetVisible("sectionDragFill", false);
1013 ->setPrimaryWidgetVisible(false);
1015 ->setWidgetVisible("buttonContiguousFillBoundaryColor", false);
1017 ->setWidgetVisible("sliderCloseGap", false);
1019 ->setWidgetVisible("checkBoxSelectionAsBoundary", false);
1021 m_configGroup.writeEntry("whatToFill", "fillSimilarRegions");
1022 }
1023}

References button(), ContiguousFillMode_BoundaryFill, FillMode_FillContiguousRegion, FillMode_FillSelection, FillMode_FillSimilarRegions, m_buttonWhatToFillContiguous, m_buttonWhatToFillSelection, m_configGroup, m_contiguousFillMode, m_fillMode, m_optionWidget, KisOptionCollectionWidget::setWidgetVisible(), and KisOptionCollectionWidget::widgetAs().

◆ slot_sliderCloseGap_valueChanged

void KisToolFill::slot_sliderCloseGap_valueChanged ( int value)
privateslot

Definition at line 1151 of file kis_tool_fill.cc.

1152{
1153 if (value == m_closeGap) {
1154 return;
1155 }
1156 m_closeGap = value;
1157 m_configGroup.writeEntry("closeGapAmount", value);
1158}

References m_closeGap, m_configGroup, and value().

◆ slot_sliderCustomOpacity_valueChanged

void KisToolFill::slot_sliderCustomOpacity_valueChanged ( int value)
privateslot

Definition at line 1079 of file kis_tool_fill.cc.

1080{
1081 if (value == m_customOpacity) {
1082 return;
1083 }
1085 m_configGroup.writeEntry("customOpacity", value);
1086}

References m_configGroup, m_customOpacity, and value().

◆ slot_sliderFeather_valueChanged

void KisToolFill::slot_sliderFeather_valueChanged ( int value)
privateslot

Definition at line 1196 of file kis_tool_fill.cc.

1197{
1198 if (value == m_feather) {
1199 return;
1200 }
1201 m_feather = value;
1202 m_configGroup.writeEntry("featherAmount", value);
1203}

References m_configGroup, m_feather, and value().

◆ slot_sliderGrow_valueChanged

void KisToolFill::slot_sliderGrow_valueChanged ( int value)
privateslot

Definition at line 1178 of file kis_tool_fill.cc.

1179{
1180 if (value == m_sizemod) {
1181 return;
1182 }
1183 m_sizemod = value;
1184 m_configGroup.writeEntry("growSelection", value);
1185}

References m_configGroup, m_sizemod, and value().

◆ slot_sliderPatternScale_valueChanged

void KisToolFill::slot_sliderPatternScale_valueChanged ( double value)
privateslot

Definition at line 1051 of file kis_tool_fill.cc.

1052{
1053 if (value == m_patternScale) {
1054 return;
1055 }
1057 m_configGroup.writeEntry("patternScale", value);
1058}

References m_configGroup, m_patternScale, and value().

◆ slot_sliderSpread_valueChanged

void KisToolFill::slot_sliderSpread_valueChanged ( int value)
privateslot

Definition at line 1142 of file kis_tool_fill.cc.

1143{
1144 if (value == m_opacitySpread) {
1145 return;
1146 }
1148 m_configGroup.writeEntry("opacitySpread", value);
1149}

References m_configGroup, m_opacitySpread, and value().

◆ slot_sliderThreshold_valueChanged

void KisToolFill::slot_sliderThreshold_valueChanged ( int value)
privateslot

Definition at line 1133 of file kis_tool_fill.cc.

1134{
1135 if (value == m_threshold) {
1136 return;
1137 }
1139 m_configGroup.writeEntry("thresholdAmount", value);
1140}

References m_configGroup, m_threshold, and value().

◆ slot_widgetLabels_selectionChanged

void KisToolFill::slot_widgetLabels_selectionChanged ( )
privateslot

Definition at line 1229 of file kis_tool_fill.cc.

1230{
1232 if (labels == m_selectedColorLabels) {
1233 return;
1234 }
1235 m_selectedColorLabels = labels;
1236 if (labels.isEmpty()) {
1237 return;
1238 }
1239 QString colorLabels = QString::number(labels.first());
1240 for (int i = 1; i < labels.size(); ++i) {
1241 colorLabels += "," + QString::number(labels[i]);
1242 }
1243 m_configGroup.writeEntry("colorLabels", colorLabels);
1244}
QList< int > selection() const
Get the list of checked button indices.

References m_configGroup, m_selectedColorLabels, m_widgetLabels, and KisColorLabelSelectorWidget::selection().

◆ slotUpdateFill

void KisToolFill::slotUpdateFill ( )
protectedslot

Definition at line 508 of file kis_tool_fill.cc.

509{
511
514 // clear to not re-add the segments, but retain the last point to maintain continuity
515 m_seedPoints = {m_seedPoints.last()};
516 } else {
518 }
520}
void addUpdateOperation()
QVector< QPoint > rasterizePolylineDDA(const QVector< QPoint > &polylinePoints)

References addFillingOperation(), addUpdateOperation(), FillMode_FillContiguousRegion, KIS_SAFE_ASSERT_RECOVER_RETURN, m_effectiveFillMode, m_fillStrokeId, m_seedPoints, and KritaUtils::rasterizePolylineDDA().

◆ wantsAutoScroll()

bool KisToolFill::wantsAutoScroll ( ) const
inlineoverrideprotectedvirtual

Return if dragging (moving with the mouse down) to the edge of a canvas should scroll the canvas (default is true).

Returns
if this tool wants mouse events to cause scrolling of canvas.

Reimplemented from KoToolBase.

Definition at line 96 of file kis_tool_fill.h.

96{ return false; }

Member Data Documentation

◆ m_angleSelectorPatternRotation

KisAngleSelector* KisToolFill::m_angleSelectorPatternRotation {nullptr}
private

Definition at line 163 of file kis_tool_fill.h.

163{nullptr};

◆ m_antiAlias

bool KisToolFill::m_antiAlias {true}
private

Definition at line 122 of file kis_tool_fill.h.

122{true};

◆ m_buttonContiguousFillBoundaryColor

KisColorButton* KisToolFill::m_buttonContiguousFillBoundaryColor {nullptr}
private

Definition at line 170 of file kis_tool_fill.h.

170{nullptr};

◆ m_buttonContiguousFillModeBoundaryFill

KoGroupButton* KisToolFill::m_buttonContiguousFillModeBoundaryFill {nullptr}
private

Definition at line 169 of file kis_tool_fill.h.

169{nullptr};

◆ m_buttonContiguousFillModeFloodFill

KoGroupButton* KisToolFill::m_buttonContiguousFillModeFloodFill {nullptr}
private

Definition at line 168 of file kis_tool_fill.h.

168{nullptr};

◆ m_buttonDragFillAny

KoGroupButton* KisToolFill::m_buttonDragFillAny {nullptr}
private

Definition at line 188 of file kis_tool_fill.h.

188{nullptr};

◆ m_buttonDragFillDoNotUse

KoGroupButton* KisToolFill::m_buttonDragFillDoNotUse {nullptr}
private

Definition at line 187 of file kis_tool_fill.h.

187{nullptr};

◆ m_buttonDragFillSimilar

KoGroupButton* KisToolFill::m_buttonDragFillSimilar {nullptr}
private

Definition at line 189 of file kis_tool_fill.h.

189{nullptr};

◆ m_buttonFillWithBG

KoGroupButton* KisToolFill::m_buttonFillWithBG {nullptr}
private

Definition at line 160 of file kis_tool_fill.h.

160{nullptr};

◆ m_buttonFillWithFG

KoGroupButton* KisToolFill::m_buttonFillWithFG {nullptr}
private

Definition at line 159 of file kis_tool_fill.h.

159{nullptr};

◆ m_buttonFillWithPattern

KoGroupButton* KisToolFill::m_buttonFillWithPattern {nullptr}
private

Definition at line 161 of file kis_tool_fill.h.

161{nullptr};

◆ m_buttonReferenceAll

KoGroupButton* KisToolFill::m_buttonReferenceAll {nullptr}
private

Definition at line 182 of file kis_tool_fill.h.

182{nullptr};

◆ m_buttonReferenceCurrent

KoGroupButton* KisToolFill::m_buttonReferenceCurrent {nullptr}
private

Definition at line 181 of file kis_tool_fill.h.

181{nullptr};

◆ m_buttonReferenceLabeled

KoGroupButton* KisToolFill::m_buttonReferenceLabeled {nullptr}
private

Definition at line 183 of file kis_tool_fill.h.

183{nullptr};

◆ m_buttonStopGrowingAtDarkestPixel

QToolButton* KisToolFill::m_buttonStopGrowingAtDarkestPixel {nullptr}
private

Definition at line 178 of file kis_tool_fill.h.

178{nullptr};

◆ m_buttonWhatToFillContiguous

KoGroupButton* KisToolFill::m_buttonWhatToFillContiguous {nullptr}
private

Definition at line 156 of file kis_tool_fill.h.

156{nullptr};

◆ m_buttonWhatToFillSelection

KoGroupButton* KisToolFill::m_buttonWhatToFillSelection {nullptr}
private

Definition at line 155 of file kis_tool_fill.h.

155{nullptr};

◆ m_buttonWhatToFillSimilar

KoGroupButton* KisToolFill::m_buttonWhatToFillSimilar {nullptr}
private

Definition at line 157 of file kis_tool_fill.h.

157{nullptr};

◆ m_checkBoxAntiAlias

QCheckBox* KisToolFill::m_checkBoxAntiAlias {nullptr}
private

Definition at line 176 of file kis_tool_fill.h.

176{nullptr};

◆ m_checkBoxCustomBlendingOptions

QCheckBox* KisToolFill::m_checkBoxCustomBlendingOptions {nullptr}
private

Definition at line 164 of file kis_tool_fill.h.

164{nullptr};

◆ m_checkBoxSelectionAsBoundary

QCheckBox* KisToolFill::m_checkBoxSelectionAsBoundary {nullptr}
private

Definition at line 174 of file kis_tool_fill.h.

174{nullptr};

◆ m_checkBoxUseActiveLayer

QCheckBox* KisToolFill::m_checkBoxUseActiveLayer {nullptr}
private

Definition at line 185 of file kis_tool_fill.h.

185{nullptr};

◆ m_closeGap

int KisToolFill::m_closeGap {0}
private

Definition at line 119 of file kis_tool_fill.h.

119{0};

◆ m_comboBoxCustomCompositeOp

KisCompositeOpComboBox* KisToolFill::m_comboBoxCustomCompositeOp {nullptr}
private

Definition at line 166 of file kis_tool_fill.h.

166{nullptr};

◆ m_compressorFillUpdate

KisSignalCompressor KisToolFill::m_compressorFillUpdate
private

Definition at line 145 of file kis_tool_fill.h.

◆ m_configGroup

KConfigGroup KisToolFill::m_configGroup
private

Definition at line 151 of file kis_tool_fill.h.

◆ m_contiguousFillBoundaryColor

KoColor KisToolFill::m_contiguousFillBoundaryColor
private

Definition at line 116 of file kis_tool_fill.h.

◆ m_contiguousFillMode

ContiguousFillMode KisToolFill::m_contiguousFillMode {ContiguousFillMode_FloodFill}
private

Definition at line 115 of file kis_tool_fill.h.

◆ m_continuousFillMode

ContinuousFillMode KisToolFill::m_continuousFillMode {ContinuousFillMode_FillAnyRegion}
private

Definition at line 131 of file kis_tool_fill.h.

◆ m_customCompositeOp

QString KisToolFill::m_customCompositeOp {COMPOSITE_OVER}
private

Definition at line 113 of file kis_tool_fill.h.

◆ m_customOpacity

int KisToolFill::m_customOpacity {100}
private

Definition at line 112 of file kis_tool_fill.h.

112{100};

◆ m_dirtyRect

QSharedPointer<QRect> KisToolFill::m_dirtyRect
private

Definition at line 146 of file kis_tool_fill.h.

◆ m_effectiveFillMode

FillMode KisToolFill::m_effectiveFillMode {FillMode_FillSelection}
private

Definition at line 141 of file kis_tool_fill.h.

◆ m_feather

int KisToolFill::m_feather {0}
private

Definition at line 125 of file kis_tool_fill.h.

125{0};

◆ m_fillMask

KisSelectionSP KisToolFill::m_fillMask
private

Definition at line 133 of file kis_tool_fill.h.

◆ m_fillMode

FillMode KisToolFill::m_fillMode {FillMode_FillContiguousRegion}
private

Definition at line 106 of file kis_tool_fill.h.

◆ m_fillStartWidgetPosition

QPoint KisToolFill::m_fillStartWidgetPosition
private

Definition at line 144 of file kis_tool_fill.h.

◆ m_fillStrokeId

KisStrokeId KisToolFill::m_fillStrokeId
private

Definition at line 148 of file kis_tool_fill.h.

◆ m_fillType

FillType KisToolFill::m_fillType {FillType_FillWithForegroundColor}
private

Definition at line 108 of file kis_tool_fill.h.

◆ m_isDragging

bool KisToolFill::m_isDragging {false}
private

Definition at line 143 of file kis_tool_fill.h.

143{false};

◆ m_isFilling

bool KisToolFill::m_isFilling {false}
private

Definition at line 142 of file kis_tool_fill.h.

142{false};

◆ m_opacitySpread

int KisToolFill::m_opacitySpread {100}
private

Definition at line 118 of file kis_tool_fill.h.

118{100};

◆ m_optionWidget

KisOptionCollectionWidget* KisToolFill::m_optionWidget {nullptr}
private

Definition at line 153 of file kis_tool_fill.h.

153{nullptr};

◆ m_patternRotation

qreal KisToolFill::m_patternRotation {0.0}
private

Definition at line 110 of file kis_tool_fill.h.

110{0.0};

◆ m_patternScale

qreal KisToolFill::m_patternScale {100.0}
private

Definition at line 109 of file kis_tool_fill.h.

109{100.0};

◆ m_previousNode

KisNodeSP KisToolFill::m_previousNode {nullptr}
private

Definition at line 149 of file kis_tool_fill.h.

149{nullptr};

◆ m_previousTime

int KisToolFill::m_previousTime
private

Definition at line 137 of file kis_tool_fill.h.

◆ m_reference

Reference KisToolFill::m_reference {Reference_CurrentLayer}
private

Definition at line 127 of file kis_tool_fill.h.

◆ m_referenceColor

QSharedPointer<KoColor> KisToolFill::m_referenceColor
private

Definition at line 134 of file kis_tool_fill.h.

◆ m_referenceNodeList

KisMergeLabeledLayersCommand::ReferenceNodeInfoListSP KisToolFill::m_referenceNodeList
private

Definition at line 136 of file kis_tool_fill.h.

◆ m_referencePaintDevice

KisPaintDeviceSP KisToolFill::m_referencePaintDevice
private

Definition at line 135 of file kis_tool_fill.h.

◆ m_resourcesSnapshot

KisResourcesSnapshotSP KisToolFill::m_resourcesSnapshot
private

Definition at line 138 of file kis_tool_fill.h.

◆ m_seedPoints

QVector<QPoint> KisToolFill::m_seedPoints
private

Definition at line 147 of file kis_tool_fill.h.

◆ m_selectedColorLabels

QList<int> KisToolFill::m_selectedColorLabels
private

Definition at line 128 of file kis_tool_fill.h.

◆ m_sizemod

int KisToolFill::m_sizemod {0}
private

Definition at line 123 of file kis_tool_fill.h.

123{0};

◆ m_sliderCloseGap

KisSliderSpinBox* KisToolFill::m_sliderCloseGap {nullptr}
private

Definition at line 173 of file kis_tool_fill.h.

173{nullptr};

◆ m_sliderCustomOpacity

KisSliderSpinBox* KisToolFill::m_sliderCustomOpacity {nullptr}
private

Definition at line 165 of file kis_tool_fill.h.

165{nullptr};

◆ m_sliderFeather

KisSliderSpinBox* KisToolFill::m_sliderFeather {nullptr}
private

Definition at line 179 of file kis_tool_fill.h.

179{nullptr};

◆ m_sliderGrow

KisSliderSpinBox* KisToolFill::m_sliderGrow {nullptr}
private

Definition at line 177 of file kis_tool_fill.h.

177{nullptr};

◆ m_sliderPatternScale

KisDoubleSliderSpinBox* KisToolFill::m_sliderPatternScale {nullptr}
private

Definition at line 162 of file kis_tool_fill.h.

162{nullptr};

◆ m_sliderSpread

KisSliderSpinBox* KisToolFill::m_sliderSpread {nullptr}
private

Definition at line 172 of file kis_tool_fill.h.

172{nullptr};

◆ m_sliderThreshold

KisSliderSpinBox* KisToolFill::m_sliderThreshold {nullptr}
private

Definition at line 171 of file kis_tool_fill.h.

171{nullptr};

◆ m_stopGrowingAtDarkestPixel

int KisToolFill::m_stopGrowingAtDarkestPixel {false}
private

Definition at line 124 of file kis_tool_fill.h.

124{false};

◆ m_threshold

int KisToolFill::m_threshold {8}
private

Definition at line 117 of file kis_tool_fill.h.

117{8};

◆ m_transform

QTransform KisToolFill::m_transform
private

Definition at line 139 of file kis_tool_fill.h.

◆ m_useActiveLayer

bool KisToolFill::m_useActiveLayer {false}
private

Definition at line 129 of file kis_tool_fill.h.

129{false};

◆ m_useCustomBlendingOptions

bool KisToolFill::m_useCustomBlendingOptions {false}
private

Definition at line 111 of file kis_tool_fill.h.

111{false};

◆ m_useSelectionAsBoundary

bool KisToolFill::m_useSelectionAsBoundary {true}
private

Definition at line 120 of file kis_tool_fill.h.

120{true};

◆ m_widgetLabels

KisColorLabelSelectorWidget* KisToolFill::m_widgetLabels {nullptr}
private

Definition at line 184 of file kis_tool_fill.h.

184{nullptr};

◆ minimumDragDistance

constexpr int KisToolFill::minimumDragDistance {4}
staticconstexprprivate

Definition at line 103 of file kis_tool_fill.h.

103{4};

◆ minimumDragDistanceSquared

constexpr int KisToolFill::minimumDragDistanceSquared {minimumDragDistance * minimumDragDistance}
staticconstexprprivate

Definition at line 104 of file kis_tool_fill.h.

static constexpr int minimumDragDistance

The documentation for this class was generated from the following files: