Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.4 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2002 Patrick Julien <[email protected]>
 *  SPDX-FileCopyrightText: 2007 Sven Langkamp <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef KIS_IMAGE_COMMAND_H_
#define KIS_IMAGE_COMMAND_H_

#include <kritaimage_export.h>

#include <kundo2command.h>

#include <QSize>
#include <QRect>
#include "kis_types.h"
#include "kis_paint_device.h"


/// the base command for commands altering a KisImage
class KRITAIMAGE_EXPORT KisImageCommand : public KUndo2Command
{

public:
    /**
     * Constructor
     * @param name The name that will be shown in the ui
     * @param image The image the command will be working on.
     * @param parent The parent command.
     */
    KisImageCommand(const KUndo2MagicString& name, KisImageWSP image, KUndo2Command *parent = 0);
    ~KisImageCommand() override;

public:

    /**
     * Used for performing the smallest update
     * after a node has been removed from stack.
     * First tries to setDirty() node's siblings.
     * If it doesn't help, performs full refresh.
     */
    class UpdateTarget
    {
    public:
        UpdateTarget(KisImageWSP image, KisNodeSP removedNode, const QRect &updateRect);
        void update();

    private:
        KisImageWSP m_image;
        QRect m_updateRect;
        int m_removedNodeIndex;
        KisNodeSP m_removedNodeParent;
    };

protected:
    KisImageWSP m_image;
};

#endif // KIS_IMAGE_COMMAND_H_