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

#include <kis_figure_painting_tool_helper.h>

Public Member Functions

 KisFigurePaintingToolHelper (const KUndo2MagicString &name, KisImageWSP image, KisNodeSP currentNode, KoCanvasResourceProvider *resourceManager, KisToolShapeUtils::StrokeStyle strokeStyle, KisToolShapeUtils::FillStyle fillStyle, QTransform fillTransform=QTransform())
 
void paintEllipse (const QRectF &rect)
 
void paintLine (const KisPaintInformation &pi0, const KisPaintInformation &pi1)
 
void paintPainterPath (const QPainterPath &path)
 
void paintPainterPathQPen (const QPainterPath, const QPen &pen, const KoColor &color)
 
void paintPainterPathQPenFill (const QPainterPath, const QPen &pen, const KoColor &color)
 
void paintPolygon (const vQPointF &points)
 
void paintPolyline (const vQPointF &points)
 
void paintRect (const QRectF &rect)
 
void setBGColorOverride (const KoColor &color)
 
void setBrush (const KisPaintOpPresetSP &brush)
 
void setFGColorOverride (const KoColor &color)
 
void setSelectionOverride (KisSelectionSP m_selection)
 
 ~KisFigurePaintingToolHelper ()
 

Private Member Functions

void setupPaintStyles (KisResourcesSnapshotSP resources, KisToolShapeUtils::StrokeStyle strokeStyle, KisToolShapeUtils::FillStyle fillStyle, QTransform fillTransform)
 

Private Attributes

KisResourcesSnapshotSP m_resources
 
KisStrokeId m_strokeId
 
KisStrokesFacadem_strokesFacade
 

Detailed Description

Definition at line 19 of file kis_figure_painting_tool_helper.h.

Constructor & Destructor Documentation

◆ KisFigurePaintingToolHelper()

KisFigurePaintingToolHelper::KisFigurePaintingToolHelper ( const KUndo2MagicString & name,
KisImageWSP image,
KisNodeSP currentNode,
KoCanvasResourceProvider * resourceManager,
KisToolShapeUtils::StrokeStyle strokeStyle,
KisToolShapeUtils::FillStyle fillStyle,
QTransform fillTransform = QTransform() )

Definition at line 19 of file kis_figure_painting_tool_helper.cpp.

26{
27 m_strokesFacade = image.data();
28
30 new KisResourcesSnapshot(image,
31 currentNode,
32 resourceManager);
33
34 setupPaintStyles(m_resources, strokeStyle, fillStyle, fillTransform);
35
37
38 KisStrokeStrategy *stroke =
39 new FreehandStrokeStrategy(m_resources, strokeInfo, name);
40
42}
void setupPaintStyles(KisResourcesSnapshotSP resources, KisToolShapeUtils::StrokeStyle strokeStyle, KisToolShapeUtils::FillStyle fillStyle, QTransform fillTransform)
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
virtual KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy)=0

References KisWeakSharedPtr< T >::data(), m_resources, m_strokeId, m_strokesFacade, setupPaintStyles(), and KisStrokesFacade::startStroke().

◆ ~KisFigurePaintingToolHelper()

KisFigurePaintingToolHelper::~KisFigurePaintingToolHelper ( )

Member Function Documentation

◆ paintEllipse()

◆ paintLine()

void KisFigurePaintingToolHelper::paintLine ( const KisPaintInformation & pi0,
const KisPaintInformation & pi1 )

Definition at line 101 of file kis_figure_painting_tool_helper.cpp.

103{
106 pi0, pi1));
107}

References KisStrokesFacade::addJob(), m_strokeId, and m_strokesFacade.

◆ paintPainterPath()

void KisFigurePaintingToolHelper::paintPainterPath ( const QPainterPath & path)

◆ paintPainterPathQPen()

void KisFigurePaintingToolHelper::paintPainterPathQPen ( const QPainterPath path,
const QPen & pen,
const KoColor & color )

◆ paintPainterPathQPenFill()

void KisFigurePaintingToolHelper::paintPainterPathQPenFill ( const QPainterPath path,
const QPen & pen,
const KoColor & color )

◆ paintPolygon()

◆ paintPolyline()

◆ paintRect()

◆ setBGColorOverride()

void KisFigurePaintingToolHelper::setBGColorOverride ( const KoColor & color)

Definition at line 154 of file kis_figure_painting_tool_helper.cpp.

155{
157}
void setBGColorOverride(const KoColor &color)

References m_resources, and KisResourcesSnapshot::setBGColorOverride().

◆ setBrush()

void KisFigurePaintingToolHelper::setBrush ( const KisPaintOpPresetSP & brush)

Definition at line 164 of file kis_figure_painting_tool_helper.cpp.

165{
166 m_resources->setBrush(brush);
167}
void setBrush(const KisPaintOpPresetSP &brush)

References m_resources, and KisResourcesSnapshot::setBrush().

◆ setFGColorOverride()

void KisFigurePaintingToolHelper::setFGColorOverride ( const KoColor & color)

Definition at line 149 of file kis_figure_painting_tool_helper.cpp.

150{
152}
void setFGColorOverride(const KoColor &color)

References m_resources, and KisResourcesSnapshot::setFGColorOverride().

◆ setSelectionOverride()

void KisFigurePaintingToolHelper::setSelectionOverride ( KisSelectionSP m_selection)

Definition at line 159 of file kis_figure_painting_tool_helper.cpp.

160{
161 m_resources->setSelectionOverride(m_selection);
162}
void setSelectionOverride(KisSelectionSP selection)

References m_resources, and KisResourcesSnapshot::setSelectionOverride().

◆ setupPaintStyles()

void KisFigurePaintingToolHelper::setupPaintStyles ( KisResourcesSnapshotSP resources,
KisToolShapeUtils::StrokeStyle strokeStyle,
KisToolShapeUtils::FillStyle fillStyle,
QTransform fillTransform )
private

Definition at line 44 of file kis_figure_painting_tool_helper.cpp.

48{
49 using namespace KisToolShapeUtils;
50
51 const KoColor fgColor = resources->currentFgColor();
52 const KoColor bgColor = resources->currentBgColor();
53
54 switch (strokeStyle) {
55 case StrokeStyleNone:
57 break;
60 break;
63
64 resources->setFGColorOverride(bgColor);
65 resources->setBGColorOverride(fgColor);
66
67 if (fillStyle == FillStyleForegroundColor) {
68 fillStyle = FillStyleBackgroundColor;
69 } else if (fillStyle == FillStyleBackgroundColor) {
70 fillStyle = FillStyleForegroundColor;
71 }
72
73 break;
74 };
75
76 switch (fillStyle) {
79 break;
82 break;
85 break;
86 case FillStyleNone:
88 break;
89 }
90
91 resources->setFillTransform(fillTransform);
92}
@ FillStyleBackgroundColor
@ FillStyleForegroundColor
void setFillStyle(KisPainter::FillStyle fillStyle)
void setStrokeStyle(KisPainter::StrokeStyle strokeStyle)
void setFillTransform(QTransform transform)

References KisResourcesSnapshot::currentBgColor(), KisResourcesSnapshot::currentFgColor(), KisPainter::FillStyleBackgroundColor, KisPainter::FillStyleForegroundColor, KisPainter::FillStyleNone, KisPainter::FillStylePattern, KisResourcesSnapshot::setBGColorOverride(), KisResourcesSnapshot::setFGColorOverride(), KisResourcesSnapshot::setFillStyle(), KisResourcesSnapshot::setFillTransform(), KisResourcesSnapshot::setStrokeStyle(), KisPainter::StrokeStyleBrush, and KisPainter::StrokeStyleNone.

Member Data Documentation

◆ m_resources

KisResourcesSnapshotSP KisFigurePaintingToolHelper::m_resources
private

Definition at line 53 of file kis_figure_painting_tool_helper.h.

◆ m_strokeId

KisStrokeId KisFigurePaintingToolHelper::m_strokeId
private

Definition at line 52 of file kis_figure_painting_tool_helper.h.

◆ m_strokesFacade

KisStrokesFacade* KisFigurePaintingToolHelper::m_strokesFacade
private

Definition at line 54 of file kis_figure_painting_tool_helper.h.


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