Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_figure_painting_tool_helper.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
10
13#include "kis_image.h"
14#include "kis_painter.h"
17
18
20 KisImageWSP image,
21 KisNodeSP currentNode,
22 KoCanvasResourceProvider *resourceManager,
25 QTransform fillTransform)
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}
43
47 QTransform fillTransform)
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;
58 case StrokeStyleForeground:
60 break;
61 case StrokeStyleBackground:
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) {
77 case FillStyleForegroundColor:
79 break;
80 case FillStyleBackgroundColor:
82 break;
83 case FillStylePattern:
85 break;
86 case FillStyleNone:
88 break;
89 }
90
91 resources->setFillTransform(fillTransform);
92}
93
100
108
116
124
132
140
148
153
158
163
168
169void KisFigurePaintingToolHelper::paintPainterPathQPen(const QPainterPath path, const QPen &pen, const KoColor &color)
170{
174 path, pen, color));
175}
176
177void KisFigurePaintingToolHelper::paintPainterPathQPenFill(const QPainterPath path, const QPen &pen, const KoColor &color)
178{
182 path, pen, color));
183}
KisFigurePaintingToolHelper(const KUndo2MagicString &name, KisImageWSP image, KisNodeSP currentNode, KoCanvasResourceProvider *resourceManager, KisToolShapeUtils::StrokeStyle strokeStyle, KisToolShapeUtils::FillStyle fillStyle, QTransform fillTransform=QTransform())
void paintPainterPathQPenFill(const QPainterPath, const QPen &pen, const KoColor &color)
void setSelectionOverride(KisSelectionSP m_selection)
void paintPainterPath(const QPainterPath &path)
void setBrush(const KisPaintOpPresetSP &brush)
void paintLine(const KisPaintInformation &pi0, const KisPaintInformation &pi1)
void paintPainterPathQPen(const QPainterPath, const QPen &pen, const KoColor &color)
void setupPaintStyles(KisResourcesSnapshotSP resources, KisToolShapeUtils::StrokeStyle strokeStyle, KisToolShapeUtils::FillStyle fillStyle, QTransform fillTransform)
@ FillStyleBackgroundColor
@ FillStyleForegroundColor
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
void setFGColorOverride(const KoColor &color)
void setFillStyle(KisPainter::FillStyle fillStyle)
void setBGColorOverride(const KoColor &color)
void setBrush(const KisPaintOpPresetSP &brush)
void setSelectionOverride(KisSelectionSP selection)
void setStrokeStyle(KisPainter::StrokeStyle strokeStyle)
void setFillTransform(QTransform transform)
virtual KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy)=0
virtual void endStroke(KisStrokeId id)=0
virtual void addJob(KisStrokeId id, KisStrokeJobData *data)=0