File indexing completed on 2024-05-12 15:56:50
0001 /* This file is part of the KDE project 0002 * 0003 * SPDX-FileCopyrightText: 2006 Thomas Zander <zander@kde.org> 0004 * SPDX-FileCopyrightText: 2007, 2009 Thorsten Zachmann <zachmann@kde.org> 0005 * SPDX-FileCopyrightText: 2012 Inge Wallin <inge@lysator.liu.se> 0006 * 0007 * SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #ifndef KOSHAPESTROKEMODEL_H 0011 #define KOSHAPESTROKEMODEL_H 0012 0013 #include "kritaflake_export.h" 0014 0015 #include <QtGlobal> 0016 0017 class KoShape; 0018 class KoShapeSavingContext; 0019 struct KoInsets; 0020 0021 class QColor; 0022 class QPainter; 0023 0024 /** 0025 * A model for strokes of KoShapes. 0026 * Classes that implement this model will be allowed to draw the stroke of the outline 0027 * of a shape. 0028 * Note that since the important members take a KoShape as argument it is possible, 0029 * and preferred behavior, to have one instance of a stroke that is reused on several 0030 * objects. 0031 */ 0032 class KRITAFLAKE_EXPORT KoShapeStrokeModel 0033 { 0034 public: 0035 virtual ~KoShapeStrokeModel(); 0036 0037 /** 0038 * Return a strokeInsets object filled with the size inside the shape that this stroke takes. 0039 * @param shape the shape the insets will be calculated for 0040 * @param insets the insets object that will be filled and returned. 0041 */ 0042 virtual void strokeInsets(const KoShape *shape, KoInsets &insets) const = 0; 0043 0044 /** 0045 * Return a maximum distance that the markers of the shape can take outside the 0046 * shape itself 0047 */ 0048 virtual qreal strokeMaxMarkersInset(const KoShape *shape) const = 0; 0049 0050 /** 0051 * Returns true if there is some transparency, false if the stroke is fully opaque. 0052 * @return if the stroke is transparent. 0053 */ 0054 virtual bool hasTransparency() const = 0; 0055 /** 0056 * Paint the stroke. 0057 * This method should paint the stroke around shape. 0058 * @param shape the shape to paint around 0059 * @param painter the painter to paint to, the painter will have the topleft of the 0060 * shape as its start coordinate. 0061 */ 0062 virtual void paint(const KoShape *shape, QPainter &painter) const = 0; 0063 0064 virtual bool compareFillTo(const KoShapeStrokeModel *other) = 0; 0065 virtual bool compareStyleTo(const KoShapeStrokeModel *other) = 0; 0066 virtual bool isVisible() const = 0; 0067 }; 0068 0069 #endif