Krita Source Code Documentation
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#ifndef LIBKIS_NODE_H
7#define LIBKIS_NODE_H
8
9#include <QObject>
10
11#include <kis_types.h>
12
13#include "kritalibkis_export.h"
14#include "libkis.h"
15
16#include "PaintingResources.h"
17
23class KRITALIBKIS_EXPORT Node : public QObject
24{
25 Q_OBJECT
26 Q_DISABLE_COPY(Node)
27
28public:
29 static Node *createNode(KisImageSP image, KisNodeSP node, QObject *parent = 0);
30 ~Node() override;
31 bool operator==(const Node &other) const;
32 bool operator!=(const Node &other) const;
33
34public Q_SLOTS:
35
39 Node *clone() const;
40
45 bool alphaLocked() const;
46
50 void setAlphaLocked(bool value);
51
55 QString blendingMode() const;
56
61 void setBlendingMode(QString value);
62
73 QList<Channel*> channels() const;
74
80 QList<Node*> childNodes() const;
81
91 QList<Node*> findChildNodes(const QString &name = QString(), bool recursive = false, bool partialMatch = false, const QString &type = QString(), int colorLabelIndex = 0) const;
92
99 bool addChildNode(Node *child, Node *above);
100
105 bool removeChildNode(Node *child);
106
112 void setChildNodes(QList<Node*> nodes);
113
124 QString colorDepth() const;
125
139 QString colorModel() const;
140
144 QString colorProfile() const;
145
153 bool setColorProfile(const QString &colorProfile);
154
176 bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile);
177
183 bool animated() const;
184
188 void enableAnimation() const;
189
194 void setPinnedToTimeline(bool pinned) const;
195
199 bool isPinnedToTimeline() const;
200
204 void setCollapsed(bool collapsed);
205
209 bool collapsed() const;
210
216 int colorLabel() const;
217
224 void setColorLabel(int index);
225
230 bool inheritAlpha() const;
231
235 void setInheritAlpha(bool value);
236
241 bool locked() const;
242
246 void setLocked(bool value);
247
252 bool hasExtents();
253
254
258 QString name() const;
259
263 void setName(QString name);
264
268 int opacity() const;
269
273 void setOpacity(int value);
274
278 Node* parentNode() const;
279
303 virtual QString type() const;
304
309 QIcon icon() const;
310
314 bool visible() const;
315
319 bool hasKeyframeAtTime(int frameNumber);
320
324 void setVisible(bool visible);
325
368 QByteArray pixelData(int x, int y, int w, int h) const;
369
379 QByteArray pixelDataAtTime(int x, int y, int w, int h, int time) const;
380
423 QByteArray projectionPixelData(int x, int y, int w, int h) const;
424
448 bool setPixelData(QByteArray value, int x, int y, int w, int h);
449
454 QRect bounds() const;
455
459 void move(int x, int y);
460
467 QPoint position() const;
468
472 bool remove();
473
478 Node* duplicate();
479
492 bool save(const QString &filename, double xRes, double yRes, const InfoObject &exportConfiguration, const QRect &exportRect = QRect());
493
498 Node *mergeDown();
499
517 void scaleNode(QPointF origin, int width, int height, QString strategy);
518
523 void rotateNode(double radians);
524
532 void cropNode(int x, int y, int w, int h);
533
539 void shearNode(double angleX, double angleY);
540
548 QImage thumbnail(int w, int h);
549
554 QString layerStyleToAsl();
555
561 bool setLayerStyleFromAsl(const QString &asl);
562
567 int index() const;
568
573 QUuid uniqueId() const;
574
588 void paintLine(const QPointF pointOne,
589 const QPointF pointTwo,
590 double pressureOne = 1.0,
591 double pressureTwo = 1.0,
592 const QString strokeStyle = PaintingResources::defaultStrokeStyle);
593
613 void paintRectangle(const QRectF &rect,
614 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
615 const QString fillStyle = PaintingResources::defaultFillStyle);
616
635 void paintPolygon(const QList<QPointF> points,
636 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
637 const QString fillStyle = PaintingResources::defaultFillStyle);
656 void paintEllipse(const QRectF &rect,
657 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
658 const QString fillStyle = PaintingResources::defaultFillStyle);
677 void paintPath(const QPainterPath &path,
678 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
679 const QString fillStyle = PaintingResources::defaultFillStyle);
691 QString paintAbility();
692
693private:
694
695 friend class Filter;
696 friend class Document;
697 friend class Selection;
698 friend class GroupLayer;
699 friend class FileLayer;
700 friend class FilterLayer;
701 friend class FillLayer;
702 friend class VectorLayer;
703 friend class FilterMask;
704 friend class SelectionMask;
705 friend class TransparencyMask;
706 friend class TransformMask;
707 friend class ColorizeMask;
708 friend class CloneLayer;
709
710 explicit Node(KisImageSP image, KisNodeSP node, QObject *parent = 0);
711
716 KisPaintDeviceSP paintDevice() const;
717 KisImageSP image() const;
718 KisNodeSP node() const;
719
720 struct Private;
721 Private *const d;
722
723};
724
726
727#endif // LIBKIS_NODE_H
float value(const T *src, size_t ch)
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
bool operator!=(const KoID &v1, const KoID &v2)
Definition KoID.h:103
QSharedPointer< Node > NodeSP
Definition Node.h:725
The CloneLayer class A clone layer is a layer that takes a reference inside the image and shows the e...
Definition CloneLayer.h:26
The ColorizeMask class A colorize mask is a mask type node that can be used to color in line art.
The FileLayer class A file layer is a layer that can reference an external image and show said refere...
Definition FileLayer.h:27
The FillLayer class A fill layer is much like a filter layer in that it takes a name and filter....
Definition FillLayer.h:25
The FilterLayer class A filter layer will, when compositing, take the composited image up to the poin...
Definition FilterLayer.h:34
The FilterMask class A filter mask, unlike a filter layer, will add a non-destructive filter to the c...
Definition FilterMask.h:29
The GroupLayer class A group layer is a layer that can contain other layers. In Krita,...
Definition GroupLayer.h:30
Definition Node.h:24
Private *const d
Definition Node.h:721
The SelectionMask class A selection mask is a mask type node that can be used to store selections....
The TransformMask class A transform mask is a mask type node that can be used to store transformation...
The TransparencyMask class A transparency mask is a mask type node that can be used to show and hide ...
The VectorLayer class A vector layer is a special layer that stores and shows vector shapes.
Definition VectorLayer.h:32
#define bounds(x, a, b)
const QString defaultStrokeStyle
const QString defaultFillStyle