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
71QString KRITAUI_EXPORT nodeEditableMessage(KisNodeSP node, bool blockedNoIndirectPainting = false);
72
83QPainterPath KRITAUI_EXPORT shapeHoverInfoCrossLayer(KoCanvasBase *canvas, const QPointF &point,
84 QString &shapeType, bool *isHorizontal = nullptr, bool skipCurrentShapes = true);
94bool KRITAUI_EXPORT selectShapeCrossLayer(KoCanvasBase *canvas, const QPointF &point,
95 const QString &shapeType = QString(), bool skipCurrentShapes = true);
96
97
102bool KRITAUI_EXPORT clearImage(KisImageSP image, KisNodeList nodes, KisSelectionSP selection);
103
110void KRITAUI_EXPORT setCursorPos(const QPoint &point);
111
112void KRITAUI_EXPORT showBrushSizeFloatingMessage(KoCanvasBase *canvas, qreal size);
113
114class KRITAUI_EXPORT MoveShortcutsHelper
115{
116public:
118
119 void activate() {
120 setInternalMoveShortcutsEnabled(false);
121 }
122 void deactivate() {
123 setInternalMoveShortcutsEnabled(false);
124 }
126 setInternalMoveShortcutsEnabled(true);
127 }
129 setInternalMoveShortcutsEnabled(false);
130 }
132 setInternalMoveShortcutsEnabled(false);
133 }
134
135 static QList<QAction*> createActions();
136
137private:
138 void setInternalMoveShortcutsEnabled(bool value);
139
140private:
142};
143
144class KRITAUI_EXPORT StandardBrushSizes {
145public:
146 StandardBrushSizes(int minSize, int maxSize);
147
148 int increaseBrushSize(qreal size);
149 int decreaseBrushSize(qreal size);
150
151private:
152 std::vector<int> m_sizes;
153};
154}
155
156#endif // KIS_TOOL_UTILS_H
float value(const T *src, size_t ch)
void KRITAUI_EXPORT showBrushSizeFloatingMessage(KoCanvasBase *canvas, qreal size)
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)
QString nodeEditableMessage(KisNodeSP node, bool blockedNoIndirectPainting)
nodeEditableMessage
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