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

#include <KisMaskedFreehandStrokePainter.h>

Public Member Functions

std::pair< int, bool > doAsynchronousUpdate (QVector< KisRunnableStrokeJobData * > &jobs)
 
void drawAndFillPainterPath (const QPainterPath &path, const QPen &pen, const KoColor &customColor)
 
void drawPainterPath (const QPainterPath &path, const QPen &pen)
 
bool hasDirtyRegion () const
 
bool hasMasking () const
 
 KisMaskedFreehandStrokePainter (KisFreehandStrokeInfo *strokeData, KisFreehandStrokeInfo *maskData)
 
void paintAt (const KisPaintInformation &pi)
 
void paintBezierCurve (const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2)
 
void paintEllipse (const QRectF &rect)
 
void paintLine (const KisPaintInformation &pi1, const KisPaintInformation &pi2)
 
void paintPainterPath (const QPainterPath &path)
 
void paintPolygon (const QVector< QPointF > &points)
 
void paintPolyline (const QVector< QPointF > &points, int index=0, int numPoints=-1)
 
void paintRect (const QRectF &rect)
 
KisPaintOpPresetSP preset () const
 
QVector< QRect > takeDirtyRegion ()
 

Private Member Functions

template<class Func >
void applyToAllPainters (Func func)
 

Private Attributes

KisFreehandStrokeInfom_mask = 0
 
KisFreehandStrokeInfom_stroke = 0
 

Detailed Description

Definition at line 30 of file KisMaskedFreehandStrokePainter.h.

Constructor & Destructor Documentation

◆ KisMaskedFreehandStrokePainter()

KisMaskedFreehandStrokePainter::KisMaskedFreehandStrokePainter ( KisFreehandStrokeInfo * strokeData,
KisFreehandStrokeInfo * maskData )

Definition at line 16 of file KisMaskedFreehandStrokePainter.cpp.

17 : m_stroke(strokeData),
18 m_mask(maskData)
19{
20}

Member Function Documentation

◆ applyToAllPainters()

template<class Func >
void KisMaskedFreehandStrokePainter::applyToAllPainters ( Func func)
inlineprivate

Definition at line 28 of file KisMaskedFreehandStrokePainter.cpp.

29{
31 func(m_stroke);
32
33 if (m_mask) {
34 func(m_mask);
35 }
36}
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130

References KIS_SAFE_ASSERT_RECOVER_NOOP, m_mask, and m_stroke.

◆ doAsynchronousUpdate()

std::pair< int, bool > KisMaskedFreehandStrokePainter::doAsynchronousUpdate ( QVector< KisRunnableStrokeJobData * > & jobs)

Definition at line 110 of file KisMaskedFreehandStrokePainter.cpp.

111{
113
114 std::pair<int, bool> result =
116
117 if (m_mask) {
119 std::pair<int, bool> maskMetrics =
121
122 result.first = std::max(result.first, maskMetrics.first);
123 result.second = result.second | maskMetrics.second;
124
125 jobs.append(maskJobs);
126 }
127
128 return result;
129}
KisPaintOp * paintOp
virtual std::pair< int, bool > doAsynchronousUpdate(QVector< KisRunnableStrokeJobData * > &jobs)

References KisPaintOp::doAsynchronousUpdate(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_mask, m_stroke, KisFreehandStrokeInfo::painter, and KisPainter::paintOp.

◆ drawAndFillPainterPath()

void KisMaskedFreehandStrokePainter::drawAndFillPainterPath ( const QPainterPath & path,
const QPen & pen,
const KoColor & customColor )

Definition at line 101 of file KisMaskedFreehandStrokePainter.cpp.

102{
104 data->painter->setBackgroundColor(customColor);
105 data->painter->fillPainterPath(path);
106 data->painter->drawPainterPath(path, pen);
107 });
108}
void drawPainterPath(const QPainterPath &path, const QPen &pen, const QRect &requestedRect)
void setBackgroundColor(const KoColor &color)
void fillPainterPath(const QPainterPath &path)

References applyToAllPainters(), KisPainter::drawPainterPath(), KisPainter::fillPainterPath(), KisFreehandStrokeInfo::painter, and KisPainter::setBackgroundColor().

◆ drawPainterPath()

void KisMaskedFreehandStrokePainter::drawPainterPath ( const QPainterPath & path,
const QPen & pen )

◆ hasDirtyRegion()

bool KisMaskedFreehandStrokePainter::hasDirtyRegion ( ) const

Definition at line 131 of file KisMaskedFreehandStrokePainter.cpp.

132{
134
135 bool result = m_stroke->painter->hasDirtyRegion();
136
137 if (m_mask) {
138 result |= m_mask->painter->hasDirtyRegion();
139 }
140
141 return result;
142}
bool hasDirtyRegion() const

References KisPainter::hasDirtyRegion(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_mask, m_stroke, and KisFreehandStrokeInfo::painter.

◆ hasMasking()

bool KisMaskedFreehandStrokePainter::hasMasking ( ) const

Definition at line 157 of file KisMaskedFreehandStrokePainter.cpp.

158{
159 return m_mask;
160}

References m_mask.

◆ paintAt()

void KisMaskedFreehandStrokePainter::paintAt ( const KisPaintInformation & pi)

Definition at line 38 of file KisMaskedFreehandStrokePainter.cpp.

39{
41 data->painter->paintAt(pi, data->dragDistance);
42 });
43}
KisDistanceInformation * dragDistance
void paintAt(const KisPaintInformation &pos, KisDistanceInformation *savedDist)

References applyToAllPainters(), KisFreehandStrokeInfo::dragDistance, KisPainter::paintAt(), and KisFreehandStrokeInfo::painter.

◆ paintBezierCurve()

void KisMaskedFreehandStrokePainter::paintBezierCurve ( const KisPaintInformation & pi1,
const QPointF & control1,
const QPointF & control2,
const KisPaintInformation & pi2 )

Definition at line 52 of file KisMaskedFreehandStrokePainter.cpp.

53{
55 data->painter->paintBezierCurve(pi1, control1, control2, pi2, data->dragDistance);
56 });
57}
void paintBezierCurve(const KisPaintInformation &pi1, const QPointF &control1, const QPointF &control2, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance)

References applyToAllPainters(), KisFreehandStrokeInfo::dragDistance, KisPainter::paintBezierCurve(), and KisFreehandStrokeInfo::painter.

◆ paintEllipse()

void KisMaskedFreehandStrokePainter::paintEllipse ( const QRectF & rect)

Definition at line 80 of file KisMaskedFreehandStrokePainter.cpp.

81{
84 });
85}
void paintEllipse(const QRectF &rect)

References applyToAllPainters(), KisPainter::paintEllipse(), and KisFreehandStrokeInfo::painter.

◆ paintLine()

void KisMaskedFreehandStrokePainter::paintLine ( const KisPaintInformation & pi1,
const KisPaintInformation & pi2 )

Definition at line 45 of file KisMaskedFreehandStrokePainter.cpp.

46{
48 data->painter->paintLine(pi1, pi2, data->dragDistance);
49 });
50}
void paintLine(const KisPaintInformation &pi1, const KisPaintInformation &pi2, KisDistanceInformation *currentDistance)

References applyToAllPainters(), KisFreehandStrokeInfo::dragDistance, KisFreehandStrokeInfo::painter, and KisPainter::paintLine().

◆ paintPainterPath()

void KisMaskedFreehandStrokePainter::paintPainterPath ( const QPainterPath & path)

Definition at line 87 of file KisMaskedFreehandStrokePainter.cpp.

88{
90 data->painter->paintPainterPath(path);
91 });
92}
void paintPainterPath(const QPainterPath &path)

References applyToAllPainters(), KisFreehandStrokeInfo::painter, and KisPainter::paintPainterPath().

◆ paintPolygon()

void KisMaskedFreehandStrokePainter::paintPolygon ( const QVector< QPointF > & points)

Definition at line 66 of file KisMaskedFreehandStrokePainter.cpp.

67{
69 data->painter->paintPolygon(points);
70 });
71}
void paintPolygon(const vQPointF &points)

References applyToAllPainters(), KisFreehandStrokeInfo::painter, and KisPainter::paintPolygon().

◆ paintPolyline()

void KisMaskedFreehandStrokePainter::paintPolyline ( const QVector< QPointF > & points,
int index = 0,
int numPoints = -1 )

Definition at line 59 of file KisMaskedFreehandStrokePainter.cpp.

60{
62 data->painter->paintPolyline(points, index, numPoints);
63 });
64}
void paintPolyline(const QVector< QPointF > &points, int index=0, int numPoints=-1)

References applyToAllPainters(), KisFreehandStrokeInfo::painter, and KisPainter::paintPolyline().

◆ paintRect()

void KisMaskedFreehandStrokePainter::paintRect ( const QRectF & rect)

Definition at line 73 of file KisMaskedFreehandStrokePainter.cpp.

74{
76 data->painter->paintRect(rect);
77 });
78}
void paintRect(const QRectF &rect)

References applyToAllPainters(), KisFreehandStrokeInfo::painter, and KisPainter::paintRect().

◆ preset()

KisPaintOpPresetSP KisMaskedFreehandStrokePainter::preset ( ) const

Definition at line 22 of file KisMaskedFreehandStrokePainter.cpp.

23{
24 return m_stroke->painter->preset();
25}
KisPaintOpPresetSP preset() const
Return the paintop preset.

References m_stroke, KisFreehandStrokeInfo::painter, and KisPainter::preset().

◆ takeDirtyRegion()

QVector< QRect > KisMaskedFreehandStrokePainter::takeDirtyRegion ( )

Definition at line 144 of file KisMaskedFreehandStrokePainter.cpp.

145{
147
149
150 if (m_mask) {
151 result += m_mask->painter->takeDirtyRegion();
152 }
153
154 return result;
155}
QVector< QRect > takeDirtyRegion()

References KIS_SAFE_ASSERT_RECOVER_NOOP, m_mask, m_stroke, KisFreehandStrokeInfo::painter, and KisPainter::takeDirtyRegion().

Member Data Documentation

◆ m_mask

KisFreehandStrokeInfo* KisMaskedFreehandStrokePainter::m_mask = 0
private

Definition at line 74 of file KisMaskedFreehandStrokePainter.h.

◆ m_stroke

KisFreehandStrokeInfo* KisMaskedFreehandStrokePainter::m_stroke = 0
private

Definition at line 73 of file KisMaskedFreehandStrokePainter.h.


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