|
Krita Source Code Documentation
|
Classes | |
| struct | ColorSamplerConfig |
| class | StandardBrushSizes |
Functions | |
| void | bakeDefaultPixel (KisPaintDeviceSP clip, const QRect &rc) |
| KisImageSP | buildImageForClipboard (KisImageSP srcImage, KisNodeList nodes) |
| bool | clearImage (KisImageSP image, KisNodeList nodes, KisSelectionSP selection) |
| void | ensureClipVisible (const QRect &imageBounds, KisPaintDeviceSP clip) |
| KisNodeSP | findNode (KisNodeSP node, const QPoint &point, bool wholeGroup, bool editableOnly) |
| KisNodeList | findNodes (KisNodeSP node, const QPoint &point, bool wholeGroup, bool includeGroups, bool editableOnly) |
| QList< KisShapeLayerSP > | findShapeLayers (KisNodeSP root, const QPointF &point, bool editableOnly) |
| QString | nodeEditableMessage (KisNodeSP node, bool blockedNoIndirectPainting=false) |
| nodeEditableMessage | |
| void | recenterClip (KisPaintDeviceSP clip, const QPoint &newCenter) |
| bool | sampleColor (KoColor &out_color, KisPaintDeviceSP dev, const QPoint &pos, KoColor const *const blendColor, int radius, int blend, bool pure) |
| bool | selectShapeCrossLayer (KoCanvasBase *canvas, const QPointF &point, const QString &shapeType=QString(), bool skipCurrentShapes=true) |
| selectShapeCrossLayer Tries to select a shape under the cursor regardless of which layer it is on, to do so, it will always select the layer first and then the shape. | |
| void KRITAUI_EXPORT | setCursorPos (const QPoint &point) |
| QPainterPath | shapeHoverInfoCrossLayer (KoCanvasBase *canvas, const QPointF &point, QString &shapeType, bool *isHorizontal=nullptr, bool skipCurrentShapes=true) |
| shapeHoverInfoCrossLayer get hover info of shapes on all layers. | |
| void KRITAUI_EXPORT | showBrushSizeFloatingMessage (KoCanvasBase *canvas, qreal size) |
| void | trimDeviceForClipboard (KisImageSP image, KisPaintDeviceSP device, KisSelectionSP selection, bool makeSharpClip) |
| void KRITAUI_EXPORT KisToolUtils::bakeDefaultPixel | ( | KisPaintDeviceSP | clip, |
| const QRect & | rc ) |
If clip has non-transparent default pixel, it will be written into pixels explicitly in the area rc. After that, the default pixel will be reset to "transparent".
Definition at line 537 of file kis_tool_utils.cpp.
References KisPaintDevice::colorSpace(), KisPainter::copyAreaOptimized(), KoColor::createTransparent(), KisPaintDevice::defaultPixel(), OPACITY_TRANSPARENT_U8, KoColor::opacityU8(), and KisPaintDevice::setDefaultPixel().
| KisImageSP KRITAUI_EXPORT KisToolUtils::buildImageForClipboard | ( | KisImageSP | srcImage, |
| KisNodeList | nodes ) |
Creates an image that has the same resolution and size as srcImage, which can be used as a container image for uploading nodes into clipboard.
Definition at line 507 of file kis_tool_utils.cpp.
References KisNodeFacade::addNode(), KisImage::colorSpace(), KisImage::height(), KisImage::refreshGraphAsync(), KisNodeFacade::root, KisImage::setResolution(), KisImage::waitForDone(), KisImage::width(), KisImage::xRes(), and KisImage::yRes().
| bool KRITAUI_EXPORT KisToolUtils::clearImage | ( | KisImageSP | image, |
| KisNodeList | nodes, | ||
| KisSelectionSP | selection ) |
return true if success Clears the image. Selection is optional, use 0 to clear everything.
Definition at line 195 of file kis_tool_utils.cpp.
References KisProcessingApplicator::applyCommand(), KisStrokeJobData::CONCURRENT, KisLayerUtils::filterMergeableNodes(), KisBaseNode::hasEditablePaintDevice(), kundo2_i18n(), KisProcessingApplicator::NONE, and KisLayerUtils::recursiveApplyNodes().
| void KRITAUI_EXPORT KisToolUtils::ensureClipVisible | ( | const QRect & | imageBounds, |
| KisPaintDeviceSP | clip ) |
Make sure non-default area of the clip device is visible within image bounds
The function uses nonDefaultPixelArea() instead of exactBounds(), because the clip may have non-transparent default pixel.
Definition at line 528 of file kis_tool_utils.cpp.
References KisPaintDevice::moveTo(), KisPaintDevice::nonDefaultPixelArea(), and KisPaintDevice::offset().
| KisNodeSP KRITAUI_EXPORT KisToolUtils::findNode | ( | KisNodeSP | node, |
| const QPoint & | point, | ||
| bool | wholeGroup, | ||
| bool | editableOnly = true ) |
Recursively search a node with a non-transparent pixel
Definition at line 118 of file kis_tool_utils.cpp.
References KisPaintDevice::colorSpace(), KisSharedPtr< T >::data(), findNode(), KisBaseNode::isEditable(), KisNode::lastChild(), OPACITY_TRANSPARENT_U8, KoColor::opacityU8(), KisNode::parent, KisGroupLayer::passThroughMode, KisPaintDevice::pixel(), KisNode::prevSibling(), and KisLayer::projection().
| KisNodeList KRITAUI_EXPORT KisToolUtils::findNodes | ( | KisNodeSP | node, |
| const QPoint & | point, | ||
| bool | wholeGroup, | ||
| bool | includeGroups, | ||
| bool | editableOnly ) |
Definition at line 153 of file kis_tool_utils.cpp.
References KisPaintDevice::colorSpace(), KisSharedPtr< T >::data(), findNodes(), KisNode::firstChild(), KisBaseNode::isEditable(), KisNode::nextSibling(), OPACITY_TRANSPARENT_U8, KoColor::opacityU8(), KisNode::parent, KisGroupLayer::passThroughMode, KisPaintDevice::pixel(), and KisLayer::projection().
| QList< KisShapeLayerSP > KisToolUtils::findShapeLayers | ( | KisNodeSP | root, |
| const QPointF & | point, | ||
| bool | editableOnly ) |
Definition at line 332 of file kis_tool_utils.cpp.
References KisBaseNode::isEditable(), and KisLayerUtils::recursiveApplyNodes().
| QString KRITAUI_EXPORT KisToolUtils::nodeEditableMessage | ( | KisNodeSP | node, |
| bool | blockedNoIndirectPainting = false ) |
nodeEditableMessage
| node | – active node. |
| blockedNoIndirectPainting | – whether editing is blocked due no-indirect painting being possible. |
Definition at line 415 of file kis_tool_utils.cpp.
References KisBaseNode::isEditable(), KisBaseNode::userLocked(), and KisBaseNode::visible().
| void KRITAUI_EXPORT KisToolUtils::recenterClip | ( | KisPaintDeviceSP | clip, |
| const QPoint & | newCenter ) |
Moves the center of non-default area to the requested position
Definition at line 521 of file kis_tool_utils.cpp.
References KisPaintDevice::moveTo(), KisPaintDevice::nonDefaultPixelArea(), and KisPaintDevice::offset().
| bool KRITAUI_EXPORT KisToolUtils::sampleColor | ( | KoColor & | out_color, |
| KisPaintDeviceSP | dev, | ||
| const QPoint & | pos, | ||
| KoColor const *const | blendColor = nullptr, | ||
| int | radius = 1, | ||
| int | blend = 100, | ||
| bool | pure = false ) |
Sample a color based on the given position on the given paint device.
out_color - Output parameter returning newly sampled color. dev - Paint device to sample from. pos - Position to sample from. blendColor - Optional color to be blended with. radius - Sampling area radius in pixels. blend - Blend percentage. 100% all sampled, 0% all blendColor. pure - Whether to bypass radius, blending, and active layer settings for pure sampling.
RETURN - Returns TRUE whenever a valid color is sampled.
Definition at line 42 of file kis_tool_utils.cpp.
References KisPaintDevice::colorSpace(), KisPaintDevice::compositionSourceColorSpace(), KoColor::convertTo(), KoMixColorsOp::createMixer(), KoColor::createTransparent(), KoColor::data(), KIS_ASSERT, kisSquareDistance(), KoMixColorsOp::mixColors(), KoColorSpace::mixColorsOp, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nConseqPixels(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixels(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::oldRawData(), OPACITY_TRANSPARENT_U8, KoColor::opacityU8(), KisPaintDevice::pixel(), pow2(), KisPaintDevice::setSupportsWraparoundMode(), KisPaintDevice::supportsWraproundMode(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::x(), and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::y().
| bool KRITAUI_EXPORT KisToolUtils::selectShapeCrossLayer | ( | KoCanvasBase * | canvas, |
| const QPointF & | point, | ||
| const QString & | shapeType = QString(), | ||
| bool | skipCurrentShapes = true ) |
selectShapeCrossLayer Tries to select a shape under the cursor regardless of which layer it is on, to do so, it will always select the layer first and then the shape.
| canvas | – the current canvas. |
| point | – the point in document coordinates. |
| shapeType | – the required shapeId, if empty, selects any koshape. |
Definition at line 387 of file kis_tool_utils.cpp.
References KoSelection::deselectAll(), findShapeLayers(), KisCanvas2::image(), KisViewManager::nodeManager(), KisNodeFacade::root, KoSelection::select(), KoSelection::selectedShapes(), KoShapeManager::selection, KoShapeManager::shapeAt(), KoShape::shapeId(), KisShapeLayer::shapeManager(), KoCanvasBase::shapeManager(), KisCanvas2::shapeManager, KisNodeManager::slotNonUiActivatedNode(), and KisCanvas2::viewManager().
| void KRITAUI_EXPORT KisToolUtils::setCursorPos | ( | const QPoint & | point | ) |
Moves the cursor (hot spot) of the primary screen to the global screen position (x, y).
This function is provided as a replacement to QCursor::setPos which does not properly handle multiple monitors with different scale factors.
Definition at line 309 of file kis_tool_utils.cpp.
| QPainterPath KRITAUI_EXPORT KisToolUtils::shapeHoverInfoCrossLayer | ( | KoCanvasBase * | canvas, |
| const QPointF & | point, | ||
| QString & | shapeType, | ||
| bool * | isHorizontal = nullptr, | ||
| bool | skipCurrentShapes = true ) |
shapeHoverInfoCrossLayer get hover info of shapes on all layers.
| canvas | – current canvas. |
| point | – the point in document coordinates. |
| shapeType | – the shapeID of the found shape. |
| isHorizontal | – when this is a textShape, sets whether the writing mode is horizontal. |
Definition at line 346 of file kis_tool_utils.cpp.
References KoShape::absoluteTransformation(), KoSvgTextShape::boundingRect(), findShapeLayers(), KoSvgText::HorizontalTB, KisCanvas2::image(), KoShape::outline(), p, KisNodeFacade::root, KoSelection::selectedShapes(), KoShapeManager::selection, KoShapeManager::shapeAt(), KoShape::shapeId(), KisShapeLayer::shapeManager(), KoCanvasBase::shapeManager(), KoSvgTextShape::shapesInside, and KoSvgTextShape::writingMode().
| void KRITAUI_EXPORT KisToolUtils::showBrushSizeFloatingMessage | ( | KoCanvasBase * | canvas, |
| qreal | size ) |
Definition at line 319 of file kis_tool_utils.cpp.
References KisFloatingMessage::High, KIS_SAFE_ASSERT_RECOVER_RETURN, KisViewManager::showFloatingMessage(), and KisCanvas2::viewManager().
| void KRITAUI_EXPORT KisToolUtils::trimDeviceForClipboard | ( | KisImageSP | image, |
| KisPaintDeviceSP | device, | ||
| KisSelectionSP | selection, | ||
| bool | makeSharpClip = false ) |
Trims the device for uploading to the clipboard
selection is present, then selection is baked into the device, the whole device is cropped by the selection and the default pixel is reset to "transparentselection is null, then device is just cropped by the image bounds Sharp method is an exact reverse of COMPOSITE_OVER so if you cover the cut/copied piece over its source you get an exactly the same image without any seams
Definition at line 460 of file kis_tool_utils.cpp.
References KoColorSpace::applyAlphaNormedFloatMask(), KoColorSpace::applyAlphaU8Mask(), KisImage::bounds(), KisPaintDevice::colorSpace(), KoColor::createTransparent(), KisPaintDevice::crop(), KIS_SAFE_ASSERT_RECOVER_RETURN, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixel(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::oldRawData(), KoColorSpace::opacityF(), KisSelection::projection(), KisPaintDevice::purgeDefaultPixels(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::rawData(), KisSelection::selectedExactRect(), and KisPaintDevice::setDefaultPixel().