File indexing completed on 2024-12-22 04:12:58
0001 /* 0002 * SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_FIGURE_PAINTING_TOOL_HELPER_H 0008 #define __KIS_FIGURE_PAINTING_TOOL_HELPER_H 0009 0010 #include "kis_types.h" 0011 #include "kritaui_export.h" 0012 #include <brushengine/kis_paint_information.h> 0013 #include "strokes/freehand_stroke.h" 0014 #include "KisToolShapeUtils.h" 0015 0016 class KoCanvasResourceProvider; 0017 class KisStrokesFacade; 0018 0019 class KRITAUI_EXPORT KisFigurePaintingToolHelper 0020 { 0021 public: 0022 KisFigurePaintingToolHelper(const KUndo2MagicString &name, 0023 KisImageWSP image, 0024 KisNodeSP currentNode, 0025 KoCanvasResourceProvider *resourceManager, 0026 KisToolShapeUtils::StrokeStyle strokeStyle, 0027 KisToolShapeUtils::FillStyle fillStyle, 0028 QTransform fillTransform = QTransform()); 0029 ~KisFigurePaintingToolHelper(); 0030 0031 void paintLine(const KisPaintInformation &pi0, 0032 const KisPaintInformation &pi1); 0033 void paintPolyline(const vQPointF &points); 0034 void paintPolygon(const vQPointF &points); 0035 void paintRect(const QRectF &rect); 0036 void paintEllipse(const QRectF &rect); 0037 void paintPainterPath(const QPainterPath &path); 0038 void setFGColorOverride(const KoColor &color); 0039 void setBGColorOverride(const KoColor &color); 0040 void setSelectionOverride(KisSelectionSP m_selection); 0041 void setBrush(const KisPaintOpPresetSP &brush); 0042 void paintPainterPathQPen(const QPainterPath, const QPen &pen, const KoColor &color); 0043 void paintPainterPathQPenFill(const QPainterPath, const QPen &pen, const KoColor &color); 0044 0045 private: 0046 void setupPaintStyles(KisResourcesSnapshotSP resources, 0047 KisToolShapeUtils::StrokeStyle strokeStyle, 0048 KisToolShapeUtils::FillStyle fillStyle, 0049 QTransform fillTransform); 0050 0051 private: 0052 KisStrokeId m_strokeId; 0053 KisResourcesSnapshotSP m_resources; 0054 KisStrokesFacade *m_strokesFacade; 0055 }; 0056 0057 #endif /* __KIS_FIGURE_PAINTING_TOOL_HELPER_H */