KisInterstrokeData.h 1.34 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
/*
 *  SPDX-FileCopyrightText: 2021 Dmitry Kazakov <dimula73@gmail.com>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef KISINTERSTROKEDATA_H
#define KISINTERSTROKEDATA_H

#include <kritaimage_export.h>
#include <QSharedPointer>
12
13
#include <QPoint>
#include <kis_types.h>
14
15

class KUndo2Command;
16
class KoColorSpace;
17

Dmitry Kazakov's avatar
Dmitry Kazakov committed
18
19
20
21
22
23
24
25
26
/**
 * A special base class for storing temporary data inside a paint
 * device between brush strokes. That might be used by the brushes to
 * store data that needs to be passes between different strokes of the
 * same brush, e.g. paint drying drying or heightmap information.
 *
 * The data is stored inside device->interstrokeData() and added
 * via passing a factory to the transaction.
 *
27
 * The data is automatically removed when an incompatible change
Dmitry Kazakov's avatar
Dmitry Kazakov committed
28
29
30
 * happens to a device, e.g. colorspace change or painting with
 * incompatible brush.
 */
31
32
33
class KRITAIMAGE_EXPORT KisInterstrokeData
{
public:
34
    KisInterstrokeData(KisPaintDeviceSP device);
35
36
37
38
    virtual ~KisInterstrokeData();

    virtual void beginTransaction() = 0;
    virtual KUndo2Command* endTransaction() = 0;
39
40
41
42
43
44
45

    bool isStillCompatible() const;

private:
    QPoint m_linkedDeviceOffset;
    const KoColorSpace *m_linkedColorSpace = 0;
    KisPaintDeviceWSP m_linkedPaintDevice;
46
47
48
49
50
51
};

using KisInterstrokeDataSP = QSharedPointer<KisInterstrokeData>;


#endif // KISINTERSTROKEDATA_H