File indexing completed on 2024-05-12 15:56:09

0001 /*
0002  *  SPDX-FileCopyrightText: 2005 Bart Coppens <kde@bartcoppens.be>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #ifndef _KIS_BOUNDARY_H_
0007 #define _KIS_BOUNDARY_H_
0008 
0009 #include <QList>
0010 #include <QPair>
0011 #include <QPainter>
0012 
0013 #include <kritabrush_export.h>
0014 
0015 #include "kis_types.h"
0016 
0017 /**
0018  * Generates an 'outline' for a paint device. It should look a bit like the outline of a
0019  * marching ants selection.
0020  *
0021  * It's not really optimized, so it's not recommended to do big things with it and expect
0022  * it to be fast.
0023  *
0024  * Usage: construct a KisBoundary, and then run a generateBoundary(w, h) on it. After that,
0025  * you can use the KisBoundaryPainter::paint method to let it paint the outline, or get a pixmap.
0026  *
0027  * If you are debugging the brush outlines, be aware that the pipeline for this
0028  * data is somewhat complex, involving such user classes:
0029  * KisBoundary, KisBrush, KisBrushBasedPaintOpSettings, KisTool, KisCurrentOutlineFetcher
0030  **/
0031 class BRUSH_EXPORT KisBoundary
0032 {
0033 public:
0034     KisBoundary(KisFixedPaintDeviceSP dev);
0035     ~KisBoundary();
0036     void generateBoundary();
0037 
0038     void paint(QPainter& painter) const;
0039 
0040     /// returns the outline saved in QPainterPath
0041     QPainterPath path() const;
0042 
0043 private:
0044     struct Private;
0045     Private* const d;
0046 };
0047 
0048 #endif // _KIS_BOUNDARY_H_