Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_image_resize_command.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
3 * SPDX-FileCopyrightText: 2007 Sven Langkamp <sven.langkamp@gmail.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
9
10#include <klocalizedstring.h>
11#include "kis_image.h"
12
13
15 const QSize& newSize, KUndo2Command *parent)
16 : KUndo2Command(kundo2_i18n("Resize Image"), parent),
17 m_image(image)
18{
19 // do we really need a translatable name for the command?
20 KisImageSP imageSP = m_image.toStrongRef();
21 if (!imageSP) {
22 return;
23 }
24 m_sizeBefore = imageSP->size();
25 m_sizeAfter = newSize;
26}
27
29{
31 if (!image) {
32 return;
33 }
34 image->setSize(m_sizeAfter);
35}
36
38{
40 if (!image) {
41 return;
42 }
43 image->setSize(m_sizeBefore);
44}
KisImageResizeCommand(KisImageWSP image, const QSize &newRect, KUndo2Command *parent=0)
QSize size() const
Definition kis_image.h:547
void setSize(const QSize &size)
Definition kis_image.cc:828
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
KUndo2MagicString kundo2_i18n(const char *text)