|
Krita Source Code Documentation
|
#include <kis_pixel_selection.h>
Inheritance diagram for KisPixelSelection:Public Attributes | |
| QPoint | lod0CachesOffset |
| QPainterPath | outlineCache |
| QMutex | outlineCacheMutex |
| bool | outlineCacheValid |
| KisSelectionWSP | parentSelection |
| QImage | thumbnailImage |
| QTransform | thumbnailImageTransform |
| bool | thumbnailImageValid |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Private Member Functions | |
| void | addSelection (KisPixelSelectionSP selection) |
| QRect | exactBounds () const |
| QRect | extent () const |
| void | extent (qint32 &x, qint32 &y, qint32 &w, qint32 &h) const |
| Convenience method for the above. | |
| void | intersectSelection (KisPixelSelectionSP selection) |
| void | subtractSelection (KisPixelSelectionSP selection) |
| void | symmetricdifferenceSelection (KisPixelSelectionSP selection) |
Private Attributes | |
| Private *const | m_d |
Additional Inherited Members | |
Signals inherited from KisPaintDevice | |
| void | colorSpaceChanged (const KoColorSpace *colorspace) |
| void | profileChanged (const KoColorProfile *profile) |
Static Public Member Functions inherited from KisPaintDevice | |
| static MemoryReleaseObject * | createMemoryReleaseObject () |
Protected Member Functions inherited from KisPaintDevice | |
| void | fastBitBlt (KisPaintDeviceSP src, const QRect &rect) |
| void | fastBitBltOldData (KisPaintDeviceSP src, const QRect &rect) |
| bool | fastBitBltPossible (KisPaintDeviceSP src) |
| void | fastBitBltRough (KisPaintDeviceSP src, const QRect &rect) |
| void | fastBitBltRoughOldData (KisPaintDeviceSP src, const QRect &rect) |
| KisPaintDevice (KisDataManagerSP explicitDataManager, KisPaintDeviceSP src, const QString &name=QString()) | |
| KisNodeWSP | parentNode () const |
Protected Member Functions inherited from KisShared | |
| KisShared () | |
| ~KisShared () | |
KisPixelSelection contains a byte-map representation of a layer, where the value of a byte signifies whether a corresponding pixel is selected, or not.
Definition at line 35 of file kis_pixel_selection.cpp.
| KisPixelSelection::KisPixelSelection | ( | KisDefaultBoundsBaseSP | defaultBounds = KisDefaultBoundsBaseSP(), |
| KisSelectionWSP | parentSelection = KisSelectionWSP() ) |
Create a new KisPixelSelection. This selection will not have a parent paint device.
Definition at line 55 of file kis_pixel_selection.cpp.
References m_d, and parentSelection.
| KisPixelSelection::KisPixelSelection | ( | const KisPixelSelection & | rhs, |
| KritaUtils::DeviceCopyMode | copyMode = KritaUtils::CopySnapshot ) |
Copy the selection
Definition at line 65 of file kis_pixel_selection.cpp.
References m_d.
| KisPixelSelection::KisPixelSelection | ( | const KisPaintDeviceSP | copySource, |
| KritaUtils::DeviceCopyMode | copyMode = KritaUtils::CopySnapshot, | ||
| KisSelectionWSP | parentSelection = KisSelectionWSP() ) |
Create a new selection using the content of copySource as the mask.
Definition at line 79 of file kis_pixel_selection.cpp.
References KisPaintDevice::colorSpace(), KisPaintDevice::convertTo(), KisPaintDevice::KisPaintDevice(), m_d, KisPaintDevice::makeFullCopyFrom(), and parentSelection.
|
override |
|
private |
Add a selection
Definition at line 184 of file kis_pixel_selection.cpp.
References KisPaintDevice::colorSpace(), KisPaintDevice::createHLineConstIteratorNG(), KisPaintDevice::createHLineIteratorNG(), KoColor::data(), KisPaintDevice::defaultPixel(), m_d, MAX_SELECTED, outlineCache, outlineCacheValid, selectedRect(), and KisPaintDevice::setDefaultPixel().
| void KisPixelSelection::applySelection | ( | KisPixelSelectionSP | selection, |
| SelectionAction | action ) |
Apply a selection to the selection using the specified selection mode
Definition at line 141 of file kis_pixel_selection.cpp.
References addSelection(), clear(), intersectSelection(), SELECTION_ADD, SELECTION_INTERSECT, SELECTION_REPLACE, SELECTION_SUBTRACT, SELECTION_SYMMETRICDIFFERENCE, subtractSelection(), and symmetricdifferenceSelection().
|
overridevirtual |
Reset the entire selection. The selectedRect and selectedExactRect will be empty. The selection will be completely deselected.
Reimplemented from KisPaintDevice.
Definition at line 330 of file kis_pixel_selection.cpp.
References KisPaintDevice::clear(), KisPaintDevice::colorSpace(), KoColor::createTransparent(), m_d, and KisPaintDevice::setDefaultPixel().
| void KisPixelSelection::clear | ( | const QRect & | r | ) |
Set the specified rect to MIN_SELECTED.
Definition at line 310 of file kis_pixel_selection.cpp.
References KisPaintDevice::clear(), KisPaintDevice::defaultPixel(), KisFillPainter::fillRect(), KoColorSpaceRegistry::instance(), m_d, MIN_SELECTED, and KoColorSpaceRegistry::rgb8().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 93 of file kis_pixel_selection.cpp.
References KisPixelSelection().
|
overridevirtual |
This is a lowlevel method for the principle used in createCompositionSourceDevice(). In most of the cases the paint device creation methods should be used instead of this function.
Reimplemented from KisPaintDevice.
Definition at line 103 of file kis_pixel_selection.cpp.
References KisPaintDevice::colorSpace(), GrayAColorModelID, KoID::id(), KoColorSpaceRegistry::instance(), and Integer8BitsColorDepthID.
| void KisPixelSelection::copyAlphaFrom | ( | KisPaintDeviceSP | src, |
| const QRect & | processRect ) |
Copies alpha channel form the specified src device
Definition at line 165 of file kis_pixel_selection.cpp.
References m_d, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixel(), KoColorSpace::opacityU8(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::rawData(), and KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::rawDataConst().
|
private |
Get the exact bounds of this paint device. The real solution is very slow because it does a linear scanline search, but it uses caching, so calling to this function without changing the device is quite cheap.
exactBounds follows these rules:
Definition at line 215 of file kis_paint_device.cc.
|
private |
Retrieve the bounds of the paint device. The size is not exact, but may be larger if the underlying datamanager works that way. For instance, the tiled datamanager keeps the extent to the nearest multiple of 64.
If default pixel is not transparent, then the actual extent rect is united with the defaultBounds()->bounds() value (the size of the image, usually).
Definition at line 193 of file kis_paint_device.cc.
|
private |
Convenience method for the above.
Definition at line 196 of file kis_paint_device.cc.
References KisPaintDevice::Private::fastBitBltPossible(), KIS_SAFE_ASSERT_RECOVER_NOOP, and KisPaintDevice::Private::prepareCloneImpl().
|
private |
Intersects a selection using min-T-norm for this.
Definition at line 249 of file kis_pixel_selection.cpp.
References clear(), KisPaintDevice::colorSpace(), KisPaintDevice::createHLineConstIteratorNG(), KisPaintDevice::createHLineIteratorNG(), KisPaintDevice::crop(), KoColor::data(), KisPaintDevice::defaultPixel(), m_d, outlineCache, outlineCacheValid, selectedRect(), KisPaintDevice::setDefaultPixel(), and KritaUtils::tryCloseTornSubpathsAfterIntersection().
| void KisPixelSelection::invalidateOutlineCache | ( | ) |
|
inline |
Definition at line 48 of file kis_pixel_selection.cpp.
| void KisPixelSelection::invert | ( | ) |
Invert the total selection. This will also invert the default value of the selection paint device, from MIN_SELECTED to MAX_SELECTED or back.
Definition at line 343 of file kis_pixel_selection.cpp.
References KisRegion::boundingRect(), bounds, KisPaintDevice::colorSpace(), KoColor::data(), KisPaintDevice::defaultBounds(), KisPaintDevice::defaultPixel(), m_d, MAX_SELECTED, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixel(), KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::rawData(), KisPaintDevice::region(), and KisPaintDevice::setDefaultPixel().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 447 of file kis_pixel_selection.cpp.
References KoColor::data(), KisPaintDevice::defaultPixel(), MIN_SELECTED, and selectedRect().
| bool KisPixelSelection::isTotallyUnselected | ( | const QRect & | r | ) | const |
Tests if the rect is totally outside the selection.
Definition at line 391 of file kis_pixel_selection.cpp.
References KisPaintDevice::defaultPixel(), MIN_SELECTED, and selectedExactRect().
|
virtual |
Convenience method for the above.
Reimplemented from KisPaintDevice.
Definition at line 156 of file kis_paint_device.cc.
References KisPaintDevice::Private::m_frames.
|
overridevirtual |
Overridden from KisPaintDevice to handle outline cache moves
Reimplemented from KisPaintDevice.
Definition at line 368 of file kis_pixel_selection.cpp.
References KisDefaultBoundsBase::currentLevelOfDetail(), KisPaintDevice::defaultBounds(), KisLodTransformBase::lodToInvScale(), m_d, KisPaintDevice::moveTo(), and KisPaintDevice::offset().
| void KisPaintDevice::moveTo | ( | qint32 | x, |
| qint32 | y ) |
Moves the device to these new coordinates (no incremental move)
Definition at line 151 of file kis_paint_device.cc.
| QVector< QPolygon > KisPixelSelection::outline | ( | ) | const |
outline returns the outline of the current selection
When the default pixel is not fully transparent, the exactBounds() return extent of the device instead. To make this value sane we should limit the calculated area by the bounds of the image.
Definition at line 409 of file kis_pixel_selection.cpp.
References KisDefaultBoundsBase::bounds(), KisPaintDevice::colorSpace(), KisPaintDevice::defaultBounds(), KisPaintDevice::defaultPixel(), MIN_SELECTED, KisOutlineGenerator::outline(), KisPaintDevice::readBytes(), selectedExactRect(), and warnKrita.
|
overridevirtual |
Implements KisSelectionComponent.
|
overridevirtual |
Implements KisSelectionComponent.
| KisSelectionWSP KisPixelSelection::parentSelection | ( | ) | const |
| bool KisPixelSelection::read | ( | QIODevice * | stream | ) |
Definition at line 111 of file kis_pixel_selection.cpp.
References m_d, and KisPaintDevice::read().
|
overridevirtual |
The outline generation algorithm has a small bug, which results in the starting point be repeated twice in the beginning of the path, instead of being put to the end. Here we just explicitly close the path to workaround it.
Implements KisSelectionComponent.
Definition at line 479 of file kis_pixel_selection.cpp.
| void KisPixelSelection::recalculateThumbnailImage | ( | const QColor & | maskColor | ) |
Definition at line 541 of file kis_pixel_selection.cpp.
References KisPaintDevice::createThumbnailDevice(), deviceToQImage(), m_d, and selectedExactRect().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 596 of file kis_pixel_selection.cpp.
References renderToProjection(), and selectedExactRect().
|
overridevirtual |
Implements KisSelectionComponent.
Definition at line 601 of file kis_pixel_selection.cpp.
References KisPainter::copyAreaOptimized(), and selectedExactRect().
| void KisPixelSelection::select | ( | const QRect & | r, |
| quint8 | selectedness = MAX_SELECTED ) |
Fill the specified rect with the specified selectedness.
Definition at line 119 of file kis_pixel_selection.cpp.
References KisFillPainter::fillRect(), KoColorSpaceRegistry::instance(), m_d, MIN_SELECTED, and KoColorSpaceRegistry::rgb8().
| QRect KisPixelSelection::selectedExactRect | ( | ) | const |
Slow, but exact way of determining the rectangle that encloses the selection.
Definition at line 404 of file kis_pixel_selection.cpp.
References exactBounds().
| QRect KisPixelSelection::selectedRect | ( | ) | const |
Rough, but fastish way of determining the area of the tiles used by the selection.
Definition at line 399 of file kis_pixel_selection.cpp.
References extent().
| void KisPixelSelection::setOutlineCache | ( | const QPainterPath & | cache | ) |
| void KisPixelSelection::setParentSelection | ( | KisSelectionWSP | selection | ) |
Definition at line 586 of file kis_pixel_selection.cpp.
References m_d.
|
private |
Subtracts a selection
Definition at line 215 of file kis_pixel_selection.cpp.
References KisPaintDevice::colorSpace(), KisPaintDevice::createHLineConstIteratorNG(), KisPaintDevice::createHLineIteratorNG(), KoColor::data(), KisPaintDevice::defaultPixel(), m_d, MIN_SELECTED, outlineCache, outlineCacheValid, selectedRect(), and KisPaintDevice::setDefaultPixel().
|
private |
Invert a selection or intersect with the inverse of a selection
Definition at line 281 of file kis_pixel_selection.cpp.
References KisPaintDevice::colorSpace(), KisPaintDevice::createHLineConstIteratorNG(), KisPaintDevice::createHLineIteratorNG(), KoColor::data(), KisPaintDevice::defaultPixel(), m_d, outlineCache, outlineCacheValid, selectedRect(), and KisPaintDevice::setDefaultPixel().
| QImage KisPixelSelection::thumbnailImage | ( | ) | const |
| QTransform KisPixelSelection::thumbnailImageTransform | ( | ) | const |
| bool KisPixelSelection::thumbnailImageValid | ( | ) | const |
| QPoint KisPixelSelection::lod0CachesOffset |
Definition at line 46 of file kis_pixel_selection.cpp.
|
private |
Definition at line 162 of file kis_pixel_selection.h.
| QPainterPath KisPixelSelection::outlineCache |
Definition at line 38 of file kis_pixel_selection.cpp.
| QMutex KisPixelSelection::outlineCacheMutex |
Definition at line 40 of file kis_pixel_selection.cpp.
| bool KisPixelSelection::outlineCacheValid |
Definition at line 39 of file kis_pixel_selection.cpp.
| KisSelectionWSP KisPixelSelection::parentSelection |
Definition at line 36 of file kis_pixel_selection.cpp.
| QImage KisPixelSelection::thumbnailImage |
Definition at line 43 of file kis_pixel_selection.cpp.
| QTransform KisPixelSelection::thumbnailImageTransform |
Definition at line 44 of file kis_pixel_selection.cpp.
| bool KisPixelSelection::thumbnailImageValid |
Definition at line 42 of file kis_pixel_selection.cpp.