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#include "StrokePoint.h"
18
24class KRITALIBKIS_EXPORT Node : public QObject
25{
26 Q_OBJECT
27 Q_DISABLE_COPY(Node)
28
29public:
30 static Node *createNode(KisImageSP image, KisNodeSP node, QObject *parent = 0);
31 ~Node() override;
32 bool operator==(const Node &other) const;
33 bool operator!=(const Node &other) const;
34
35public Q_SLOTS:
36
40 Node *clone() const;
41
46 bool alphaLocked() const;
47
51 void setAlphaLocked(bool value);
52
56 QString blendingMode() const;
57
62 void setBlendingMode(QString value);
63
74 QList<Channel*> channels() const;
75
81 QList<Node*> childNodes() const;
82
92 QList<Node*> findChildNodes(const QString &name = QString(), bool recursive = false, bool partialMatch = false, const QString &type = QString(), int colorLabelIndex = 0) const;
93
100 bool addChildNode(Node *child, Node *above);
101
106 bool removeChildNode(Node *child);
107
113 void setChildNodes(QList<Node*> nodes);
114
125 QString colorDepth() const;
126
140 QString colorModel() const;
141
145 QString colorProfile() const;
146
154 bool setColorProfile(const QString &colorProfile);
155
177 bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile);
178
184 bool animated() const;
185
189 void enableAnimation() const;
190
195 void setPinnedToTimeline(bool pinned) const;
196
200 bool isPinnedToTimeline() const;
201
205 void setCollapsed(bool collapsed);
206
210 bool collapsed() const;
211
217 int colorLabel() const;
218
225 void setColorLabel(int index);
226
231 bool inheritAlpha() const;
232
236 void setInheritAlpha(bool value);
237
242 bool locked() const;
243
247 void setLocked(bool value);
248
253 bool hasExtents();
254
255
259 QString name() const;
260
264 void setName(QString name);
265
269 int opacity() const;
270
274 void setOpacity(int value);
275
279 Node* parentNode() const;
280
304 virtual QString type() const;
305
310 QIcon icon() const;
311
315 bool visible() const;
316
320 bool hasKeyframeAtTime(int frameNumber);
321
325 void setVisible(bool visible);
326
369 QByteArray pixelData(int x, int y, int w, int h) const;
370
380 QByteArray pixelDataAtTime(int x, int y, int w, int h, int time) const;
381
424 QByteArray projectionPixelData(int x, int y, int w, int h) const;
425
449 bool setPixelData(QByteArray value, int x, int y, int w, int h);
450
455 QRect bounds() const;
456
460 void move(int x, int y);
461
468 QPoint position() const;
469
473 bool remove();
474
479 Node* duplicate();
480
493 bool save(const QString &filename, double xRes, double yRes, const InfoObject &exportConfiguration, const QRect &exportRect = QRect());
494
499 Node *mergeDown();
500
518 void scaleNode(QPointF origin, int width, int height, QString strategy);
519
524 void rotateNode(double radians);
525
533 void cropNode(int x, int y, int w, int h);
534
540 void shearNode(double angleX, double angleY);
541
549 QImage thumbnail(int w, int h);
550
555 QString layerStyleToAsl();
556
562 bool setLayerStyleFromAsl(const QString &asl);
563
568 int index() const;
569
574 QUuid uniqueId() const;
575
589 void paintLine(const QPointF pointOne,
590 const QPointF pointTwo,
591 double pressureOne = 1.0,
592 double pressureTwo = 1.0,
593 const QString strokeStyle = PaintingResources::defaultStrokeStyle);
594
607 void paintPolylineStroke(const QList<StrokePoint> &points,
608 const QString strokeStyle = PaintingResources::defaultStrokeStyle);
609
629 void paintRectangle(const QRectF &rect,
630 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
631 const QString fillStyle = PaintingResources::defaultFillStyle);
632
651 void paintPolygon(const QList<QPointF> points,
652 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
653 const QString fillStyle = PaintingResources::defaultFillStyle);
672 void paintEllipse(const QRectF &rect,
673 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
674 const QString fillStyle = PaintingResources::defaultFillStyle);
693 void paintPath(const QPainterPath &path,
694 const QString strokeStyle = PaintingResources::defaultStrokeStyle,
695 const QString fillStyle = PaintingResources::defaultFillStyle);
707 QString paintAbility();
708
709private:
710
711 friend class Filter;
712 friend class Document;
713 friend class Selection;
714 friend class GroupLayer;
715 friend class FileLayer;
716 friend class FilterLayer;
717 friend class FillLayer;
718 friend class VectorLayer;
719 friend class FilterMask;
720 friend class SelectionMask;
721 friend class TransparencyMask;
722 friend class TransformMask;
723 friend class ColorizeMask;
724 friend class CloneLayer;
725
726 explicit Node(KisImageSP image, KisNodeSP node, QObject *parent = 0);
727
732 KisPaintDeviceSP paintDevice() const;
733 KisImageSP image() const;
734 KisNodeSP node() const;
735
736 struct Private;
737 Private *const d;
738
739};
740
742
743#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:741
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:25
Private *const d
Definition Node.h:737
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