|
Krita Source Code Documentation
|
#include <kis_tool_colorsampler.h>
Inheritance diagram for KisToolColorSampler:Classes | |
| struct | Configuration |
Public Slots | |
| void | slotChangeBlend (int) |
| void | slotChangeRadius (int) |
| void | slotSetAddPalette (bool) |
| void | slotSetColorSource (int value) |
| void | slotSetNormaliseValues (bool) |
| void | slotSetUpdateColor (bool) |
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 | canvasResourceChanged (int key, const QVariant &res) |
| 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 | activatePrimaryAction () override |
| void | beginPrimaryAction (KoPointerEvent *event) override |
| void | continuePrimaryAction (KoPointerEvent *event) override |
| QWidget * | createOptionWidget () override |
| void | deactivatePrimaryAction () override |
| void | endPrimaryAction (KoPointerEvent *event) override |
| KisToolColorSampler (KoCanvasBase *canvas) | |
| void | mouseMoveEvent (KoPointerEvent *event) override |
| void | paint (QPainter &gc, const KoViewConverter &converter) override |
| void | requestUpdateOutline (const QPointF &outlineDocPoint, const KoPointerEvent *event) |
| ~KisToolColorSampler () override | |
Public Member Functions inherited from KisTool | |
| virtual void | activateAlternateAction (AlternateAction action) |
| virtual bool | alternateActionSupportsHiResEvents (AlternateAction action) const |
| virtual void | beginAlternateAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | beginAlternateDoubleClickAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | beginPrimaryDoubleClickAction (KoPointerEvent *event) |
| virtual void | continueAlternateAction (KoPointerEvent *event, AlternateAction action) |
| virtual void | deactivateAlternateAction (AlternateAction action) |
| void | deleteSelection () override |
| virtual void | endAlternateAction (KoPointerEvent *event, AlternateAction action) |
| virtual int | flags () const |
| bool | isActive () const |
| KisTool (KoCanvasBase *canvas, const QCursor &cursor) | |
| void | mouseDoubleClickEvent (KoPointerEvent *event) override |
| void | mousePressEvent (KoPointerEvent *event) override |
| void | mouseReleaseEvent (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 |
| KoCanvasBase * | canvas () 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. | |
| KoToolFactoryBase * | factory () 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 KisPopupWidgetInterface * | popupWidget () |
| virtual bool | selectAll () |
| selectAll select all data the tool can select. | |
| virtual KoToolSelection * | selection () |
| Q_INVOKABLE QString | toolId () const |
| virtual bool | wantsAutoScroll () const |
| ~KoToolBase () override | |
Protected Member Functions | |
| void | activate (const QSet< KoShape * > &) override |
| void | deactivate () override |
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) |
| virtual void | setMode (ToolMode mode) |
| 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) | |
| KoPointerEvent * | lastDeliveredPointerEvent () const |
| void | setAbstractResource (KoAbstractCanvasResourceInterfaceSP abstractResource) |
| void | setConverter (KoDerivedResourceConverterSP converter) |
| void | setIsOpacityPresetMode (bool value) |
| void | setMaskSyntheticEvents (bool value) |
| void | setTextMode (bool value) |
| QHash< int, KoAbstractCanvasResourceInterfaceSP > | toolAbstractResources () |
| QHash< int, KoDerivedResourceConverterSP > | toolConverters () |
| void | useCursor (const QCursor &cursor) |
Private Slots | |
| void | slotChangePalette (int) |
| void | slotColorPickerRequestedCursor (const QCursor &cursor) |
| void | slotColorPickerRequestedCursorReset () |
| void | slotColorPickerRequestedOutlineUpdate () |
| void | slotColorPickerSelectedColor (const KoColor &color) |
| void | slotColorPickerSelectionFinished (const KoColor &color) |
| void | slotSetPreviewStyleComboBoxFromConfig () |
| void | slotSetPreviewStyleConfigFromComboBox () |
Private Member Functions | |
| void | displaySampledColor (const KoColor &color) |
| void | updateOptionWidget () |
Private Attributes | |
| QScopedPointer< KisToolUtils::ColorSamplerConfig > | m_config |
| KisAsyncColorSamplerHelper | m_helper |
| bool | m_isActivated {false} |
| QRectF | m_oldColorPreviewUpdateRect |
| ColorSamplerOptionsWidget * | m_optionsWidget {0} |
| QPointF | m_outlineDocPoint |
| KoColor | m_sampledColor |
| KisTagFilterResourceProxyModel * | m_tagFilterProxyModel {0} |
Definition at line 37 of file kis_tool_colorsampler.h.
| KisToolColorSampler::KisToolColorSampler | ( | KoCanvasBase * | canvas | ) |
Definition at line 35 of file kis_tool_colorsampler.cc.
References m_helper, slotColorPickerRequestedCursor(), slotColorPickerRequestedCursorReset(), slotColorPickerRequestedOutlineUpdate(), slotColorPickerSelectedColor(), and slotColorPickerSelectionFinished().
|
override |
Definition at line 48 of file kis_tool_colorsampler.cc.
References m_config, and m_isActivated.
This method is called when this tool instance is activated. For any main window there is only one tool active at a time, which then gets all user input. Switching between tools will call deactivate on one and activate on the new tool allowing the tool to flush items (like a selection) when it is not in use.
| shapes | the set of shapes that are selected or suggested for editing by a selected shape for the tool to work on. Not all shapes will be meant for this tool. |
Reimplemented from KoToolBase.
Definition at line 127 of file kis_tool_colorsampler.cc.
References KisTool::activate(), m_config, m_isActivated, and updateOptionWidget().
|
overridevirtual |
Called by KisToolProxy when the primary action of the tool is going to be started now, that is when all the modifiers are pressed and the only thing left is just to press the mouse button. On coming of this callback the tool is supposed to prepare the cursor and/or the outline to show the user shat is going to happen next
We explicitly avoid calling KisTool::activatePrimaryAction() here, because it resets the cursor, causing cursor blinking
Reimplemented from KisTool.
Definition at line 180 of file kis_tool_colorsampler.cc.
References Private::canvas, m_config, m_helper, KoCanvasBase::resourceManager, KisAsyncColorSamplerHelper::updateCursor(), and KoCanvasResource::UsingOtherColor.
|
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 146 of file kis_tool_colorsampler.cc.
References KisAsyncColorSamplerHelper::activate(), Private::canvas, m_config, m_helper, KisTool::PAINT_MODE, KoPointerEvent::point, requestUpdateOutline(), KoCanvasBase::resourceManager, KisTool::setMode(), KisAsyncColorSamplerHelper::setUpdateGlobalColor(), KisAsyncColorSamplerHelper::startAction(), and KoCanvasResource::UsingOtherColor.
|
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 163 of file kis_tool_colorsampler.cc.
References CHECK_MODE_SANITY_OR_RETURN, KisAsyncColorSamplerHelper::continueAction(), m_helper, KisTool::PAINT_MODE, KoPointerEvent::point, and requestUpdateOutline().
|
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 290 of file kis_tool_colorsampler.cc.
References KisConfigNotifier::instance(), m_optionsWidget, m_tagFilterProxyModel, KisAbstractResourceModel::Name, ResourceType::Palettes, GeneralTab::setColorSamplerPreviewStyleItems(), KisSpinBoxI18nHelper::setText(), KisConfigNotifier::sigColorSamplerPreviewStyleChanged(), slotChangeBlend(), slotChangePalette(), slotChangeRadius(), slotSetAddPalette(), slotSetColorSource(), slotSetNormaliseValues(), slotSetPreviewStyleComboBoxFromConfig(), slotSetPreviewStyleConfigFromComboBox(), slotSetUpdateColor(), KoToolBase::toolId(), and updateOptionWidget().
|
overrideprotectedvirtual |
This method is called whenever this tool is no longer the active tool
Reimplemented from KoToolBase.
Definition at line 138 of file kis_tool_colorsampler.cc.
References KisTool::deactivate(), m_config, and m_isActivated.
|
overridevirtual |
Called by KisToolProxy when the primary is no longer possible to be started now, e.g. when its modifiers and released. The tool is supposed to revert all the preparations it has done in activatePrimaryAction().
We explicitly avoid calling KisTool::endPrimaryAction() here, because it resets the cursor, causing cursor blinking
Reimplemented from KisTool.
Definition at line 191 of file kis_tool_colorsampler.cc.
Definition at line 238 of file kis_tool_colorsampler.cc.
References KisDisplayColorConverter::applyDisplayFiltering(), Private::canvas, KoColorSpace::channels, KoColorSpace::channelValueText(), KoColorSpace::colorModelId(), KoColor::colorSpace(), KoColor::data(), KisCanvas2::displayColorConverter, Float32BitsColorDepthID, KIS_ASSERT, KIS_SAFE_ASSERT_RECOVER_RETURN, m_config, m_optionsWidget, SampledChannel::name, KoColorSpace::normalisedChannelsValue(), KoColorSpace::normalisedChannelValueText(), RGBAColorModelID, and SampledChannel::valueText.
|
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 171 of file kis_tool_colorsampler.cc.
References CHECK_MODE_SANITY_OR_RETURN, KisAsyncColorSamplerHelper::deactivate(), KisAsyncColorSamplerHelper::endAction(), m_helper, KisTool::PAINT_MODE, KoPointerEvent::point, and requestUpdateOutline().
|
overridevirtual |
Called when the mouse or stylus moved over the canvas. Implementors should call event->ignore() if they do not actually use the event.
| event | state and reason of this mouse or stylus move |
Reimplemented from KisTool.
Definition at line 159 of file kis_tool_colorsampler.cc.
References KisTool::mouseMoveEvent().
|
overridevirtual |
Called by the canvas to paint any decorations that the tool deems needed. The painter has the top left of the canvas as its origin.
| painter | used for painting the shape |
| converter | to convert between internal and view coordinates. |
Implements KoToolBase.
Definition at line 122 of file kis_tool_colorsampler.cc.
References m_helper, and KisAsyncColorSamplerHelper::paint().
| void KisToolColorSampler::requestUpdateOutline | ( | const QPointF & | outlineDocPoint, |
| const KoPointerEvent * | event ) |
Definition at line 199 of file kis_tool_colorsampler.cc.
References Private::canvas, KisAsyncColorSamplerHelper::colorPreviewDocRect(), m_helper, m_oldColorPreviewUpdateRect, m_outlineDocPoint, KisCanvas2::updateCanvas(), KisCanvas2::viewConverter(), and KoViewConverter::zoom().
|
slot |
Definition at line 389 of file kis_tool_colorsampler.cc.
|
privateslot |
Definition at line 399 of file kis_tool_colorsampler.cc.
References m_optionsWidget, KisAbstractResourceModel::Name, and KoToolBase::toolId().
|
slot |
|
privateslot |
Definition at line 55 of file kis_tool_colorsampler.cc.
References KisTool::cursor, and KoToolBase::useCursor().
|
privateslot |
we explicitly avoid resetting the cursor style to avoid blinking of the cursor
Definition at line 60 of file kis_tool_colorsampler.cc.
|
privateslot |
Definition at line 66 of file kis_tool_colorsampler.cc.
References m_outlineDocPoint, and requestUpdateOutline().
Please remember that m_sampledColor also have the alpha of the picked color!
Definition at line 71 of file kis_tool_colorsampler.cc.
References displaySampledColor(), and m_sampledColor.
Definition at line 81 of file kis_tool_colorsampler.cc.
References m_config, m_optionsWidget, m_tagFilterProxyModel, palette, KisTagFilterResourceProxyModel::resourceForIndex(), and KisSwatch::setColor().
|
slot |
Definition at line 379 of file kis_tool_colorsampler.cc.
References m_config.
|
slot |
|
slot |
Definition at line 373 of file kis_tool_colorsampler.cc.
References displaySampledColor(), m_config, and m_sampledColor.
|
privateslot |
Definition at line 104 of file kis_tool_colorsampler.cc.
References m_optionsWidget, and GeneralTab::setColorSamplerPreviewStyleIndexByValue().
|
privateslot |
Definition at line 113 of file kis_tool_colorsampler.cc.
References GeneralTab::getColorSamplerPreviewStyleValue(), m_optionsWidget, and KisConfig::setColorSamplerPreviewStyle().
|
slot |
Definition at line 368 of file kis_tool_colorsampler.cc.
References m_config.
|
private |
Definition at line 354 of file kis_tool_colorsampler.cc.
References m_config, m_optionsWidget, and slotSetPreviewStyleComboBoxFromConfig().
|
private |
Definition at line 104 of file kis_tool_colorsampler.h.
|
private |
Definition at line 113 of file kis_tool_colorsampler.h.
|
private |
Definition at line 106 of file kis_tool_colorsampler.h.
|
private |
Definition at line 109 of file kis_tool_colorsampler.h.
|
private |
Definition at line 115 of file kis_tool_colorsampler.h.
|
private |
Definition at line 107 of file kis_tool_colorsampler.h.
|
private |
Definition at line 111 of file kis_tool_colorsampler.h.
|
private |
Definition at line 116 of file kis_tool_colorsampler.h.