Krita Source Code Documentation
Loading...
Searching...
No Matches
Document.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_DOCUMENT_H
7#define LIBKIS_DOCUMENT_H
8
9#include <QFileInfo>
10
11#include "kritalibkis_export.h"
12#include "libkis.h"
13
14#include "GroupLayer.h"
15#include "CloneLayer.h"
16#include "FileLayer.h"
17#include "FilterLayer.h"
18#include "FillLayer.h"
19#include "VectorLayer.h"
20#include "FilterMask.h"
21#include "SelectionMask.h"
22#include "TransparencyMask.h"
23#include "TransformMask.h"
24#include "ColorizeMask.h"
25
26#include "GuidesConfig.h"
27#include "GridConfig.h"
28
29class KisDocument;
30
36class KRITALIBKIS_EXPORT Document : public QObject
37{
38 Q_OBJECT
39 Q_DISABLE_COPY(Document)
40
41public:
42 explicit Document(KisDocument *document, bool ownsDocument, QObject *parent = 0);
43 ~Document() override;
44
45 bool operator==(const Document &other) const;
46 bool operator!=(const Document &other) const;
47
48public Q_SLOTS:
54 Q_DECL_DEPRECATED QList<qreal> horizontalGuides() const;
60 Q_DECL_DEPRECATED QList<qreal> verticalGuides() const;
61
67 Q_DECL_DEPRECATED bool guidesVisible() const;
73 Q_DECL_DEPRECATED bool guidesLocked() const;
74
79 Document *clone() const;
80
85 bool batchmode() const;
86
91 void setBatchmode(bool value);
92
97 Node* activeNode() const;
98
103 void setActiveNode(Node* value);
104
108 QList<Node*> topLevelNodes() const;
109
115 Node *nodeByName(const QString &name) const;
116
122 Node *nodeByUniqueID(const QUuid &id) const;
123
134 QString colorDepth() const;
135
149 QString colorModel() const;
150
154 QString colorProfile() const;
155
164 bool setColorProfile(const QString &colorProfile);
165
191 bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile);
192
199 QColor backgroundColor();
200
208 bool setBackgroundColor(const QColor &color);
209
253 QString documentInfo() const;
254
262 void setDocumentInfo(const QString &document);
263
267 QString fileName() const;
268
272 void setFileName(QString value);
273
277 int height() const;
278
282 void setHeight(int value);
283
287 QString name() const;
288
292 void setName(QString value);
293
297 int resolution() const;
302 void setResolution(int value);
303
309 Node* rootNode() const;
310
315 Selection* selection() const;
316
321 void setSelection(Selection* value);
322
326 int width() const;
327
331 void setWidth(int value);
332
336 int xOffset() const;
337
341 void setXOffset(int x);
342
346 int yOffset() const;
347
351 void setYOffset(int y);
352
358 double xRes() const;
359
364 void setXRes(double xRes) const;
365
370 double yRes() const;
371
376 void setYRes(double yRes) const;
377
410 QByteArray pixelData(int x, int y, int w, int h) const;
411
421 bool close();
422
431 void crop(int x, int y, int w, int h);
432
472 bool exportImage(const QString &filename, const InfoObject &exportConfiguration);
473
477 void flatten();
478
487 void resizeImage(int x, int y, int w, int h);
488
508 void scaleImage(int w, int h, int xres, int yres, QString strategy);
509
515 void rotateImage(double radians);
516
522 void shearImage(double angleX, double angleY);
523
529 bool save();
530
537 bool saveAs(const QString &filename);
538
581 Node* createNode(const QString &name, const QString &nodeType);
589 GroupLayer* createGroupLayer(const QString &name);
600 FileLayer* createFileLayer(const QString &name, const QString fileName, const QString scalingMethod, const QString scalingFilter = "Bicubic");
601
610 FilterLayer* createFilterLayer(const QString &name, Filter &filter, Selection &selection);
611
634 FillLayer* createFillLayer(const QString &name, const QString generatorName, InfoObject &configuration, Selection &selection);
635
642 CloneLayer* createCloneLayer(const QString &name, const Node* source);
643
650 VectorLayer* createVectorLayer(const QString &name);
651
660 FilterMask* createFilterMask(const QString &name, Filter &filter, Selection &selection);
661
670 FilterMask* createFilterMask(const QString &name, Filter &filter, const Node* selection_source);
671
678 SelectionMask* createSelectionMask(const QString &name);
679
686 TransparencyMask* createTransparencyMask(const QString &name);
687
694 TransformMask* createTransformMask(const QString &name);
695
702 ColorizeMask* createColorizeMask(const QString &name);
703
708 QImage projection(int x = 0, int y = 0, int w = 0, int h = 0) const;
709
717 QImage thumbnail(int w, int h) const;
718
719
737 void lock();
738
744 void unlock();
745
751 void waitForDone();
752
762 bool tryBarrierLock();
763
768 void refreshProjection();
769
775 Q_DECL_DEPRECATED void setHorizontalGuides(const QList<qreal> &lines);
781 Q_DECL_DEPRECATED void setVerticalGuides(const QList<qreal> &lines);
782
788 Q_DECL_DEPRECATED void setGuidesVisible(bool visible);
789
795 Q_DECL_DEPRECATED void setGuidesLocked(bool locked);
796
800 bool modified() const;
801
806 void setModified(bool modified);
807
812 QRect bounds() const;
813
814 /****
815 * Animation Related API
816 *****/
817
818
825 bool importAnimation(const QList<QString> &files, int firstFrame, int step);
826
831 int framesPerSecond();
832
836 void setFramesPerSecond(int fps);
837
841 void setFullClipRangeStartTime(int startTime);
842
847 int fullClipRangeStartTime();
848
852 void setFullClipRangeEndTime(int endTime);
853
858 int fullClipRangeEndTime();
859
864 int animationLength();
865
869 void setPlayBackRange(int start, int stop);
870
875 int playBackStartTime();
876
881 int playBackEndTime();
882
887 int currentTime();
888
892 void setCurrentTime(int time);
893
898 QStringList annotationTypes() const;
899
905 QString annotationDescription(const QString &type) const;
906
913 QByteArray annotation(const QString &type);
914
921 void setAnnotation(const QString &type, const QString &description, const QByteArray &annotation);
922
927 void removeAnnotation(const QString &type);
928
941 void setAutosave(bool active);
942
954 bool autosave();
955
960 GuidesConfig *guidesConfig();
961
986 void setGuidesConfig(GuidesConfig *guidesConfig);
987
992 GridConfig *gridConfig();
993
1018 void setGridConfig(GridConfig *gridConfig);
1019
1024 qreal audioLevel() const;
1025
1030 void setAudioLevel(const qreal level);
1031
1036 QList<QString> audioTracks() const;
1037
1050 bool setAudioTracks(const QList<QString> files) const;
1051
1052private:
1053
1054 friend class Krita;
1055 friend class Window;
1056 friend class Filter;
1057 friend class View;
1058 friend class VectorLayer;
1059 friend class Shape;
1060 QPointer<KisDocument> document() const;
1061 void setOwnsDocument(bool ownsDocument);
1062
1063private:
1064 struct Private;
1065 Private *const d;
1066
1067};
1068
1069#endif // LIBKIS_DOCUMENT_H
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
bool operator==(const KisRegion &lhs, const KisRegion &rhs)
bool operator!=(const KoID &v1, const KoID &v2)
Definition KoID.h:103
char nodeType(const KoPathPoint *point)
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.
Private *const d
Definition Document.h:1065
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 Krita.h:28
Definition Node.h:24
The SelectionMask class A selection mask is a mask type node that can be used to store selections....
The Shape class The shape class is a wrapper around Krita's vector objects.
Definition Shape.h:38
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
Definition View.h:25
#define bounds(x, a, b)