Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tool_utils.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Boudewijn Rempt <boud@valdyas.org>
3 * SPDX-FileCopyrightText: 2018 Emmet & Eoin O'Neill <emmetoneill.pdx@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
8#ifndef KIS_TOOL_UTILS_H
9#define KIS_TOOL_UTILS_H
10
11#include <kis_types.h>
12#include <kritaui_export.h>
13
14class QAction;
15class QPoint;
16class KoColor;
17class KoCanvasBase;
18class KoToolBase;
19class QPainterPath;
20
21namespace KisToolUtils {
22
23struct KRITAUI_EXPORT ColorSamplerConfig {
25
31 int radius;
32 int blend;
33
34 void save() const;
35 void load();
36private:
37 static const QString CONFIG_GROUP_NAME;
38};
39
53bool KRITAUI_EXPORT sampleColor(KoColor &out_color, KisPaintDeviceSP dev, const QPoint &pos,
54 KoColor const *const blendColor = nullptr, int radius = 1,
55 int blend = 100, bool pure = false);
56
60KisNodeSP KRITAUI_EXPORT findNode(KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly = true);
61
62KisNodeList KRITAUI_EXPORT findNodes(KisNodeSP node, const QPoint &point, bool wholeGroup,
63 bool includeGroups = true, bool editableOnly = true);
64
75QPainterPath KRITAUI_EXPORT shapeHoverInfoCrossLayer(KoCanvasBase *canvas, const QPointF &point,
76 QString &shapeType, bool *isHorizontal = nullptr, bool skipCurrentShapes = true);
86bool KRITAUI_EXPORT selectShapeCrossLayer(KoCanvasBase *canvas, const QPointF &point,
87 const QString &shapeType = QString(), bool skipCurrentShapes = true);
88
89
94bool KRITAUI_EXPORT clearImage(KisImageSP image, KisNodeList nodes, KisSelectionSP selection);
95
102void KRITAUI_EXPORT setCursorPos(const QPoint &point);
103
104class KRITAUI_EXPORT MoveShortcutsHelper
105{
106public:
108
109 void activate() {
110 setInternalMoveShortcutsEnabled(false);
111 }
112 void deactivate() {
113 setInternalMoveShortcutsEnabled(false);
114 }
116 setInternalMoveShortcutsEnabled(true);
117 }
119 setInternalMoveShortcutsEnabled(false);
120 }
122 setInternalMoveShortcutsEnabled(false);
123 }
124
125 static QList<QAction*> createActions();
126
127private:
128 void setInternalMoveShortcutsEnabled(bool value);
129
130private:
132};
133}
134
135#endif // KIS_TOOL_UTILS_H
float value(const T *src, size_t ch)
bool selectShapeCrossLayer(KoCanvasBase *canvas, const QPointF &point, const QString &shapeType, bool skipCurrentShapes)
selectShapeCrossLayer Tries to select a shape under the cursor regardless of which layer it is on,...
bool clearImage(KisImageSP image, KisNodeList nodes, KisSelectionSP selection)
void KRITAUI_EXPORT setCursorPos(const QPoint &point)
KisNodeList findNodes(KisNodeSP node, const QPoint &point, bool wholeGroup, bool includeGroups, bool editableOnly)
QPainterPath shapeHoverInfoCrossLayer(KoCanvasBase *canvas, const QPointF &point, QString &shapeType, bool *isHorizontal, bool skipCurrentShapes)
shapeHoverInfoCrossLayer get hover info of shapes on all layers.
KisNodeSP findNode(KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly)
bool sampleColor(KoColor &out_color, KisPaintDeviceSP dev, const QPoint &pos, KoColor const *const blendColor, int radius, int blend, bool pure)
static const QString CONFIG_GROUP_NAME