|
Krita Source Code Documentation
|
#include <kis_scanline_fill.h>
Inheritance diagram for KisScanlineFill:Public Types | |
| template<class T > | |
| using | GreaterPriorityQueue = std::priority_queue<T, std::vector<T>, std::greater<T>> |
Public Attributes | |
| KisFillIntervalMap | backwardMap |
| QRect | boundingRect |
| int | closeGap |
| try to close gaps up to this size in pixels | |
| GreaterPriorityQueue< CloseGapFillPoint > | closeGapQueue |
| KisPaintDeviceSP | device |
| KisRandomAccessorSP | filledSelectionIterator |
| QRect | fillExtent |
| QStack< KisFillInterval > | forwardStack |
| KisGapMapSP | gapMapSp |
| maintains the distance and opacity maps required for the algorithm | |
| int | opacitySpread |
| int | rowIncrement |
| QPoint | startPoint |
| int | threshold |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Private Member Functions | |
| template<typename DifferencePolicy , typename SelectionPolicy , typename PixelAccessPolicy > | |
| KisFillInterval | closeGapPass (DifferencePolicy &differencePolicy, SelectionPolicy &selectionPolicy, PixelAccessPolicy &pixelAccessPolicy) |
| template<typename DifferencePolicy , typename SelectionPolicy , typename PixelAccessPolicy > | |
| void | extendedPass (KisFillInterval *currentInterval, int srcRow, bool extendRight, DifferencePolicy &differencePolicy, SelectionPolicy &selectionPolicy, PixelAccessPolicy &pixelAccessPolicy) |
| template<typename DifferencePolicy , typename SelectionPolicy , typename PixelAccessPolicy > | |
| bool | fillOpacity (DifferencePolicy &differencePolicy, SelectionPolicy &selectionPolicy, PixelAccessPolicy &pixelAccessPolicy, KisPaintDevice *const devicePtr, const QRect &rect) const |
| template<typename DifferencePolicy , typename SelectionPolicy , typename PixelAccessPolicy > | |
| void | processLine (KisFillInterval interval, const int rowIncrement, DifferencePolicy &differencePolicy, SelectionPolicy &selectionPolicy, PixelAccessPolicy &pixelAccessPolicy) |
| template<typename DifferencePolicy , typename SelectionPolicy , typename PixelAccessPolicy > | |
| void | runImpl (DifferencePolicy &differencePolicy, SelectionPolicy &selectionPolicy, PixelAccessPolicy &pixelAccessPolicy) |
| template<template< typename SrcPixelType > typename OptimizedDifferencePolicy, typename SlowDifferencePolicy , typename SelectionPolicy , typename PixelAccessPolicy > | |
| void | selectDifferencePolicyAndRun (const KoColor &srcColor, SelectionPolicy &selectionPolicy, PixelAccessPolicy &pixelAccessPolicy) |
| KisFillIntervalMap * | testingGetBackwardIntervals () const |
| QVector< KisFillInterval > | testingGetForwardIntervals () const |
| void | testingProcessLine (const KisFillInterval &processInterval) |
| bool | tryPushingCloseGapSeed (int x, int y, bool allowExpand) |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
Friends | |
| class | KisScanlineFillTest |
Definition at line 277 of file kis_scanline_fill.cpp.
| using KisScanlineFill::GreaterPriorityQueue = std::priority_queue<T, std::vector<T>, std::greater<T>> |
Definition at line 297 of file kis_scanline_fill.cpp.
| KisScanlineFill::KisScanlineFill | ( | KisPaintDeviceSP | device, |
| const QPoint & | startPoint, | ||
| const QRect & | boundingRect ) |
Definition at line 317 of file kis_scanline_fill.cpp.
References boundingRect, device, m_d, and startPoint.
| KisScanlineFill::~KisScanlineFill | ( | ) |
Definition at line 331 of file kis_scanline_fill.cpp.
| void KisScanlineFill::clearNonZeroComponent | ( | ) |
Clear the contiguous non-zero area of the device
WARNING: the threshold parameter is not counted!
Definition at line 1003 of file kis_scanline_fill.cpp.
References KoColor::createTransparent(), m_d, and runImpl().
|
private |
Definition at line 529 of file kis_scanline_fill.cpp.
References distance(), KisGapMap::DISTANCE_INFINITE, KisFillInterval::end, KisFillInterval::isValid(), m_d, p, KisFillInterval::row, and KisFillInterval::start.
|
private |
Definition at line 392 of file kis_scanline_fill.cpp.
References KisFillInterval::end, KisFillInterval::isValid(), m_d, KisFillInterval::start, and tryPushingCloseGapSeed().
Fill the source device with fillColor
Definition at line 773 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), and m_d.
| void KisScanlineFill::fill | ( | const KoColor & | fillColor, |
| KisPaintDeviceSP | externalDevice ) |
Fill externalDevice with fillColor basing on the contents of the source device.
Definition at line 804 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), and m_d.
| void KisScanlineFill::fillContiguousGroup | ( | KisPaintDeviceSP | groupMapDevice, |
| qint32 | groupIndex ) |
A special filler algorithm for the Watershed initialization routine:
1) Clear the contiguous area in the destination device 2) At the same time, fill the corresponding area of groupMapDevice with value groupIndex 3) groupMapDevice must store 4 bytes per pixel
Definition at line 1035 of file kis_scanline_fill.cpp.
References KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, KisPaintDevice::pixelSize(), and runImpl().
| QRect KisScanlineFill::fillExtent | ( | ) | const |
Returns the extent of the last filled region
|
private |
This opacity-only fill is used by KisGapMap.
Using the same policies as the main fill, load the opacity values for a rect of the main filled region. The rect typically corresponds to a tile of an opacity map maintained by KisGapMap, and is loaded on-demand during an ongoing runImpl() loop.
Definition at line 1060 of file kis_scanline_fill.cpp.
References KisPaintDevice::createRandomAccessorNG(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, MIN_SELECTED, KisRandomConstAccessorNG::moveTo(), and KisBaseAccessor::rawData().
| void KisScanlineFill::fillSelection | ( | KisPixelSelectionSP | pixelSelection | ) |
Fill pixelSelection with the opacity of the contiguous area
Definition at line 862 of file kis_scanline_fill.cpp.
References KisPaintDevice::createRandomAccessorNG(), and m_d.
| void KisScanlineFill::fillSelection | ( | KisPixelSelectionSP | pixelSelection, |
| KisPaintDeviceSP | boundarySelection ) |
Fill pixelSelection with the opacity of the contiguous area. This method uses an existing selection as boundary for the flood fill.
Definition at line 835 of file kis_scanline_fill.cpp.
References KisPaintDevice::createRandomAccessorNG(), and m_d.
| void KisScanlineFill::fillSelectionUntilColor | ( | KisPixelSelectionSP | pixelSelection, |
| const KoColor & | boundaryColor ) |
Fill pixelSelection with the opacity of the contiguous area, which encompass all the connected pixels as long as the color in the pixels of the source device is not similar to boundaryColor.
Definition at line 915 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), KisPaintDevice::createRandomAccessorNG(), and m_d.
| void KisScanlineFill::fillSelectionUntilColor | ( | KisPixelSelectionSP | pixelSelection, |
| const KoColor & | boundaryColor, | ||
| KisPaintDeviceSP | boundarySelection ) |
Fill pixelSelection with the opacity of the contiguous area, which encompass all the connected pixels as long as the color in the pixels of the source device is not similar to boundaryColor. This method uses an existing selection as boundary for the flood fill.
Definition at line 887 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), KisPaintDevice::createRandomAccessorNG(), and m_d.
| void KisScanlineFill::fillSelectionUntilColorOrTransparent | ( | KisPixelSelectionSP | pixelSelection, |
| const KoColor & | boundaryColor ) |
Fill pixelSelection with the opacity of the contiguous area, which encompass all the connected pixels as long as the color in the pixels of the source device is not similar to boundaryColor or transparent.
Definition at line 973 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), KisPaintDevice::createRandomAccessorNG(), m_d, and selectDifferencePolicyAndRun().
| void KisScanlineFill::fillSelectionUntilColorOrTransparent | ( | KisPixelSelectionSP | pixelSelection, |
| const KoColor & | boundaryColor, | ||
| KisPaintDeviceSP | boundarySelection ) |
Fill pixelSelection with the opacity of the contiguous area, which encompass all the connected pixels as long as the color in the pixels of the source device is not similar to boundaryColor or transparent. This method uses an existing selection as boundary for the flood fill.
Definition at line 943 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), KisPaintDevice::createRandomAccessorNG(), m_d, and selectDifferencePolicyAndRun().
Fill the source device with fillColor until boundaryColor is reached
Definition at line 788 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), and m_d.
| void KisScanlineFill::fillUntilColor | ( | const KoColor & | fillColor, |
| const KoColor & | boundaryColor, | ||
| KisPaintDeviceSP | externalDevice ) |
Fill externalDevice with fillColor basing on the contents of the source device. Fills until boundaryColor is reached
Definition at line 819 of file kis_scanline_fill.cpp.
References KoColor::convertTo(), and m_d.
|
private |
Definition at line 453 of file kis_scanline_fill.cpp.
References KisFillInterval::end, extendedPass(), KisFillInterval::invalidate(), KisFillInterval::isValid(), m_d, KisFillInterval::row, rowIncrement, KisFillInterval::start, and tryPushingCloseGapSeed().
|
private |
In the end of the first pass we should add an interval containing the starting pixel, but directed into the opposite direction. We cannot do it in the very beginning because the intervals are offset by 1 pixel during every swap operation.
Definition at line 622 of file kis_scanline_fill.cpp.
References closeGapPass(), fillOpacity(), KisFillInterval::isValid(), KIS_ASSERT_RECOVER_RETURN, KIS_SAFE_ASSERT_RECOVER, m_d, processLine(), KisFillInterval::row, KisFillInterval::start, and tryPushingCloseGapSeed().
|
private |
Definition at line 749 of file kis_scanline_fill.cpp.
References KoColor::colorSpace(), m_d, KoColorSpace::pixelSize(), and runImpl().
| void KisScanlineFill::setCloseGap | ( | int | closeGap | ) |
Set the close gap size in pixels for the flood fill. The value 0 behaves like a regular fill. Values 1 and larger will cause a gap map to be computed for the area and then used for the fill. The gaps are small areas of non-opaque pixels that are roughly not larger than the selected gap size. If such a gap is detected, the fill will stop spreading beyond that area.
Definition at line 345 of file kis_scanline_fill.cpp.
| void KisScanlineFill::setOpacitySpread | ( | int | opacitySpread | ) |
Set the opacity spread for floodfill. The range is 0-100: 0% means that the fully opaque area only encompasses the pixels exactly equal to the seed point with the other pixels of the selected region being semi-transparent (depending on how similar they are to the seed pixel) up to the region boundary (given by the threshold value). 100 means that the fully opaque area will encompass all the pixels of the selected region up to the contour. Any value in between will make the fully opaque portion of the region vary in size, with semi-transparent pixels in between it and the region boundary
Definition at line 340 of file kis_scanline_fill.cpp.
References m_d, and opacitySpread.
| void KisScanlineFill::setThreshold | ( | int | threshold | ) |
Set the threshold of the filling operation
Used in all functions except clearNonZeroComponent()
Definition at line 335 of file kis_scanline_fill.cpp.
|
inline |
Definition at line 305 of file kis_scanline_fill.cpp.
References KisFillIntervalMap::clear(), KisFillIntervalMap::fetchAllIntervals(), and KIS_SAFE_ASSERT_RECOVER_NOOP.
|
private |
Definition at line 1131 of file kis_scanline_fill.cpp.
References m_d.
|
private |
Definition at line 1126 of file kis_scanline_fill.cpp.
References m_d.
|
private |
Definition at line 1112 of file kis_scanline_fill.cpp.
References m_d, and processLine().
|
inlineprivate |
Used with the scanline fill algorithm.
Determine if the (x, y) pixel is near a gap (i.e., has non-INFINITE distance). All gap pixels are pushed onto the gap closing fill queue, while the scanline fill proceeds with regular pixels.
| allowExpand | is only true for the initial gap closing seed. |
Definition at line 368 of file kis_scanline_fill.cpp.
References distance(), KisGapMap::DISTANCE_INFINITE, and m_d.
|
friend |
Definition at line 141 of file kis_scanline_fill.h.
| KisFillIntervalMap KisScanlineFill::backwardMap |
Definition at line 286 of file kis_scanline_fill.cpp.
| QRect KisScanlineFill::boundingRect |
Definition at line 281 of file kis_scanline_fill.cpp.
| int KisScanlineFill::closeGap |
try to close gaps up to this size in pixels
Definition at line 289 of file kis_scanline_fill.cpp.
| GreaterPriorityQueue<CloseGapFillPoint> KisScanlineFill::closeGapQueue |
Definition at line 298 of file kis_scanline_fill.cpp.
| KisPaintDeviceSP KisScanlineFill::device |
Definition at line 279 of file kis_scanline_fill.cpp.
| KisRandomAccessorSP KisScanlineFill::filledSelectionIterator |
Definition at line 302 of file kis_scanline_fill.cpp.
| QRect KisScanlineFill::fillExtent |
Definition at line 292 of file kis_scanline_fill.cpp.
| QStack<KisFillInterval> KisScanlineFill::forwardStack |
Definition at line 287 of file kis_scanline_fill.cpp.
| KisGapMapSP KisScanlineFill::gapMapSp |
maintains the distance and opacity maps required for the algorithm
Definition at line 290 of file kis_scanline_fill.cpp.
|
private |
Definition at line 188 of file kis_scanline_fill.h.
| int KisScanlineFill::opacitySpread |
Definition at line 283 of file kis_scanline_fill.cpp.
| int KisScanlineFill::rowIncrement |
Definition at line 285 of file kis_scanline_fill.cpp.
| QPoint KisScanlineFill::startPoint |
Definition at line 280 of file kis_scanline_fill.cpp.
| int KisScanlineFill::threshold |
Definition at line 282 of file kis_scanline_fill.cpp.