Krita

TransformMask.h
1/*
2 * SPDX-FileCopyrightText: 2017 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef LIBKIS_TRANSFORMMASK_H
7#define LIBKIS_TRANSFORMMASK_H
8
9#include <QObject>
10#include "Node.h"
11
12#include <kis_types.h>
13
14#include "kritalibkis_export.h"
15#include "libkis.h"
16
17/**
18 * @brief The TransformMask class
19 * A transform mask is a mask type node that can be used
20 * to store transformations.
21 */
22class KRITALIBKIS_EXPORT TransformMask : public Node
23{
24 Q_OBJECT
25 Q_DISABLE_COPY(TransformMask)
26
27public:
28 explicit TransformMask(KisImageSP image, QString name, QObject *parent = 0);
29 explicit TransformMask(KisImageSP image, KisTransformMaskSP mask, QObject *parent = 0);
30 ~TransformMask() override;
31public Q_SLOTS:
32
33 /**
34 * @brief type Krita has several types of nodes, split in layers and masks. Group
35 * layers can contain other layers, any layer can contain masks.
36 *
37 * @return transformmask
38 *
39 * If the Node object isn't wrapping a valid Krita layer or mask object, and
40 * empty string is returned.
41 */
42 virtual QString type() const override;
43
44 QTransform finalAffineTransform() const;
45
46 /**
47 * @brief toXML
48 * @return a string containing XML formated transform parameters.
49 */
50 QString toXML() const;
51
52 /**
53 * @brief fromXML set the transform of the transform mask from XML formatted data.
54 * The xml must have a valid id
55 *
56 * dumbparams - placeholder for static transform masks
57 * tooltransformparams - static transform mask
58 * animatedtransformparams - animated transform mask
59 *
60@code
61<!DOCTYPE transform_params>
62<transform_params>
63 <main id="tooltransformparams"/>
64 <data mode="0">
65 <free_transform>
66 <transformedCenter type="pointf" x="12.3102137276208" y="11.0727768562035"/>
67 <originalCenter type="pointf" x="20" y="20"/>
68 <rotationCenterOffset type="pointf" x="0" y="0"/>
69 <transformAroundRotationCenter value="0" type="value"/>
70 <aX value="0" type="value"/>
71 <aY value="0" type="value"/>
72 <aZ value="0" type="value"/>
73 <cameraPos z="1024" type="vector3d" x="0" y="0"/>
74 <scaleX value="1" type="value"/>
75 <scaleY value="1" type="value"/>
76 <shearX value="0" type="value"/>
77 <shearY value="0" type="value"/>
78 <keepAspectRatio value="0" type="value"/>
79 <flattenedPerspectiveTransform m23="0" m31="0" m32="0" type="transform" m33="1" m12="0" m13="0" m22="1" m11="1" m21="0"/>
80 <filterId value="Bicubic" type="value"/>
81 </free_transform>
82 </data>
83</transform_params>
84@endcode
85 * @param xml a valid formated XML string with proper main and data elements.
86 * @return a true response if successful, a false response if failed.
87 */
88 bool fromXML(const QString &xml);
89
90};
91
92#endif // LIBKIS_TRANSFORMMASK_H
93
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition Node.h:24
virtual QString type() const
type Krita has several types of nodes, split in layers and masks.
Definition Node.cpp:462
The TransformMask class A transform mask is a mask type node that can be used to store transformation...
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.