File indexing completed on 2024-06-09 04:28:05

0001 /*
0002  * SPDX-FileCopyrightText: 2009, 2010 Lukáš Tvrdý (lukast.dev@gmail.com)
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_GRID_PAINTOP_H_
0008 #define KIS_GRID_PAINTOP_H_
0009 
0010 //#define BENCHMARK
0011 
0012 #include <klocalizedstring.h>
0013 #include <brushengine/kis_paintop.h>
0014 #include <kis_types.h>
0015 #include <KisColorOptionData.h>
0016 #include <KisGridOpOptionData.h>
0017 #include <KisGridShapeOptionData.h>
0018 
0019 #include "kis_grid_paintop_settings.h"
0020 
0021 class KisPainter;
0022 
0023 
0024 class KisGridPaintOp : public KisPaintOp
0025 {
0026 
0027 public:
0028 
0029     KisGridPaintOp(const KisPaintOpSettingsSP settings, KisPainter * painter, KisNodeSP node, KisImageSP image);
0030     ~KisGridPaintOp() override;
0031 
0032 protected:
0033     KisSpacingInformation paintAt(const KisPaintInformation& info) override;
0034 
0035     KisSpacingInformation updateSpacingImpl(const KisPaintInformation &info) const override;
0036 
0037 private:
0038     KisSpacingInformation computeSpacing(qreal lodScale) const;
0039 
0040 private:
0041     KisGridPaintOpSettingsSP m_settings;
0042     KisPaintDeviceSP    m_dab;
0043     KisPainter*         m_painter;
0044     qreal              m_xSpacing;
0045     qreal              m_ySpacing;
0046     qreal              m_spacing;
0047     KisGridOpOptionData   m_properties;
0048     KisColorOptionData  m_colorProperties;
0049     KisGridShapeOptionData m_shapeProperties;
0050     KisNodeSP m_node;
0051 
0052 
0053 #ifdef BENCHMARK
0054     int m_total;
0055     int m_count;
0056 #endif
0057 
0058 };
0059 
0060 #endif // KIS_GRID_PAINTOP_H_