Krita Source Code Documentation
Loading...
Searching...
No Matches
KisEncloseAndFillPainter Class Reference

#include <KisEncloseAndFillPainter.h>

+ Inheritance diagram for KisEncloseAndFillPainter:

Classes

class  Private
 

Public Types

enum  RegionSelectionMethod {
  SelectAllRegions , SelectRegionsFilledWithSpecificColor , SelectRegionsFilledWithTransparent , SelectRegionsFilledWithSpecificColorOrTransparent ,
  SelectAllRegionsExceptFilledWithSpecificColor , SelectAllRegionsExceptFilledWithTransparent , SelectAllRegionsExceptFilledWithSpecificColorOrTransparent , SelectRegionsSurroundedBySpecificColor ,
  SelectRegionsSurroundedByTransparent , SelectRegionsSurroundedBySpecificColorOrTransparent
}
 
- Public Types inherited from KisFillPainter
enum  RegionFillingMode { RegionFillingMode_FloodFill , RegionFillingMode_BoundaryFill }
 
- Public Types inherited from KisPainter
enum  FillStyle {
  FillStyleNone , FillStyleForegroundColor , FillStyleBackgroundColor , FillStylePattern ,
  FillStyleGenerator
}
 This enum contains the styles with which we can fill things like polygons and ellipses. More...
 
enum  StrokeStyle { StrokeStyleNone , StrokeStyleBrush }
 The style of the brush stroke around polygons and so. More...
 

Public Member Functions

KisPixelSelectionSP createEncloseAndFillSelection (KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice, KisPixelSelectionSP existingSelection)
 
KisPixelSelectionSP createEncloseAndFillSelection (KisPixelSelectionSP newSelection, KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice, KisPixelSelectionSP existingSelection)
 
void encloseAndFillColor (KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice)
 
void encloseAndFillPattern (KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice, QTransform patternTransform=QTransform())
 
 KisEncloseAndFillPainter (const QSize &imageSize)
 
 KisEncloseAndFillPainter (KisPaintDeviceSP device, const QSize &imageSize)
 
 KisEncloseAndFillPainter (KisPaintDeviceSP device, KisSelectionSP selection, const QSize &imageSize)
 
KoColor regionSelectionColor () const
 
bool regionSelectionIncludeContourRegions () const
 
bool regionSelectionIncludeSurroundingRegions () const
 
bool regionSelectionInvert () const
 
RegionSelectionMethod regionSelectionMethod () const
 
void setRegionSelectionColor (const KoColor &color)
 
void setRegionSelectionIncludeContourRegions (bool include)
 
void setRegionSelectionIncludeSurroundingRegions (bool include)
 
void setRegionSelectionInvert (bool invert)
 
void setRegionSelectionMethod (RegionSelectionMethod regionSelectionMethod)
 
 ~KisEncloseAndFillPainter () override
 
- Public Member Functions inherited from KisFillPainter
bool antiAlias () const
 
bool careForSelection () const
 
uint closeGap () const
 
KisPixelSelectionSP createFloodSelection (int startX, int startY, KisPaintDeviceSP sourceDevice, KisPaintDeviceSP existingSelection)
 
KisPixelSelectionSP createFloodSelection (KisPixelSelectionSP newSelection, int startX, int startY, KisPaintDeviceSP sourceDevice, KisPaintDeviceSP existingSelection)
 
void createSimilarColorsSelection (KisPixelSelectionSP outSelection, const KoColor &referenceColor, KisPaintDeviceSP referenceDevice, const QRect &rect, KisPixelSelectionSP mask)
 
QVector< KisStrokeJobData * > createSimilarColorsSelectionJobs (KisPixelSelectionSP outSelection, const QSharedPointer< KoColor > referenceColor, KisPaintDeviceSP referenceDevice, const QRect &rect, KisPixelSelectionSP mask, QSharedPointer< KisProcessingVisitor::ProgressHelper > progressHelper=nullptr)
 
void eraseRect (const QRect &rc)
 
void eraseRect (qint32 x1, qint32 y1, qint32 w, qint32 h)
 
uint feather () const
 
void fillColor (int startX, int startY, KisPaintDeviceSP sourceDevice)
 
void fillPattern (int startX, int startY, KisPaintDeviceSP sourceDevice, QTransform patternTransform=QTransform())
 
void fillRect (const QRect &rc, const KisPaintDeviceSP device, const QRect &deviceRect)
 
void fillRect (const QRect &rc, const KoColor &c)
 
void fillRect (const QRect &rc, const KoColor &c, quint8 opacity)
 
void fillRect (const QRect &rc, const KoPatternSP pattern, const QPoint &offset=QPoint())
 
void fillRect (qint32 x, qint32 y, qint32 w, qint32 h, const KoColor &c)
 
void fillRect (qint32 x, qint32 y, qint32 w, qint32 h, const KoColor &c, quint8 opacity)
 
void fillRect (qint32 x1, qint32 y1, qint32 w, qint32 h, const KisFilterConfigurationSP generator)
 
void fillRect (qint32 x1, qint32 y1, qint32 w, qint32 h, const KisPaintDeviceSP device, const QRect &deviceRect)
 
void fillRect (qint32 x1, qint32 y1, qint32 w, qint32 h, const KoPatternSP pattern, const QPoint &offset=QPoint())
 
void fillRectNoCompose (const QRect &rc, const KoPatternSP pattern, const QTransform transform)
 fillRect Fill a rectangle with a certain pattern. The pattern is repeated if it does not fit the entire rectangle. Differs from other functions that it uses a transform, does not support composite ops in turn.
 
void fillRectNoCompose (qint32 x1, qint32 y1, qint32 w, qint32 h, const KisPaintDeviceSP device, const QRect &deviceRect, const QTransform transform)
 
void fillSelection (const QRect &rc, const KoColor &color)
 
int fillThreshold () const
 
 KisFillPainter ()
 
 KisFillPainter (KisPaintDeviceSP device)
 
 KisFillPainter (KisPaintDeviceSP device, KisSelectionSP selection)
 
int opacitySpread () const
 
KoColor regionFillingBoundaryColor () const
 
RegionFillingMode regionFillingMode () const
 
void setAntiAlias (bool antiAlias)
 
void setCareForSelection (bool set)
 
void setCloseGap (int gap)
 
void setFeather (int feather)
 
void setFillThreshold (int threshold)
 
void setHeight (int h)
 
void setOpacitySpread (int opacitySpread)
 
void setRegionFillingBoundaryColor (const KoColor &regionFillingBoundaryColor)
 
void setRegionFillingMode (RegionFillingMode regionFillingMode)
 
void setSizemod (int sizemod)
 
void setStopGrowingAtDarkestPixel (bool stopGrowingAtDarkestPixel)
 
void setUseCompositing (bool useCompositing)
 
void setUseSelectionAsBoundary (bool useSelectionAsBoundary)
 
void setWidth (int w)
 
int sizemod () const
 
bool stopGrowingAtDarkestPixel () const
 
bool useCompositing () const
 
uint useSelectionAsBoundary () const
 
- Public Member Functions inherited from KisPainter
void addDirtyRect (const QRect &r)
 
void addDirtyRects (const QVector< QRect > &rects)
 
bool antiAliasPolygonFill ()
 Return whether a polygon's filled area should be anti-aliased or not.
 
void applyDevice (const QRect &applyRect, const KisRenderedDab &dab, KisRandomAccessorSP dstIt, const KoColorSpace *srcColorSpace, KoCompositeOp::ParameterInfo &localParamInfo)
 
void applyDeviceWithSelection (const QRect &applyRect, const KisRenderedDab &dab, KisRandomAccessorSP dstIt, KisRandomConstAccessorSP maskIt, const KoColorSpace *srcColorSpace, KoCompositeOp::ParameterInfo &localParamInfo)
 
const KoColorbackgroundColor () const
 Returns the current background color.
 
void begin (KisPaintDeviceSP device)
 
void begin (KisPaintDeviceSP device, KisSelectionSP selection)
 
void beginTransaction (const KUndo2MagicString &transactionName=KUndo2MagicString(), int timedID=-1)
 Begin an undoable paint operation.
 
void bitBlt (const QPoint &pos, const KisPaintDeviceSP srcDev, const QRect &srcRect)
 
void bitBlt (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
 
void bitBltOldData (const QPoint &pos, const KisPaintDeviceSP srcDev, const QRect &srcRect)
 
void bitBltOldData (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
 
void bitBltWithFixedSelection (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 selX, qint32 selY, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
 
void bitBltWithFixedSelection (qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 srcWidth, qint32 srcHeight)
 
void bltFixed (const QPoint &pos, const KisFixedPaintDeviceSP srcDev, const QRect &srcRect)
 
void bltFixed (const QRect &rc, const QList< KisRenderedDab > allSrcDevices)
 
void bltFixed (qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
 
void bltFixedWithFixedSelection (qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, qint32 selX, qint32 selY, qint32 srcX, qint32 srcY, quint32 srcWidth, quint32 srcHeight)
 
void bltFixedWithFixedSelection (qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, const KisFixedPaintDeviceSP selection, quint32 srcWidth, quint32 srcHeight)
 
const QVector< QPair< QPointF, QPointF > > calculateAllMirroredPoints (const QPair< QPointF, QPointF > &pair)
 
const QVector< QPointF > calculateAllMirroredPoints (const QPointF &pos)
 
const QVector< QRect > calculateAllMirroredRects (const QRect &rc)
 
template<class T >
QVector< T > calculateMirroredObjects (const T &object)
 
QBitArray channelFlags ()
 
const KoCompositeOpcompositeOp (const KoColorSpace *srcCS)
 
QString compositeOpId ()
 Returns the current composite op Id.
 
void copyMirrorInformationFrom (const KisPainter *other)
 
void deleteTransaction ()
 
KisPaintDeviceSP device ()
 
const KisPaintDeviceSP device () const
 Returns the current paint device.
 
void drawDDALine (const QPointF &start, const QPointF &end)
 
void drawLine (const QPointF &start, const QPointF &end)
 
void drawLine (const QPointF &start, const QPointF &end, qreal width, bool antialias)
 
void drawPainterPath (const QPainterPath &path, const QPen &pen)
 
void drawPainterPath (const QPainterPath &path, const QPen &pen, const QRect &requestedRect)
 
void drawThickLine (const QPointF &start, const QPointF &end, int startWidth, int endWidth)
 
void drawWobblyLine (const QPointF &start, const QPointF &end)
 
void drawWuLine (const QPointF &start, const QPointF &end)
 
void end ()
 
KUndo2CommandendAndTakeTransaction ()
 
void endTransaction (KisPostExecutionUndoAdapter *undoAdapter)
 
void endTransaction (KisUndoAdapter *undoAdapter)
 Finish the undoable paint operation.
 
void fill (qint32 x, qint32 y, qint32 width, qint32 height, const KoColor &color)
 
void fillPainterPath (const QPainterPath &path)
 
void fillPainterPath (const QPainterPath &path, const QRect &requestedRect)
 
void fillPainterPathImpl (const QPainterPath &path, const QRect &requestedRect)
 
FillStyle fillStyle () const
 Returns the current fill style.
 
qreal flow () const
 
const KisFilterConfigurationSP generator () const
 
void getBezierCurvePoints (const QPointF &pos1, const QPointF &control1, const QPointF &control2, const QPointF &pos2, vQPointF &points) const
 
const KoAbstractGradientSP gradient () const
 
bool hasDirtyRegion () const
 
bool hasHorizontalMirroring () const
 
bool hasMirroring () const
 
bool hasVerticalMirroring () const
 
bool isOpacityUnit () const
 
 KisPainter ()
 Construct painter without a device.
 
 KisPainter (KisPaintDeviceSP device)
 Construct a painter, and begin painting on the device.
 
 KisPainter (KisPaintDeviceSP device, KisSelectionSP selection)
 Construct a painter, and begin painting on the device. All actions will be masked by the given selection.
 
void mirrorDab (Qt::Orientation direction, KisRenderedDab *dab, bool skipMirrorPixels=false) const
 
void mirrorRect (Qt::Orientation direction, QRect *rc) const
 
qreal opacityF () const
 Returns the opacity that is used in painting.
 
void paintAt (const KisPaintInformation &pos, KisDistanceInformation *savedDist)
 
void paintBezierCurve (const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance)
 
const KoColorpaintColor () const
 Returns the color that will be used to paint with.
 
void paintEllipse (const qreal x, const qreal y, const qreal w, const qreal h)
 
void paintEllipse (const QRectF &rect)
 
void paintLine (const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance)
 
KisPaintOppaintOp () const
 
void paintPainterPath (const QPainterPath &path)
 
void paintPolygon (const vQPointF &points)
 
void paintPolyline (const QVector< QPointF > &points, int index=0, int numPoints=-1)
 
void paintRect (const qreal x, const qreal y, const qreal w, const qreal h)
 
void paintRect (const QRectF &rect)
 
const KoPatternSP pattern () const
 Returns the currently set pattern.
 
QTransform patternTransform ()
 get the current transform on the pattern.
 
KisPaintOpPresetSP preset () const
 Return the paintop preset.
 
 Private (KisPainter *_q)
 
 Private (KisPainter *_q, const KoColorSpace *cs)
 
void putTransaction (KisTransaction *transaction)
 continue a transaction started somewhere else
 
void renderDabWithMirroringNonIncremental (QRect rc, KisPaintDeviceSP dab)
 
void renderMirrorMask (QRect rc, KisFixedPaintDeviceSP dab)
 
void renderMirrorMask (QRect rc, KisFixedPaintDeviceSP dab, KisFixedPaintDeviceSP mask)
 
void renderMirrorMask (QRect rc, KisPaintDeviceSP dab)
 
void renderMirrorMask (QRect rc, KisPaintDeviceSP dab, int sx, int sy, KisFixedPaintDeviceSP mask)
 
void renderMirrorMaskSafe (QRect rc, KisFixedPaintDeviceSP dab, bool preserveDab)
 
void renderMirrorMaskSafe (QRect rc, KisFixedPaintDeviceSP dab, KisFixedPaintDeviceSP mask, bool preserveDab)
 
void renderMirrorMaskSafe (QRect rc, KisPaintDeviceSP dab, int sx, int sy, KisFixedPaintDeviceSP mask, bool preserveMask)
 
void revertTransaction ()
 Cancel all the changes made by the painter.
 
KisRunnableStrokeJobsInterfacerunnableStrokeJobsInterface () const
 
KisSelectionSP selection ()
 
void setAntiAliasPolygonFill (bool antiAliasPolygonFill)
 Set whether a polygon's filled area should be anti-aliased or not. The default is true.
 
void setAverageOpacity (qreal averageOpacity)
 
void setBackgroundColor (const KoColor &color)
 
void setChannelFlags (QBitArray channelFlags)
 
void setColorConversionFlags (KoColorConversionTransformation::ConversionFlags conversionFlags)
 
void setCompositeOpId (const KoCompositeOp *op)
 
void setCompositeOpId (const QString &op)
 Set the composite op for this painter by string.
 
void setFillStyle (FillStyle fillStyle)
 Set the current style with which to fill.
 
void setFlow (qreal flow)
 
void setGenerator (KisFilterConfigurationSP generator)
 Set the current generator (a generator can be used to fill an area.
 
void setGradient (const KoAbstractGradientSP gradient)
 
void setMaskImageSize (qint32 width, qint32 height)
 
void setMirrorInformation (const QPointF &axesCenter, bool mirrorHorizontally, bool mirrorVertically)
 
void setOpacityF (qreal opacity)
 
void setOpacityToUnit ()
 
void setOpacityU8 (quint8 opacity)
 Set the opacity which is used in painting (like filling polygons)
 
void setOpacityUpdateAverage (qreal opacity)
 
void setPaintColor (const KoColor &color)
 
void setPaintOpPreset (KisPaintOpPresetSP preset, KisNodeSP node, KisImageSP image)
 
void setPattern (const KoPatternSP pattern)
 Set the current pattern.
 
void setPatternTransform (QTransform transform)
 Set the transform on the pattern.
 
void setProgress (KoUpdater *progressUpdater)
 
void setRenderingIntent (KoColorConversionTransformation::Intent intent)
 
void setRunnableStrokeJobsInterface (KisRunnableStrokeJobsInterface *interface)
 
void setSelection (KisSelectionSP selection)
 
void setStrokeStyle (StrokeStyle strokeStyle)
 Set the current brush stroke style.
 
StrokeStyle strokeStyle () const
 Returns the current brush stroke style.
 
QVector< QRect > takeDirtyRegion ()
 
KisTransactiontakeTransaction ()
 take transaction out of the reach of KisPainter
 
bool tryReduceSourceRect (const KisPaintDevice *srcDev, QRect *srcRect, qint32 *srcX, qint32 *srcY, qint32 *srcWidth, qint32 *srcHeight, qint32 *dstX, qint32 *dstY)
 
virtual ~KisPainter ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Protected Member Functions

void genericEncloseAndFillEnd (KisPaintDeviceSP filled)
 
void genericEncloseAndFillStart (KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice)
 
- Protected Member Functions inherited from KisFillPainter
KisSelectionSP currentFillSelection () const
 
void genericFillEnd (KisPaintDeviceSP filled)
 
void genericFillStart (int startX, int startY, KisPaintDeviceSP sourceDevice)
 
void setCurrentFillSelection (KisSelectionSP fillSelection)
 
- Protected Member Functions inherited from KisPainter
void fillPolygon (const vQPointF &points, FillStyle fillStyle)
 Fill the polygon defined by points with the fillStyle.
 
void init ()
 Initialize, set everything to '0' or defaults.
 
KoUpdaterprogressUpdater ()
 

Private Attributes

QScopedPointer< Privatem_d
 

Additional Inherited Members

- Static Public Member Functions inherited from KisPainter
static qreal blendAverageOpacity (qreal opacity, qreal averageOpacity)
 
static bool checkDeviceHasTransparency (KisPaintDeviceSP dev)
 
static KisPaintDeviceSP convertToAlphaAsAlpha (KisPaintDeviceSP src)
 
static KisPaintDeviceSP convertToAlphaAsGray (KisPaintDeviceSP src)
 
static KisPaintDeviceSP convertToAlphaAsPureAlpha (KisPaintDeviceSP src)
 
static void copyAreaOptimized (const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect)
 
static void copyAreaOptimized (const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect, KisSelectionSP selection)
 
static void copyAreaOptimizedOldData (const QPoint &dstPt, KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &originalSrcRect)
 
- Public Attributes inherited from KisPainter
bool antiAliasPolygonFill {true}
 
QPointF axesCenter
 
KoColor backgroundColor
 
const KoCompositeOpcachedCompositeOp {nullptr}
 
const KoColorSpacecachedSourceColorSpace {nullptr}
 
const KoColorSpacecolorSpace {nullptr}
 
QString compositeOpId
 
KoColorConversionTransformation::ConversionFlags conversionFlags {KoColorConversionTransformation::Empty}
 
KoColor customColor
 
KisPaintDeviceSP device
 
QVector< QRect > dirtyRects
 
QPointF duplicateOffset
 
QScopedPointer< KisRunnableStrokeJobsInterfacefakeRunnableStrokeJobsInterface
 
KisFillPainterfillPainter {nullptr}
 
FillStyle fillStyle {FillStyleNone}
 
KisFilterConfigurationSP generator
 
KoAbstractGradientSP gradient
 
bool isOpacityUnit {true}
 
qint32 maskImageHeight {255}
 
qint32 maskImageWidth {255}
 
QPainter * maskPainter {nullptr}
 
bool mirrorHorizontally {false}
 
bool mirrorVertically {false}
 
KoColor paintColor
 
KisPaintOppaintOp {nullptr}
 
KisPaintOpPresetSP paintOpPreset
 
KoCompositeOp::ParameterInfo paramInfo
 
KoPatternSP pattern
 
QTransform patternTransform
 
quint32 pixelSize {0}
 
KisPaintDeviceSP polygon
 
QImage polygonMaskImage
 
KoColorProfileprofile {nullptr}
 
KoUpdaterprogressUpdater {nullptr}
 
KisPainterq {nullptr}
 
KoColorConversionTransformation::Intent renderingIntent {KoColorConversionTransformation::IntentPerceptual}
 
KisRunnableStrokeJobsInterfacerunnableStrokeJobsInterface {nullptr}
 
KisSelectionSP selection
 
KisPaintLayersourceLayer {nullptr}
 
StrokeStyle strokeStyle {StrokeStyleBrush}
 
KisTransactiontransaction {nullptr}
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Detailed Description

Definition at line 21 of file KisEncloseAndFillPainter.h.

Member Enumeration Documentation

◆ RegionSelectionMethod

Different methods of selecting pixels when using flood fill related functionality

Enumerator
SelectAllRegions 

Select all the closed regions inside the enclosing region, no matter their color

SelectRegionsFilledWithSpecificColor 

Select all the closed regions inside the enclosing region, as long as they are the same color as the specified region selection color

SelectRegionsFilledWithTransparent 

Select all the closed regions inside the enclosing region, as long as they are transparent

SelectRegionsFilledWithSpecificColorOrTransparent 

Select all the closed regions inside the enclosing region, as long as they are the same color as the specified region selection color or transparent

SelectAllRegionsExceptFilledWithSpecificColor 

Select all the closed regions inside the enclosing region, as long as they are not the same color as the specified region selection color

SelectAllRegionsExceptFilledWithTransparent 

Select all the closed regions inside the enclosing region, as long as they are not transparent

SelectAllRegionsExceptFilledWithSpecificColorOrTransparent 

Select all the closed regions inside the enclosing region, as long as they are not the same color as the specified region selection color or transparent

SelectRegionsSurroundedBySpecificColor 

Select all the closed regions inside the enclosing region, as long as they are surrounded by the region selection color

SelectRegionsSurroundedByTransparent 

Select all the closed regions inside the enclosing region, as long as they are surrounded by transparent

SelectRegionsSurroundedBySpecificColorOrTransparent 

Select all the closed regions inside the enclosing region, as long as they are surrounded by the region selection color or transparent

Definition at line 28 of file KisEncloseAndFillPainter.h.

29 {
82 };

Constructor & Destructor Documentation

◆ KisEncloseAndFillPainter() [1/3]

KisEncloseAndFillPainter::KisEncloseAndFillPainter ( const QSize & imageSize)

Construct an empty painter. Use the begin(KisPaintDeviceSP) method to attach to a paint device

Definition at line 290 of file KisEncloseAndFillPainter.cpp.

291 : m_d(new Private(this))
292{
293 setWidth(imageSize.width());
294 setHeight(imageSize.height());
295 m_d->imageRect = QRect(QPoint(0, 0), imageSize);
296}
QScopedPointer< Private > m_d
void setWidth(int w)
void setHeight(int h)

References m_d, KisFillPainter::setHeight(), and KisFillPainter::setWidth().

◆ KisEncloseAndFillPainter() [2/3]

KisEncloseAndFillPainter::KisEncloseAndFillPainter ( KisPaintDeviceSP device,
const QSize & imageSize )

Start painting on the specified paint device

Definition at line 298 of file KisEncloseAndFillPainter.cpp.

300 , m_d(new Private(this))
301{
302 setWidth(imageSize.width());
303 setHeight(imageSize.height());
304 m_d->imageRect = QRect(QPoint(0, 0), imageSize);
305}
KisPaintDeviceSP device

References m_d, KisFillPainter::setHeight(), and KisFillPainter::setWidth().

◆ KisEncloseAndFillPainter() [3/3]

KisEncloseAndFillPainter::KisEncloseAndFillPainter ( KisPaintDeviceSP device,
KisSelectionSP selection,
const QSize & imageSize )

Definition at line 307 of file KisEncloseAndFillPainter.cpp.

309 , m_d(new Private(this))
310{
311 setWidth(imageSize.width());
312 setHeight(imageSize.height());
313 m_d->imageRect = QRect(QPoint(0, 0), imageSize);
314}
KisSelectionSP selection

References m_d, KisFillPainter::setHeight(), and KisFillPainter::setWidth().

◆ ~KisEncloseAndFillPainter()

KisEncloseAndFillPainter::~KisEncloseAndFillPainter ( )
override

Definition at line 316 of file KisEncloseAndFillPainter.cpp.

317{}

Member Function Documentation

◆ createEncloseAndFillSelection() [1/2]

KisPixelSelectionSP KisEncloseAndFillPainter::createEncloseAndFillSelection ( KisPixelSelectionSP enclosingMask,
KisPaintDeviceSP referenceDevice,
KisPixelSelectionSP existingSelection )

Returns a selection mask for the closed regions inside of the enclosing mask. This variant basically creates a new selection object and passes it down to the other variant of the function.

Parameters
enclosingMaska mask representing where to search for the closed regions
referenceDevicethe reference device that determines the area that is floodfilled if sampleMerged is on
existingSelectionthe selection used when useSelectionAsBoundary is true

Definition at line 374 of file KisEncloseAndFillPainter.cpp.

377{
379 return createEncloseAndFillSelection(newSelection, enclosingMask, referenceDevice, existingSelection);
380}
KisPixelSelectionSP createEncloseAndFillSelection(KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice, KisPixelSelectionSP existingSelection)

References createEncloseAndFillSelection(), and KisPainter::device.

◆ createEncloseAndFillSelection() [2/2]

KisPixelSelectionSP KisEncloseAndFillPainter::createEncloseAndFillSelection ( KisPixelSelectionSP newSelection,
KisPixelSelectionSP enclosingMask,
KisPaintDeviceSP referenceDevice,
KisPixelSelectionSP existingSelection )

Returns a selection mask for the closed regions inside of the enclosing mask. This variant requires an empty selection object. It is used in cases where the pointer to the selection must be known beforehand, for example when the selection is filled in a stroke and then the pointer to the pixel selection is needed later.

Parameters
selectionempty new selection object
enclosingMaska mask representing where to search for the closed regions
referenceDevicethe reference device that determines the area that is floodfilled if sampleMerged is on
existingSelectionthe selection used when useSelectionAsBoundary is true

Definition at line 382 of file KisEncloseAndFillPainter.cpp.

386{
387 Q_ASSERT(newSelection);
388 Q_ASSERT(enclosingMask);
389 Q_ASSERT(referenceDevice);
390
391 const QRect enclosingMaskRect = enclosingMask->selectedExactRect();
392 if (enclosingMaskRect.isEmpty()) {
393 return newSelection;
394 }
395 QRect newSelectionRect;
396 // Get the mask that includes all the closed regions inside the enclosing mask
397 m_d->computeEnclosedRegionsMask(newSelection, &newSelectionRect, enclosingMask, enclosingMaskRect, referenceDevice);
398 if (newSelectionRect.isEmpty()) {
399 return newSelection;
400 }
401 // Invert
402 m_d->invertIfNeeded(newSelection, enclosingMask, enclosingMaskRect);
403 // Intersect the regions mask with the current selection if it should be used as boundary
404 if (useSelectionAsBoundary() && existingSelection) {
405 newSelection->applySelection(existingSelection, SELECTION_INTERSECT);
406 }
407 // Post-process
408 m_d->applyPostProcessing(newSelection, referenceDevice);
409
410 return newSelection;
411}
@ SELECTION_INTERSECT
uint useSelectionAsBoundary() const
QRect selectedExactRect() const
void applySelection(KisPixelSelectionSP selection, SelectionAction action)

References KisPixelSelection::applySelection(), m_d, KisPixelSelection::selectedExactRect(), SELECTION_INTERSECT, and KisFillPainter::useSelectionAsBoundary().

◆ encloseAndFillColor()

void KisEncloseAndFillPainter::encloseAndFillColor ( KisPixelSelectionSP enclosingMask,
KisPaintDeviceSP referenceDevice )

Finds the closed areas inside the enclosing mask and fills them with the set color. If there is a selection, the whole selection is filled. Note that you must have set the width and height on the painter if you don't have a selection.

Parameters
enclosingMaska mask representing where to search for the closed regions
referenceDevicethe reference device that determines the areas that are filled if sampleMerged is on

Definition at line 319 of file KisEncloseAndFillPainter.cpp.

320{
321 genericEncloseAndFillStart(enclosingMask, referenceDevice);
322
324 if (fillRect.isEmpty()) {
325 return;
326 }
327
328 // Now create a layer and fill it
330 Q_CHECK_PTR(filled);
331 KisFillPainter painter(filled);
332 painter.fillRect(fillRect, paintColor());
333 painter.end();
334
336}
void genericEncloseAndFillEnd(KisPaintDeviceSP filled)
void genericEncloseAndFillStart(KisPixelSelectionSP enclosingMask, KisPaintDeviceSP referenceDevice)
KisSelectionSP currentFillSelection() const
void fillRect(qint32 x, qint32 y, qint32 w, qint32 h, const KoColor &c, quint8 opacity)
KisPaintDeviceSP createCompositionSourceDevice() const
KoColor paintColor
QRect selectedExactRect() const
Slow, but exact way of determining the rectangle that encloses the selection.

References KisPaintDevice::createCompositionSourceDevice(), KisFillPainter::currentFillSelection(), KisPainter::device, KisPainter::end(), KisFillPainter::fillRect(), genericEncloseAndFillEnd(), genericEncloseAndFillStart(), KisPainter::paintColor, and KisSelection::selectedExactRect().

◆ encloseAndFillPattern()

void KisEncloseAndFillPainter::encloseAndFillPattern ( KisPixelSelectionSP enclosingMask,
KisPaintDeviceSP referenceDevice,
QTransform patternTransform = QTransform() )

Finds the closed areas inside the enclosing mask and fills them with the set pattern. If there is a selection, the whole selection is filled. Note that you must have set the width and height on the painter if you don't have a selection.

Parameters
enclosingMaska mask representing where to search for the closed regions
referenceDevicethe reference device that determines the areas that are filled if sampleMerged is on
patternTransformtransform applied to the pattern

Definition at line 338 of file KisEncloseAndFillPainter.cpp.

341{
342 genericEncloseAndFillStart(enclosingMask, referenceDevice);
343
345 if (fillRect.isEmpty()) {
346 return;
347 }
348
349 // Now create a layer and fill it
351 Q_CHECK_PTR(filled);
352 KisFillPainter painter(filled);
353 painter.fillRectNoCompose(fillRect, pattern(), patternTransform);
354 painter.end();
355
357}
QTransform patternTransform
KoPatternSP pattern

References KisPaintDevice::createCompositionSourceDevice(), KisFillPainter::currentFillSelection(), KisPainter::device, KisPainter::end(), KisFillPainter::fillRect(), KisFillPainter::fillRectNoCompose(), genericEncloseAndFillEnd(), genericEncloseAndFillStart(), KisPainter::pattern, KisPainter::patternTransform, and KisSelection::selectedExactRect().

◆ genericEncloseAndFillEnd()

void KisEncloseAndFillPainter::genericEncloseAndFillEnd ( KisPaintDeviceSP filled)
protected

Definition at line 369 of file KisEncloseAndFillPainter.cpp.

370{
372}
void genericFillEnd(KisPaintDeviceSP filled)

References KisFillPainter::genericFillEnd().

◆ genericEncloseAndFillStart()

void KisEncloseAndFillPainter::genericEncloseAndFillStart ( KisPixelSelectionSP enclosingMask,
KisPaintDeviceSP referenceDevice )
protected

Definition at line 359 of file KisEncloseAndFillPainter.cpp.

360{
361 // Create a selection from the closed regions
362 KisPixelSelectionSP pixelSelection = createEncloseAndFillSelection(enclosingMask, referenceDevice,
363 (selection().isNull() ? 0 : selection()->pixelSelection()));
364 KisSelectionSP newSelection = new KisSelection(pixelSelection->defaultBounds(), KisImageResolutionProxy::identity());
365 newSelection->pixelSelection()->applySelection(pixelSelection, SELECTION_REPLACE);
366 setCurrentFillSelection(newSelection);
367}
@ SELECTION_REPLACE
void setCurrentFillSelection(KisSelectionSP fillSelection)
static KisImageResolutionProxySP identity()
KisDefaultBoundsBaseSP defaultBounds() const
KisPixelSelectionSP pixelSelection

References KisPixelSelection::applySelection(), createEncloseAndFillSelection(), KisPaintDevice::defaultBounds(), KisImageResolutionProxy::identity(), KisSelection::pixelSelection, KisPainter::selection, SELECTION_REPLACE, and KisFillPainter::setCurrentFillSelection().

◆ regionSelectionColor()

KoColor KisEncloseAndFillPainter::regionSelectionColor ( ) const

Gets the color to use when regionSelectionMethod is set to custom color in the enclose and fill

Definition at line 428 of file KisEncloseAndFillPainter.cpp.

429{
430 return m_d->regionSelectionColor;
431}

References m_d.

◆ regionSelectionIncludeContourRegions()

bool KisEncloseAndFillPainter::regionSelectionIncludeContourRegions ( ) const

Gets if the regions that touch the enclosing area contour should be kept or excluded

Definition at line 448 of file KisEncloseAndFillPainter.cpp.

449{
450 return m_d->regionSelectionIncludeContourRegions;
451}

References m_d.

◆ regionSelectionIncludeSurroundingRegions()

bool KisEncloseAndFillPainter::regionSelectionIncludeSurroundingRegions ( ) const

Gets if the surrounding regions of the specific selected color should be kept or excluded when using SelectRegionsSurroundedBySpecificColor, SelectRegionsSurroundedByTransparent or SelectRegionsSurroundedBySpecificColorOrTransparent as the region selection method

Definition at line 458 of file KisEncloseAndFillPainter.cpp.

459{
460 return m_d->regionSelectionIncludeSurroundingRegions;
461}

References m_d.

◆ regionSelectionInvert()

bool KisEncloseAndFillPainter::regionSelectionInvert ( ) const

Gets if the selection mask should be inverted

Definition at line 438 of file KisEncloseAndFillPainter.cpp.

439{
440 return m_d->regionSelectionInvert;
441}

References m_d.

◆ regionSelectionMethod()

KisEncloseAndFillPainter::RegionSelectionMethod KisEncloseAndFillPainter::regionSelectionMethod ( ) const

Gets the region type of the closed regions in the enclose and fill

Definition at line 418 of file KisEncloseAndFillPainter.cpp.

419{
420 return m_d->regionSelectionMethod;
421}

References m_d.

◆ setRegionSelectionColor()

void KisEncloseAndFillPainter::setRegionSelectionColor ( const KoColor & color)

Sets the color to use when regionSelectionMethod is set to custom color in the enclose and fill

Definition at line 423 of file KisEncloseAndFillPainter.cpp.

424{
425 m_d->regionSelectionColor = color;
426}

References m_d.

◆ setRegionSelectionIncludeContourRegions()

void KisEncloseAndFillPainter::setRegionSelectionIncludeContourRegions ( bool include)

Sets if the regions that touch the enclosing area contour should be kept or excluded

Definition at line 443 of file KisEncloseAndFillPainter.cpp.

444{
445 m_d->regionSelectionIncludeContourRegions = include;
446}

References m_d.

◆ setRegionSelectionIncludeSurroundingRegions()

void KisEncloseAndFillPainter::setRegionSelectionIncludeSurroundingRegions ( bool include)

Sets if the surrounding regions of the specific selected color should be kept or excluded when using SelectRegionsSurroundedBySpecificColor, SelectRegionsSurroundedByTransparent or SelectRegionsSurroundedBySpecificColorOrTransparent as the region selection method

Definition at line 453 of file KisEncloseAndFillPainter.cpp.

454{
455 m_d->regionSelectionIncludeSurroundingRegions = include;
456}

References m_d.

◆ setRegionSelectionInvert()

void KisEncloseAndFillPainter::setRegionSelectionInvert ( bool invert)

Sets if the selection mask should be inverted

Definition at line 433 of file KisEncloseAndFillPainter.cpp.

434{
435 m_d->regionSelectionInvert = invert;
436}

References m_d.

◆ setRegionSelectionMethod()

void KisEncloseAndFillPainter::setRegionSelectionMethod ( RegionSelectionMethod regionSelectionMethod)

Sets the region type of the closed regions in the enclose and fill

Definition at line 413 of file KisEncloseAndFillPainter.cpp.

414{
415 m_d->regionSelectionMethod = regionSelectionMethod;
416}
RegionSelectionMethod regionSelectionMethod() const

References m_d, and regionSelectionMethod().

Member Data Documentation

◆ m_d

QScopedPointer<Private> KisEncloseAndFillPainter::m_d
private

Definition at line 208 of file KisEncloseAndFillPainter.h.


The documentation for this class was generated from the following files: