|
Krita Source Code Documentation
|
#include <kis_selection.h>
Inheritance diagram for KisSelection:Classes | |
| struct | ChangeShapeSelectionCommand |
Static Public Member Functions | |
| template<typename T > | |
| static void | safeDeleteShapeSelection (T *object, KisSelection *selection) |
Public Attributes | |
| bool | isVisible |
| KisNodeWSP | parentNode |
| KisPixelSelectionSP | pixelSelection |
| KisImageResolutionProxySP | resolutionProxy |
| KisSelectionComponent * | shapeSelection |
| QReadWriteLock | shapeSelectionPointerLock |
| KisLazyStorage< KisSelectionUpdateCompressor, KisSelection * > | updateCompressor |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Private Member Functions | |
| void | copyFrom (const KisSelection &rhs) |
Private Attributes | |
| Private *const | m_d |
Friends | |
| class | KisAdjustmentLayerTest |
| class | KisDeselectActiveSelectionCommand |
| class | KisMaskTest |
| class | KisSelectionTest |
| class | KisSelectionUpdateCompressor |
| class | KisUpdateSelectionJob |
Additional Inherited Members | |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
KisSelection is a composite object. It may contain an instance of KisPixelSelection and a KisShapeSelection object. Both these selections are merged into a projection of the KisSelection.
Every pixel in the paint device can indicate a degree of selectedness, varying between MIN_SELECTED and MAX_SELECTED.
The projection() paint device itself is only a projection: you can read from it, but not write to it. You need to keep track of the need for updating the projection yourself: there is no automatic updating after changing the contents of one or more of the selection components.
Definition at line 33 of file kis_selection.cc.
| KisSelection::KisSelection | ( | ) |
| KisSelection::KisSelection | ( | KisDefaultBoundsBaseSP | defaultBounds, |
| KisImageResolutionProxySP | resolutionProxy ) |
Create a new KisSelection.
| defaultBounds | defines the bounds of the selection when Select All is initiated. |
| resolutionProxy | defines resolution with which vector selections are rendered |
Definition at line 249 of file kis_selection.cc.
References m_d, and resolutionProxy.
| KisSelection::KisSelection | ( | const KisSelection & | rhs | ) |
Copy the selection. The selection components are copied, too.
Definition at line 266 of file kis_selection.cc.
References copyFrom().
|
virtual |
Delete the selection. The shape selection component is deleted, the pixel selection component is contained in a shared pointer, so that may still be valid.
Definition at line 325 of file kis_selection.cc.
References m_d.
| KisSelection::KisSelection | ( | const KisPaintDeviceSP | copySource, |
| KritaUtils::DeviceCopyMode | copyMode, | ||
| KisDefaultBoundsBaseSP | defaultBounds, | ||
| KisImageResolutionProxySP | resolutionProxy ) |
Create a new selection using the content of copySource as the mask.
Definition at line 273 of file kis_selection.cc.
References m_d, resolutionProxy, and source().
| void KisSelection::clear | ( | ) |
Definition at line 559 of file kis_selection.cc.
References m_d.
| KUndo2Command * KisSelection::convertToVectorSelection | ( | KisSelectionComponent * | shapeSelection | ) |
converts shape selection into the vector state
The selection must not have any shape selection active. It should be checked by calling hasShapeSelection() in advance.
| shapeSelection | new shape selection object that should be attached to the selection |
Definition at line 440 of file kis_selection.cc.
References KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_d, KisSelectionComponent::setResolutionProxy(), and shapeSelection.
| void KisSelection::convertToVectorSelectionNoUndo | ( | KisSelectionComponent * | shapeSelection | ) |
Definition at line 431 of file kis_selection.cc.
References KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, KisSelectionComponent::setResolutionProxy(), and shapeSelection.
|
private |
Definition at line 296 of file kis_selection.cc.
References KritaUtils::CopyAllFrames, KIS_SAFE_ASSERT_RECOVER, KIS_SAFE_ASSERT_RECOVER_NOOP, and m_d.
| KUndo2Command * KisSelection::flatten | ( | ) |
flatten creates a new pixel selection component from the shape selection and throws away the shape selection. This has no effect if there is no shape selection.
Definition at line 575 of file kis_selection.cc.
References KisCommandUtils::CompositeCommand::addCommand(), and m_d.
| bool KisSelection::hasNonEmptyPixelSelection | ( | ) | const |
Definition at line 404 of file kis_selection.cc.
References m_d.
| bool KisSelection::hasNonEmptyShapeSelection | ( | ) | const |
| bool KisSelection::hasShapeSelection | ( | ) | const |
Definition at line 415 of file kis_selection.cc.
References m_d.
| bool KisSelection::isTotallyUnselected | ( | const QRect & | r | ) | const |
Convenience functions. Just call the corresponding methods of the underlying projection
Definition at line 490 of file kis_selection.cc.
References m_d.
| bool KisSelection::isVisible | ( | ) |
| void KisSelection::notifySelectionChanged | ( | ) |
Definition at line 598 of file kis_selection.cc.
References KisNode::graphListener, KisNodeGraphListener::notifySelectionChanged(), and parentNode.
| KisSelection & KisSelection::operator= | ( | const KisSelection & | rhs | ) |
Definition at line 288 of file kis_selection.cc.
References copyFrom().
| QPainterPath KisSelection::outlineCache | ( | ) | const |
| bool KisSelection::outlineCacheValid | ( | ) | const |
| KisNodeWSP KisSelection::parentNode | ( | ) | const |
| KisPixelSelectionSP KisSelection::pixelSelection | ( | ) | const |
return the pixel selection component of this selection. Pixel selection component is always present in the selection. In case the user wants a vector selection, pixel selection will store the pixelated version of it.
NOTE: use pixelSelection() for changing the selection only. For reading the selection and passing the data to bitBlt function use projection(). Although projection() and pixelSelection() currently point to the same paint device, this behavior may change in the future.
|
inline |
Definition at line 34 of file kis_selection.cc.
| KisPixelSelectionSP KisSelection::projection | ( | ) | const |
Returns the projection of the selection. It may be the same as pixel selection. You must read selection data from this paint device only
Definition at line 448 of file kis_selection.cc.
References m_d.
| void KisSelection::recalculateOutlineCache | ( | ) |
| void KisSelection::recalculateThumbnailImage | ( | const QColor & | maskColor | ) |
Recalculates the thumbnail of the selection
Definition at line 389 of file kis_selection.cc.
References m_d.
| void KisSelection::requestCompressedProjectionUpdate | ( | const QRect & | rc | ) |
Request rerendering of the shape selection component in a compressed way. Usually, you don't need to call it manually, because all the work is done by KisShapeSelectionModel.
Definition at line 609 of file kis_selection.cc.
References m_d.
| KisImageResolutionProxySP KisSelection::resolutionProxy | ( | ) | const |
|
static |
| quint8 KisSelection::selected | ( | qint32 | x, |
| qint32 | y ) const |
XXX: This method was marked KDE_DEPRECATED but without information on what to replace it with. Undeprecate, therefore.
Definition at line 614 of file kis_selection.cc.
References m_d, KisBaseConstAccessor::oldRawData(), x(), and y().
| QRect KisSelection::selectedExactRect | ( | ) | const |
Slow, but exact way of determining the rectangle that encloses the selection.
Default pixel of the selection device may vary and you would get wrong bounds. selectedExactRect() handles all these cases.
Definition at line 500 of file kis_selection.cc.
References m_d.
| QRect KisSelection::selectedRect | ( | ) | const |
Definition at line 495 of file kis_selection.cc.
References m_d.
| void KisSelection::setDefaultBounds | ( | KisDefaultBoundsBaseSP | bounds | ) |
Definition at line 541 of file kis_selection.cc.
| void KisSelection::setParentNode | ( | KisNodeWSP | node | ) |
The paint device of the pixel selection should report about it's setDirty events to its parent. The creator should set the parent manually if it wants to get the signals
Definition at line 331 of file kis_selection.cc.
References m_d.
| void KisSelection::setResolutionProxy | ( | KisImageResolutionProxySP | proxy | ) |
| void KisSelection::setVisible | ( | bool | visible | ) |
Definition at line 474 of file kis_selection.cc.
References m_d, and notifySelectionChanged().
| void KisSelection::setX | ( | qint32 | x | ) |
Definition at line 515 of file kis_selection.cc.
| void KisSelection::setY | ( | qint32 | y | ) |
Definition at line 528 of file kis_selection.cc.
| KisSelectionComponent * KisSelection::shapeSelection | ( | ) | const |
return the vector selection component of this selection or zero if hasShapeSelection() returns false.
| QImage KisSelection::thumbnailImage | ( | ) | const |
Returns the thumbnail of the selection.
Definition at line 394 of file kis_selection.cc.
References m_d.
| QTransform KisSelection::thumbnailImageTransform | ( | ) | const |
Returns the transformation which should be applied to the thumbnail before being painted over the image
Definition at line 399 of file kis_selection.cc.
References m_d.
| bool KisSelection::thumbnailImageValid | ( | ) | const |
Tells whether the cached thumbnail of the selection is still valid
Definition at line 384 of file kis_selection.cc.
References m_d.
| void KisSelection::updateProjection | ( | ) |
Definition at line 463 of file kis_selection.cc.
References m_d.
| void KisSelection::updateProjection | ( | const QRect & | rect | ) |
Updates the projection of the selection. You should call this method after the every change of the selection components. There is no automatic updates framework present
Definition at line 453 of file kis_selection.cc.
References m_d.
| qint32 KisSelection::x | ( | ) | const |
Definition at line 505 of file kis_selection.cc.
References m_d.
| qint32 KisSelection::y | ( | ) | const |
Definition at line 510 of file kis_selection.cc.
References m_d.
|
friend |
Definition at line 225 of file kis_selection.h.
|
friend |
Definition at line 228 of file kis_selection.h.
|
friend |
Definition at line 224 of file kis_selection.h.
|
friend |
Definition at line 223 of file kis_selection.h.
|
friend |
Definition at line 227 of file kis_selection.h.
|
friend |
Definition at line 226 of file kis_selection.h.
| bool KisSelection::isVisible |
Definition at line 48 of file kis_selection.cc.
|
private |
Definition at line 235 of file kis_selection.h.
| KisNodeWSP KisSelection::parentNode |
Definition at line 46 of file kis_selection.cc.
| KisPixelSelectionSP KisSelection::pixelSelection |
Definition at line 50 of file kis_selection.cc.
| KisImageResolutionProxySP KisSelection::resolutionProxy |
Definition at line 49 of file kis_selection.cc.
| KisSelectionComponent * KisSelection::shapeSelection |
Definition at line 51 of file kis_selection.cc.
| QReadWriteLock KisSelection::shapeSelectionPointerLock |
This lock makes sure that the shape selection is not reincarnated, while some update jobs still access it via KisSelection::updateProjection().
Definition at line 58 of file kis_selection.cc.
| KisLazyStorage<KisSelectionUpdateCompressor, KisSelection*> KisSelection::updateCompressor |
Definition at line 52 of file kis_selection.cc.