File indexing completed on 2024-05-12 15:58:26

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_MARKER_PAINTER_H
0008 #define __KIS_MARKER_PAINTER_H
0009 
0010 #include <QScopedPointer>
0011 
0012 #include "kis_types.h"
0013 #include "kritaimage_export.h"
0014 
0015 class KoColor;
0016 
0017 
0018 class KRITAIMAGE_EXPORT KisMarkerPainter
0019 {
0020 public:
0021     /// Any number bigger than this or lower than -this is considered invalid
0022     static const qint32 ValidNumberRangeValue = 2140000000; // bit less than max value of int
0023 
0024 
0025     KisMarkerPainter(KisPaintDeviceSP device, const KoColor &color);
0026     ~KisMarkerPainter();
0027 
0028     void fillFullCircle(const QPointF &center, qreal radius);
0029     void fillHalfBrushDiff(const QPointF &p1, const QPointF &p2, const QPointF &p3,
0030                            const QPointF &center, qreal radius);
0031 
0032     void fillCirclesDiff(const QPointF &c1, qreal r1,
0033                          const QPointF &c2, qreal r2);
0034 
0035 private:
0036     struct Private;
0037     const QScopedPointer<Private> m_d;
0038 
0039     /// This method is to check whether the number is not infinite
0040     /// or negative infinite with some epsilon
0041     /// (@see ValidNumberRangeValue)
0042     /// @param number value entered by the user
0043     /// @return true if number is in range, false otherwise
0044     bool isNumberInValidRange(qint32 number);
0045 
0046 
0047     /// This method is to check whether the rectangle has only valid numbers
0048     /// as values for x, y, height and width.
0049     /// If values are not valid, Sequential Iterator can give incorrect values.
0050     /// (@see isNumberInValidRange, ValidNumberRangeValue)
0051     /// @param number value entered by the user
0052     /// @return true if rect's values is in range, false otherwise
0053     bool isRectInValidRange(const QRect &rect);
0054 };
0055 
0056 #endif /* __KIS_MARKER_PAINTER_H */