File indexing completed on 2024-05-12 15:58:51
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISINTERSTROKEDATA_H 0008 #define KISINTERSTROKEDATA_H 0009 0010 #include <kritaimage_export.h> 0011 #include <QSharedPointer> 0012 #include <QPoint> 0013 #include <kis_types.h> 0014 0015 class KUndo2Command; 0016 class KoColorSpace; 0017 0018 /** 0019 * A special base class for storing temporary data inside a paint 0020 * device between brush strokes. That might be used by the brushes to 0021 * store data that needs to be passes between different strokes of the 0022 * same brush, e.g. paint drying drying or heightmap information. 0023 * 0024 * The data is stored inside device->interstrokeData() and added 0025 * via passing a factory to the transaction. 0026 * 0027 * The data is automatically removed when an incompatible change 0028 * happens to a device, e.g. colorspace change or painting with 0029 * incompatible brush. 0030 */ 0031 class KRITAIMAGE_EXPORT KisInterstrokeData 0032 { 0033 public: 0034 KisInterstrokeData(KisPaintDeviceSP device); 0035 virtual ~KisInterstrokeData(); 0036 0037 virtual void beginTransaction() = 0; 0038 virtual KUndo2Command* endTransaction() = 0; 0039 0040 bool isStillCompatible() const; 0041 0042 private: 0043 QPoint m_linkedDeviceOffset; 0044 const KoColorSpace *m_linkedColorSpace = 0; 0045 KisPaintDeviceWSP m_linkedPaintDevice; 0046 }; 0047 0048 using KisInterstrokeDataSP = QSharedPointer<KisInterstrokeData>; 0049 0050 0051 #endif // KISINTERSTROKEDATA_H