Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_tool_utils.cpp
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#include <kis_tool_utils.h>
9
10#include <KoMixColorsOp.h>
11#include <kis_group_layer.h>
12#include <kis_transaction.h>
15#include <kconfiggroup.h>
16#include <ksharedconfig.h>
17#include "kis_layer_utils.h"
18#include "kis_command_utils.h"
20
21#include "kis_canvas2.h"
22#include <QPainterPath>
23#include <kis_shape_layer.h>
24#include <KoShapeManager.h>
25#include <KoShape.h>
26#include <KoPathShape.h>
27#include <KoSvgTextShape.h>
28#include <KoSvgTextProperties.h>
29#include <KisViewManager.h>
30#include <kis_node_manager.h>
31#include <KoSelection.h>
32#include <kis_painter.h>
33
34#include <algorithm>
35
36#include "KisAnimAutoKey.h"
37
38#include <QApplication>
39
40namespace KisToolUtils {
41
42 bool sampleColor(KoColor &out_color, KisPaintDeviceSP dev, const QPoint &pos,
43 KoColor const *const blendColor, int radius, int blend, bool pure)
44 {
45 KIS_ASSERT(dev);
46
47 // Bugfix hack forcing pure on first sample to avoid wrong
48 // format blendColor on newly initialized Krita.
49 static bool firstTime = true;
50 if (firstTime == true) {
51 pure = true;
52 firstTime = false;
53 }
54
55 const KoColorSpace *cs = dev->colorSpace();
56 KoColor sampledColor = KoColor::createTransparent(cs);
57
58 // Wrap around color sampling is supported on any paint device
59 bool oldSupportsWraparound = dev->supportsWraproundMode();
61
62 // Sampling radius.
63 if (!pure && radius > 1) {
64 QScopedPointer<KoMixColorsOp::Mixer> mixer(cs->mixColorsOp()->createMixer());
65
67 const int effectiveRadius = radius - 1;
68
69 const QRect sampleRect(pos.x() - effectiveRadius, pos.y() - effectiveRadius,
70 2 * effectiveRadius + 1, 2 * effectiveRadius + 1);
71 KisSequentialConstIterator it(dev, sampleRect);
72
73 const int radiusSq = pow2(effectiveRadius);
74
75 int nConseqPixels = it.nConseqPixels();
76 while (it.nextPixels(nConseqPixels)) {
77 const QPoint realPos(it.x(), it.y());
78 if (kisSquareDistance(realPos, pos) < radiusSq) {
79 mixer->accumulateAverage(it.oldRawData(), nConseqPixels);
80 }
81 }
82
83 mixer->computeMixedColor(sampledColor.data());
84
85 } else {
86 dev->pixel(pos.x(), pos.y(), &sampledColor);
87 }
88
89 dev->setSupportsWraparoundMode(oldSupportsWraparound);
90
91 // Color blending.
92 if (!pure && blendColor && blend < 100) {
93 KoColor effectiveBlendColor = *blendColor;
94 effectiveBlendColor.convertTo(dev->colorSpace());
95
96 //Scale from 0..100% to 0..255 range for mixOp weights.
97 quint8 blendScaled = static_cast<quint8>(blend * 2.55f);
98
99 const quint8 *colors[2];
100 colors[0] = effectiveBlendColor.data();
101 colors[1] = sampledColor.data();
102 qint16 weights[2];
103 weights[0] = 255 - blendScaled;
104 weights[1] = blendScaled;
105
106 const KoMixColorsOp *mixOp = dev->colorSpace()->mixColorsOp();
107 mixOp->mixColors(colors, weights, 2, sampledColor.data());
108 }
109
110 sampledColor.convertTo(dev->compositionSourceColorSpace());
111
112 bool validColorSampled = sampledColor.opacityU8() != OPACITY_TRANSPARENT_U8;
113
114 if (validColorSampled) {
115 out_color = sampledColor;
116 }
117
118 return validColorSampled;
119 }
120
121 KisNodeSP findNode(KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly)
122 {
123 KisNodeSP foundNode = 0;
124 while (node) {
125 KisLayerSP layer = qobject_cast<KisLayer*>(node.data());
126
127 if (!layer || !layer->isEditable()) {
128 node = node->prevSibling();
129 continue;
130 }
131
132 KoColor color(layer->projection()->colorSpace());
133 layer->projection()->pixel(point.x(), point.y(), &color);
134
135 KisGroupLayerSP group = dynamic_cast<KisGroupLayer*>(layer.data());
136
137 if ((group && group->passThroughMode()) || color.opacityU8() != OPACITY_TRANSPARENT_U8) {
138 if (layer->inherits("KisGroupLayer") && (!editableOnly || layer->isEditable())) {
139 // if this is a group and the pixel is transparent, don't even enter it
140 foundNode = findNode(node->lastChild(), point, wholeGroup, editableOnly);
141 }
142 else {
143 foundNode = !wholeGroup ? node : node->parent();
144 }
145
146 }
147
148 if (foundNode) break;
149
150 node = node->prevSibling();
151 }
152
153 return foundNode;
154 }
155
156 KisNodeList findNodes(KisNodeSP node, const QPoint &point, bool wholeGroup, bool includeGroups, bool editableOnly)
157 {
158 KisNodeList foundNodes;
159 while (node) {
160 KisLayerSP layer = qobject_cast<KisLayer*>(node.data());
161
162 if (!layer || !layer->isEditable()) {
163 node = node->nextSibling();
164 continue;
165 }
166
167 KoColor color(layer->projection()->colorSpace());
168 layer->projection()->pixel(point.x(), point.y(), &color);
169 const bool isTransparent = color.opacityU8() == OPACITY_TRANSPARENT_U8;
170
171 KisGroupLayerSP group = dynamic_cast<KisGroupLayer*>(layer.data());
172
173 if (group) {
174 if (!isTransparent || group->passThroughMode()) {
175 foundNodes << findNodes(node->firstChild(), point, wholeGroup, includeGroups, editableOnly);
176 if (includeGroups) {
177 foundNodes << node;
178 }
179 }
180 } else {
181 if (!isTransparent) {
182 if (wholeGroup) {
183 if (!foundNodes.contains(node->parent())) {
184 foundNodes << node->parent();
185 }
186 } else {
187 foundNodes << node;
188 }
189 }
190 }
191
192 node = node->nextSibling();
193 }
194
195 return foundNodes;
196 }
197
198 bool clearImage(KisImageSP image, KisNodeList nodes, KisSelectionSP selection)
199 {
200 KisNodeList masks;
201
202 Q_FOREACH (KisNodeSP node, nodes) {
203 if (node->inherits("KisMask")) {
204 masks.append(node);
205 }
206 }
207
208 // To prevent deleting same layer multiple times
210 nodes.append(masks);
211
212 if (nodes.isEmpty()) {
213 return false;
214 }
215
218
219 Q_FOREACH (KisNodeSP node, nodes) {
220 KisLayerUtils::recursiveApplyNodes(node, [&applicator, selection, masks] (KisNodeSP node) {
221
222 // applied on masks if selected explicitly
223 if (node->inherits("KisMask") && !masks.contains(node)) {
224 return;
225 }
226
227 if(node->hasEditablePaintDevice()) {
228 KUndo2Command *cmd =
229 new KisCommandUtils::LambdaCommand(kundo2_i18n("Clear"),
230 [node, selection] () {
231 KisPaintDeviceSP device = node->paintDevice();
232
233 std::unique_ptr<KisCommandUtils::CompositeCommand> parentCommand(
234 new KisCommandUtils::CompositeCommand());
235
236 KUndo2Command *autoKeyframeCommand = KisAutoKey::tryAutoCreateDuplicatedFrame(device);
237 if (autoKeyframeCommand) {
238 parentCommand->addCommand(autoKeyframeCommand);
239 }
240
241 KisTransaction transaction(kundo2_noi18n("internal-clear-command"), device);
242
243 QRect dirtyRect;
244 if (selection) {
245 dirtyRect = selection->selectedRect();
246 device->clearSelection(selection);
247 } else {
248 dirtyRect = device->extent();
249 device->clear();
250 }
251
252 device->setDirty(dirtyRect);
253 parentCommand->addCommand(transaction.endAndTake());
254
255 return parentCommand.release();
256 });
258 }
259 });
260 }
261
262 applicator.end();
263
264 return true;
265 }
266
267 const QString ColorSamplerConfig::CONFIG_GROUP_NAME = "tool_color_sampler";
268
269 ColorSamplerConfig::ColorSamplerConfig()
270 : toForegroundColor(true)
271 , updateColor(true)
272 , addColorToCurrentPalette(false)
273 , normaliseValues(false)
274 , sampleSource(SampleSourceImage)
275 , radius(1)
276 , blend(100)
277 {
278 }
279
281 {
283 props.setProperty("toForegroundColor", toForegroundColor);
284 props.setProperty("updateColor", updateColor);
285 props.setProperty("addPalette", addColorToCurrentPalette);
286 props.setProperty("normaliseValues", normaliseValues);
287 props.setProperty("sampleSource", sampleSource);
288 props.setProperty("radius", radius);
289 props.setProperty("blend", blend);
290
291 KConfigGroup config = KSharedConfig::openConfig()->group(CONFIG_GROUP_NAME);
292
293 config.writeEntry("ColorSamplerDefaultActivation", props.toXML());
294 }
295
297 {
299
300 KConfigGroup config = KSharedConfig::openConfig()->group(CONFIG_GROUP_NAME);
301 props.fromXML(config.readEntry("ColorSamplerDefaultActivation"));
302
303 toForegroundColor = props.getBool("toForegroundColor", true);
304 updateColor = props.getBool("updateColor", true);
305 addColorToCurrentPalette = props.getBool("addPalette", false);
306 normaliseValues = props.getBool("normaliseValues", false);
307 sampleSource = static_cast<ColorSamplerSource>(props.getInt("sampleSource", static_cast<int>(SampleSourceImage)));
308 radius = props.getInt("radius", 1);
309 blend = props.getInt("blend", 100);
310 }
311
312 bool KRITAUI_EXPORT platformSupportsSetCursorPos()
313 {
314 return qApp->platformName() != "wayland";
315 }
316
317 void KRITAUI_EXPORT setCursorPos(const QPoint &point)
318 {
319 // https://bugreports.qt.io/browse/QTBUG-99009
320 QScreen *screen = qApp->screenAt(point);
321 if (!screen) {
322 screen = qApp->primaryScreen();
323 }
324 QCursor::setPos(screen, point);
325 }
326
327 void KRITAUI_EXPORT showBrushSizeFloatingMessage(KoCanvasBase *canvas, qreal size)
328 {
329 KisCanvas2 *kisCanvas = dynamic_cast<KisCanvas2 *>(canvas);
331 kisCanvas->viewManager()->showFloatingMessage(i18n("Brush Size: %1 px", size),
332 QIcon(),
333 1000,
335 Qt::AlignLeft | Qt::TextWordWrap | Qt::AlignVCenter);
336 }
337
338 // get all shape layers with shapes at point. This is a bit coarser than 'FindNodes',
339 // note that point is in Document coordinates instead of image coordinates.
340 QList<KisShapeLayerSP> findShapeLayers(KisNodeSP root, const QPointF &point, bool editableOnly) {
341 QList<KisShapeLayerSP> foundNodes;
343 if ((node->isEditable(true) && editableOnly) || !editableOnly) {
344
345 KisShapeLayerSP shapeLayer = dynamic_cast<KisShapeLayer*>(node.data());
346 if (shapeLayer && shapeLayer->isEditable() && shapeLayer->shapeManager()->shapeAt(point)) {
347 foundNodes.append(shapeLayer);
348 }
349 }
350 });
351 return foundNodes;
352 }
353
354 QPainterPath shapeHoverInfoCrossLayer(KoCanvasBase *canvas, const QPointF &point, QString &shapeType, bool *isHorizontal, bool skipCurrentShapes)
355 {
356 QPainterPath p;
357 KisCanvas2 *canvas2 = dynamic_cast<KisCanvas2*>(canvas);
358 if (!canvas2) return p;
359
360 QList<KoShape*> currentShapes = canvas->shapeManager()->selection()->selectedShapes();
361 QList<KisShapeLayerSP> candidates = findShapeLayers(canvas2->image()->root(), point, true);
362 KisShapeLayerSP shapeLayer = candidates.isEmpty()? nullptr: candidates.last();
363
364 if (shapeLayer) {
365 KoShape *shape = shapeLayer->shapeManager()->shapeAt(point);
366 if (shape && !(currentShapes.contains(shape) && skipCurrentShapes)) {
367 shapeType = shape->shapeId();
368 KoSvgTextShape *t = dynamic_cast<KoSvgTextShape *>(shape);
369 if (t) {
370 p.addRect(t->boundingRect());
371 if (isHorizontal) {
372 *isHorizontal = t->writingMode() == KoSvgText::HorizontalTB;
373 }
374 if (!t->shapesInside().isEmpty()) {
375 QPainterPath paths;
376 Q_FOREACH(KoShape *s, t->shapesInside()) {
377 KoPathShape *path = dynamic_cast<KoPathShape *>(s);
378 if (path) {
379 paths.addPath(path->absoluteTransformation().map(path->outline()));
380 }
381 }
382 if (!paths.isEmpty()) {
383 p = paths;
384 }
385 }
386 } else {
387 p = shape->absoluteTransformation().map(shape->outline());
388 }
389 }
390 }
391
392 return p;
393 }
394
395 bool selectShapeCrossLayer(KoCanvasBase *canvas, const QPointF &point, const QString &shapeType, bool skipCurrentShapes)
396 {
397 KisCanvas2 *canvas2 = dynamic_cast<KisCanvas2*>(canvas);
398 if (!canvas2) return false;
399
400 QList<KoShape*> currentShapes = canvas->shapeManager()->selection()->selectedShapes();
401 QList<KisShapeLayerSP> candidates = findShapeLayers(canvas2->image()->root(), point, true);
402 KisShapeLayerSP shapeLayer = candidates.isEmpty()? nullptr: candidates.last();
403
404 if (shapeLayer) {
405 KoShape *shape = shapeLayer->shapeManager()->shapeAt(point);
406 if (shape
407 && !(currentShapes.contains(shape) && skipCurrentShapes)
408 && (shapeType.isEmpty() || shapeType == shape->shapeId())) {
409 canvas2->viewManager()->nodeManager()->slotNonUiActivatedNode(shapeLayer);
410 canvas2->shapeManager()->selection()->deselectAll();
411 canvas2->shapeManager()->selection()->select(shape);
412 } else {
413 return false;
414 }
415 } else {
416 return false;
417 }
418
419 return true;
420 }
421
422
423 QString nodeEditableMessage(KisNodeSP node, bool blockedNoIndirectPainting)
424 {
425 QString message;
426 if (!node->isEditable(true) || blockedNoIndirectPainting) {
427 if (!node->visible() && node->userLocked()) {
428 message = i18n("Layer is locked and invisible.");
429 } else if (node->userLocked()) {
430 message = i18n("Layer is locked.");
431 } else if(!node->visible()) {
432 message = i18n("Layer is invisible.");
433 } else if (blockedNoIndirectPainting) {
434 message = i18n("Layer can't be painted in Build Up mode.");
435 } else {
436 message = i18n("Group not editable.");
437 }
438 }
439 return message;
440 }
441
442
444 {
445 int brushSize = minSize;
446 do {
447 m_sizes.push_back(brushSize);
448 int increment = qMax(1, int(std::ceil(qreal(brushSize) / 15)));
449 brushSize += increment;
450 } while (brushSize < maxSize);
451 m_sizes.push_back(maxSize);
452 }
453
455 {
456 std::vector<int>::iterator result = std::upper_bound(m_sizes.begin(), m_sizes.end(), qRound(size));
457 return result != m_sizes.end() ? *result : m_sizes.back();
458 }
459
461 {
462 std::vector<int>::reverse_iterator result =
463 std::upper_bound(m_sizes.rbegin(), m_sizes.rend(), qRound(size), std::greater<int>());
464 return result != m_sizes.rend() ? *result : m_sizes.front();
465 }
466
467
469 KisPaintDeviceSP device,
470 KisSelectionSP selection,
471 bool makeSharpClip)
472 {
474
475 QRect rc = selection ? selection->selectedExactRect() : image->bounds();
476
477 const KoColorSpace *cs = device->colorSpace();
478
479 if (selection) {
480 // Apply selection mask.
481 KisPaintDeviceSP selectionProjection = selection->projection();
482 const KoColorSpace *selCs = selection->projection()->colorSpace();
483
484 KisSequentialIterator layerIt(device, rc);
485 KisSequentialConstIterator selectionIt(selectionProjection, rc);
486
487 while (layerIt.nextPixel() && selectionIt.nextPixel()) {
488
494 if (makeSharpClip) {
495 qreal dstAlpha = cs->opacityF(layerIt.rawData());
496 qreal sel = selCs->opacityF(selectionIt.oldRawData());
497 qreal newAlpha = sel * dstAlpha / (1.0 - dstAlpha + sel * dstAlpha);
498 float mask = newAlpha / dstAlpha;
499
500 cs->applyAlphaNormedFloatMask(layerIt.rawData(), &mask, 1);
501 } else {
502 cs->applyAlphaU8Mask(layerIt.rawData(), selectionIt.oldRawData(), 1);
503 }
504 }
505
506 // if we have a selection, then we should remove the rest of the image
507 // and make it fully transparent
509 device->purgeDefaultPixels();
510 }
511
512 device->crop(rc);
513 }
514
516 {
517 KisImageSP clipImage = new KisImage(0, srcImage->width(), srcImage->height(), srcImage->colorSpace(), "ClipImage");
518 clipImage->setResolution(srcImage->xRes(), srcImage->yRes());
519 Q_FOREACH (KisNodeSP node, nodes) {
520 clipImage->addNode(node, clipImage->root());
521 }
522
523 clipImage->refreshGraphAsync();
524 clipImage->waitForDone();
525
526 return clipImage;
527 }
528
529 void recenterClip(KisPaintDeviceSP clip, const QPoint &newCenter)
530 {
531 const QRect clipBounds = clip->nonDefaultPixelArea();
532 const QPoint diff = newCenter - clipBounds.center();
533 clip->moveTo(clip->offset() + diff);
534 }
535
536 void ensureClipVisible(const QRect &imageBounds, KisPaintDeviceSP clip)
537 {
538 const QRect clipBounds = clip->nonDefaultPixelArea();
539 if (!imageBounds.intersects(clipBounds)) {
540 const QPoint diff = imageBounds.center() - clipBounds.center();
541 clip->moveTo(clip->offset() + diff);
542 }
543 }
544
545 void bakeDefaultPixel(KisPaintDeviceSP clip, const QRect &rc)
546 {
548 KisPaintDeviceSP copy = new KisPaintDevice(clip->colorSpace());
549 copy->makeCloneFromRough(clip, rc);
550 KisPainter::copyAreaOptimized(rc.topLeft(), copy, clip, rc);
552 }
553 }
554
555}
const Params2D p
QVector< KisImageSignalType > KisImageSignalVector
const quint8 OPACITY_TRANSPARENT_U8
KisImageWSP image() const
KoShapeManager shapeManager
KisViewManager * viewManager() const
void waitForDone()
void refreshGraphAsync(KisNodeSP root, const QVector< QRect > &rects, const QRect &cropRect, KisProjectionUpdateFlags flags=KisProjectionUpdateFlag::None) override
const KoColorSpace * colorSpace() const
qint32 width() const
double xRes() const
double yRes() const
qint32 height() const
QRect bounds() const override
void setResolution(double xres, double yres)
void slotNonUiActivatedNode(KisNodeSP node)
void crop(qint32 x, qint32 y, qint32 w, qint32 h)
bool supportsWraproundMode() const
void setDefaultPixel(const KoColor &defPixel)
QRect nonDefaultPixelArea() const
virtual const KoColorSpace * compositionSourceColorSpace() const
const KoColorSpace * colorSpace() const
void setSupportsWraparoundMode(bool value)
KoColor defaultPixel() const
bool pixel(qint32 x, qint32 y, QColor *c) const
void moveTo(qint32 x, qint32 y)
QPoint offset() const
static void copyAreaOptimized(const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect)
void applyCommand(KUndo2Command *command, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
ALWAYS_INLINE quint8 * rawData()
ALWAYS_INLINE int x() const
ALWAYS_INLINE const quint8 * oldRawData() const
ALWAYS_INLINE int y() const
KoShapeManager * shapeManager() const
StandardBrushSizes(int minSize, int maxSize)
KisNodeManager * nodeManager() const
The node manager handles everything about nodes.
void showFloatingMessage(const QString &message, const QIcon &icon, int timeout=4500, KisFloatingMessage::Priority priority=KisFloatingMessage::Medium, int alignment=Qt::AlignCenter|Qt::TextWordWrap)
shows a floating message in the top right corner of the canvas
virtual KoShapeManager * shapeManager() const =0
virtual void applyAlphaU8Mask(quint8 *pixels, const quint8 *alpha, qint32 nPixels) const =0
virtual qreal opacityF(const quint8 *pixel) const =0
virtual void applyAlphaNormedFloatMask(quint8 *pixels, const float *alpha, qint32 nPixels) const =0
KoMixColorsOp * mixColorsOp
void convertTo(const KoColorSpace *cs, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags)
Definition KoColor.cpp:136
static KoColor createTransparent(const KoColorSpace *cs)
Definition KoColor.cpp:682
quint8 * data()
Definition KoColor.h:144
quint8 opacityU8() const
Definition KoColor.cpp:341
virtual Mixer * createMixer() const =0
virtual void mixColors(const quint8 *const *colors, const qint16 *weights, int nColors, quint8 *dst, int weightSum=255) const =0
The position of a path point within a path shape.
Definition KoPathShape.h:63
void deselectAll()
clear the selections list
void select(KoShape *shape)
const QList< KoShape * > selectedShapes() const
KoShape * shapeAt(const QPointF &position, KoFlake::ShapeSelection selection=KoFlake::ShapeOnTop, bool omitHiddenShapes=true)
KoSelection * selection
QString shapeId() const
Definition KoShape.cpp:878
virtual QPainterPath outline() const
Definition KoShape.cpp:554
QTransform absoluteTransformation() const
Definition KoShape.cpp:330
QRectF boundingRect() const override
Get the bounding box of the shape.
QList< KoShape * > shapesInside
KoSvgText::WritingMode writingMode() const
writingMode There's a number of places we need to check the writing mode to provide proper controls.
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_ASSERT(cond)
Definition kis_assert.h:33
T pow2(const T &x)
Definition kis_global.h:166
qreal kisSquareDistance(const QPointF &pt1, const QPointF &pt2)
Definition kis_global.h:194
KUndo2MagicString kundo2_i18n(const char *text)
void recursiveApplyNodes(NodePointer node, Functor func)
void filterMergeableNodes(KisNodeList &nodes, bool allowMasks)
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)
KisImageSP buildImageForClipboard(KisImageSP srcImage, KisNodeList nodes)
KisNodeList findNodes(KisNodeSP node, const QPoint &point, bool wholeGroup, bool includeGroups, bool editableOnly)
bool KRITAUI_EXPORT platformSupportsSetCursorPos()
QString nodeEditableMessage(KisNodeSP node, bool blockedNoIndirectPainting)
nodeEditableMessage
void trimDeviceForClipboard(KisImageSP image, KisPaintDeviceSP device, KisSelectionSP selection, bool makeSharpClip)
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)
void bakeDefaultPixel(KisPaintDeviceSP clip, const QRect &rc)
bool sampleColor(KoColor &out_color, KisPaintDeviceSP dev, const QPoint &pos, KoColor const *const blendColor, int radius, int blend, bool pure)
void ensureClipVisible(const QRect &imageBounds, KisPaintDeviceSP clip)
void recenterClip(KisPaintDeviceSP clip, const QPoint &newCenter)
QList< KisShapeLayerSP > findShapeLayers(KisNodeSP root, const QPointF &point, bool editableOnly)
@ HorizontalTB
Definition KoSvgText.h:38
bool isEditable(bool checkVisibility=true) const
bool userLocked() const
virtual bool visible(bool recursive=false) const
bool hasEditablePaintDevice() const
KisPaintDeviceSP projection() const override
Definition kis_layer.cc:826
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
KisNodeSP prevSibling() const
Definition kis_node.cpp:402
KisNodeSP firstChild() const
Definition kis_node.cpp:361
KisNodeWSP parent
Definition kis_node.cpp:86
KisNodeSP lastChild() const
Definition kis_node.cpp:367
KisNodeSP nextSibling() const
Definition kis_node.cpp:408
void toXML(QDomDocument &, QDomElement &) const override
bool fromXML(const QString &xml, bool clear=true) override
virtual void setProperty(const QString &name, const QVariant &value)
bool getBool(const QString &name, bool def=false) const
int getInt(const QString &name, int def=0) const
KisPixelSelectionSP projection() const
QRect selectedExactRect() const
Slow, but exact way of determining the rectangle that encloses the selection.
static const QString CONFIG_GROUP_NAME