Krita

Document.cpp
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "Document.h"
7#include <QPointer>
8#include <QUrl>
9#include <QDomDocument>
10
11#include <KoColorSpaceConstants.h>
12#include <KisDocument.h>
13#include <kis_image.h>
14#include <KisPart.h>
15#include <kis_paint_device.h>
16#include <KisMainWindow.h>
17#include <kis_node_manager.h>
18#include <kis_node_selection_adapter.h>
19#include <KisViewManager.h>
20#include <kis_file_layer.h>
21#include <kis_adjustment_layer.h>
22#include <kis_mask.h>
23#include <kis_clone_layer.h>
24#include <kis_group_layer.h>
25#include <kis_filter_mask.h>
26#include <kis_transform_mask.h>
27#include <kis_transparency_mask.h>
28#include <kis_selection_mask.h>
29#include <lazybrush/kis_colorize_mask.h>
30#include <kis_effect_mask.h>
31#include <kis_paint_layer.h>
32#include <kis_generator_layer.h>
33#include <kis_generator_registry.h>
34#include <kis_shape_layer.h>
35#include <kis_filter_configuration.h>
36#include <kis_filter_registry.h>
37#include <kis_selection.h>
38#include <KisMimeDatabase.h>
39#include <kis_filter_strategy.h>
40#include <kis_guides_config.h>
41#include <kis_grid_config.h>
42#include <kis_coordinates_converter.h>
43#include <kis_time_span.h>
44#include <KisImportExportErrorCode.h>
45#include <kis_types.h>
46#include <kis_annotation.h>
47
48#include <KoColor.h>
49#include <KoColorSpace.h>
50#include <KoColorProfile.h>
51#include <KoColorSpaceRegistry.h>
52#include <KoColorConversionTransformation.h>
53#include <KoDocumentInfo.h>
54#include <KisGlobalResourcesInterface.h>
55
56#include <InfoObject.h>
57#include <Node.h>
58#include <Selection.h>
59#include <LibKisUtils.h>
60
61#include "kis_animation_importer.h"
62#include <kis_canvas2.h>
63#include <KoUpdater.h>
64#include <QMessageBox>
65
66#include <kis_image_animation_interface.h>
67#include <kis_layer_utils.h>
68#include <kis_undo_adapter.h>
69#include <commands/kis_set_global_selection_command.h>
70
71
72struct Document::Private {
73 Private() {}
74 QPointer<KisDocument> document;
75 bool ownsDocument {false};
76};
77
78Document::Document(KisDocument *document, bool ownsDocument, QObject *parent)
79 : QObject(parent)
80 , d(new Private)
81{
82 d->document = document;
83 d->ownsDocument = ownsDocument;
84}
85
86Document::~Document()
87{
88 if (d->ownsDocument && d->document) {
89 KisPart::instance()->removeDocument(d->document);
90 delete d->document;
91 }
92 delete d;
93}
94
95bool Document::operator==(const Document &other) const
96{
97 return (d->document == other.d->document);
98}
99
100bool Document::operator!=(const Document &other) const
101{
102 return !(operator==(other));
103}
104
106{
107 if (!d->document) return false;
108 return d->document->fileBatchMode();
109}
110
112{
113 if (!d->document) return;
114 d->document->setFileBatchMode(value);
115}
116
118{
119 QList<KisNodeSP> activeNodes;
120 Q_FOREACH(QPointer<KisView> view, KisPart::instance()->views()) {
121 if (view && view->document() == d->document) {
122 activeNodes << view->currentNode();
123
124 }
125 }
126 if (activeNodes.size() > 0) {
127 QList<Node*> nodes = LibKisUtils::createNodeList(activeNodes, d->document->image());
128 return nodes.first();
129 }
130
131 return 0;
132}
133
135{
136 if (!value) return;
137 if (!value->node()) return;
138 KisMainWindow *mainWin = KisPart::instance()->currentMainwindow();
139 if (!mainWin) return;
140 KisViewManager *viewManager = mainWin->viewManager();
141 if (!viewManager) return;
142 if (viewManager->document() != d->document) return;
143 KisNodeManager *nodeManager = viewManager->nodeManager();
144 if (!nodeManager) return;
145 KisNodeSelectionAdapter *selectionAdapter = nodeManager->nodeSelectionAdapter();
146 if (!selectionAdapter) return;
147 selectionAdapter->setActiveNode(value->node());
148
149}
150
152{
153 if (!d->document) return QList<Node *>();
154 Node n(d->document->image(), d->document->image()->rootLayer());
155 return n.childNodes();
156}
157
158
160{
161 if (!d->document) return 0;
162 KisNodeSP node = KisLayerUtils::findNodeByName(d->document->image()->rootLayer(),name);
163
164 if (node.isNull()) return 0;
165
166 return Node::createNode(d->document->image(), node);
167}
168
170{
171 if (!d->document) return 0;
172
173 KisNodeSP node = KisLayerUtils::findNodeByUuid(d->document->image()->rootLayer(), id);
174
175 if (node.isNull()) return 0;
176 return Node::createNode(d->document->image(), node);
177}
178
179
181{
182 if (!d->document) return "";
183 return d->document->image()->colorSpace()->colorDepthId().id();
184}
185
187{
188 if (!d->document) return "";
189 return d->document->image()->colorSpace()->colorModelId().id();
190}
191
193{
194 if (!d->document) return "";
195 return d->document->image()->colorSpace()->profile()->name();
196}
197
199{
200 if (!d->document) return false;
201 if (!d->document->image()) return false;
202 const KoColorProfile *profile = KoColorSpaceRegistry::instance()->profileByName(value);
203 if (!profile) return false;
204 bool retval = d->document->image()->assignImageProfile(profile);
205 d->document->image()->waitForDone();
206 return retval;
207}
208
209bool Document::setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile)
210{
211 if (!d->document) return false;
212 if (!d->document->image()) return false;
213 const KoColorSpace *colorSpace = KoColorSpaceRegistry::instance()->colorSpace(colorModel, colorDepth, colorProfile);
214 if (!colorSpace) return false;
215
216 d->document->image()->convertImageColorSpace(colorSpace,
217 KoColorConversionTransformation::IntentPerceptual,
218 KoColorConversionTransformation::HighQuality | KoColorConversionTransformation::NoOptimization);
219
220 d->document->image()->waitForDone();
221 return true;
222}
223
225{
226 if (!d->document) return QColor();
227 if (!d->document->image()) return QColor();
228
229 const KoColor color = d->document->image()->defaultProjectionColor();
230 return color.toQColor();
231}
232
234{
235 if (!d->document) return false;
236 if (!d->document->image()) return false;
237
238 KoColor background = KoColor(color, d->document->image()->colorSpace());
239 d->document->image()->setDefaultProjectionColor(background);
240
241 d->document->image()->setModifiedWithoutUndo();
242 d->document->image()->initialRefreshGraph();
243
244 return true;
245}
246
248{
249 QDomDocument doc = KisDocument::createDomDocument("document-info"
250 /*DTD name*/, "document-info" /*tag name*/, "1.1");
251 doc = d->document->documentInfo()->save(doc);
252 return doc.toString();
253}
254
256{
257 QDomDocument doc;
258 QString errorMsg;
259 int errorLine, errorColumn;
260 doc.setContent(document, &errorMsg, &errorLine, &errorColumn);
261 d->document->documentInfo()->load(doc);
262}
263
264
266{
267 if (!d->document) return QString();
268 return d->document->path();
269}
270
272{
273 if (!d->document) return;
274 QString mimeType = KisMimeDatabase::mimeTypeForFile(value, false);
275 d->document->setMimeType(mimeType.toLatin1());
276 d->document->setPath(value);
277}
278
280{
281 if (!d->document) return 0;
282 KisImageSP image = d->document->image();
283 if (!image) return 0;
284 return image->height();
285}
286
287void Document::setHeight(int value)
288{
289 if (!d->document) return;
290 if (!d->document->image()) return;
291 resizeImage(d->document->image()->bounds().x(),
292 d->document->image()->bounds().y(),
293 d->document->image()->width(),
294 value);
295}
296
297
299{
300 if (!d->document) return "";
301 return d->document->documentInfo()->aboutInfo("title");
302}
303
305{
306 if (!d->document) return;
307 d->document->documentInfo()->setAboutInfo("title", value);
308}
309
310
312{
313 if (!d->document) return 0;
314 KisImageSP image = d->document->image();
315 if (!image) return 0;
316
317 return qRound(d->document->image()->xRes() * 72);
318}
319
321{
322 if (!d->document) return;
323 KisImageSP image = d->document->image();
324 if (!image) return;
325
326 KisFilterStrategy *strategy = KisFilterStrategyRegistry::instance()->get("Bicubic");
327 KIS_SAFE_ASSERT_RECOVER_RETURN(strategy);
328
329 image->scaleImage(image->size(), value / 72.0, value / 72.0, strategy);
330 image->waitForDone();
331}
332
333
335{
336 if (!d->document) return 0;
337 KisImageSP image = d->document->image();
338 if (!image) return 0;
339
340 return Node::createNode(image, image->root());
341}
342
344{
345 if (!d->document) return 0;
346 if (!d->document->image()) return 0;
347 if (!d->document->image()->globalSelection()) return 0;
348 return new Selection(d->document->image()->globalSelection());
349}
350
352{
353 if (!d->document) return;
354 if (!d->document->image()) return;
355 if (value) {
356 d->document->image()->undoAdapter()->addCommand(new KisSetGlobalSelectionCommand(d->document->image(), value->selection()));
357 }
358 else {
359 d->document->image()->undoAdapter()->addCommand(new KisSetGlobalSelectionCommand(d->document->image(), nullptr));
360 }
361}
362
363
365{
366 if (!d->document) return 0;
367 KisImageSP image = d->document->image();
368 if (!image) return 0;
369 return image->width();
370}
371
372void Document::setWidth(int value)
373{
374 if (!d->document) return;
375 if (!d->document->image()) return;
376 resizeImage(d->document->image()->bounds().x(),
377 d->document->image()->bounds().y(),
378 value,
379 d->document->image()->height());
380}
381
382
384{
385 if (!d->document) return 0;
386 KisImageSP image = d->document->image();
387 if (!image) return 0;
388 return image->bounds().x();
389}
390
392{
393 if (!d->document) return;
394 if (!d->document->image()) return;
395 resizeImage(x,
396 d->document->image()->bounds().y(),
397 d->document->image()->width(),
398 d->document->image()->height());
399}
400
401
403{
404 if (!d->document) return 0;
405 KisImageSP image = d->document->image();
406 if (!image) return 0;
407 return image->bounds().y();
408}
409
411{
412 if (!d->document) return;
413 if (!d->document->image()) return;
414 resizeImage(d->document->image()->bounds().x(),
415 y,
416 d->document->image()->width(),
417 d->document->image()->height());
418}
419
420
421double Document::xRes() const
422{
423 if (!d->document) return 0.0;
424 if (!d->document->image()) return 0.0;
425 return d->document->image()->xRes()*72.0;
426}
427
428void Document::setXRes(double xRes) const
429{
430 if (!d->document) return;
431 KisImageSP image = d->document->image();
432 if (!image) return;
433
434 KisFilterStrategy *strategy = KisFilterStrategyRegistry::instance()->get("Bicubic");
435 KIS_SAFE_ASSERT_RECOVER_RETURN(strategy);
436
437 image->scaleImage(image->size(), xRes / 72.0, image->yRes(), strategy);
438 image->waitForDone();
439}
440
441double Document::yRes() const
442{
443 if (!d->document) return 0.0;
444 if (!d->document->image()) return 0.0;
445 return d->document->image()->yRes()*72.0;
446}
447
448void Document::setYRes(double yRes) const
449{
450 if (!d->document) return;
451 KisImageSP image = d->document->image();
452 if (!image) return;
453
454 KisFilterStrategy *strategy = KisFilterStrategyRegistry::instance()->get("Bicubic");
455 KIS_SAFE_ASSERT_RECOVER_RETURN(strategy);
456
457 image->scaleImage(image->size(), image->xRes(), yRes / 72.0, strategy);
458 image->waitForDone();
459}
460
461
462QByteArray Document::pixelData(int x, int y, int w, int h) const
463{
464 QByteArray ba;
465
466 if (!d->document) return ba;
467 KisImageSP image = d->document->image();
468 if (!image) return ba;
469
470 KisPaintDeviceSP dev = image->projection();
471 ba.resize(w * h * dev->pixelSize());
472 dev->readBytes(reinterpret_cast<quint8*>(ba.data()), x, y, w, h);
473 return ba;
474}
475
477{
478 bool retval = d->document->closePath(false);
479
480 Q_FOREACH(KisView *view, KisPart::instance()->views()) {
481 if (view->document() == d->document) {
482 view->close();
483 view->closeView();
484 view->deleteLater();
485 }
486 }
487
488 KisPart::instance()->removeDocument(d->document, !d->ownsDocument);
489
490 if (d->ownsDocument) {
491
492 delete d->document;
493 }
494
495 d->document = 0;
496 return retval;
497}
498
499void Document::crop(int x, int y, int w, int h)
500{
501 if (!d->document) return;
502 KisImageSP image = d->document->image();
503 if (!image) return;
504 QRect rc(x, y, w, h);
505 image->cropImage(rc);
506 image->waitForDone();
507}
508
509bool Document::exportImage(const QString &filename, const InfoObject &exportConfiguration)
510{
511 if (!d->document) return false;
512
513 const QString outputFormatString = KisMimeDatabase::mimeTypeForFile(filename, false);
514 const QByteArray outputFormat = outputFormatString.toLatin1();
515
516 return d->document->exportDocumentSync(filename, outputFormat, exportConfiguration.configuration());
517}
518
520{
521 if (!d->document) return;
522 if (!d->document->image()) return;
523 d->document->image()->flatten(0);
524 d->document->image()->waitForDone();
525}
526
527void Document::resizeImage(int x, int y, int w, int h)
528{
529 if (!d->document) return;
530 KisImageSP image = d->document->image();
531 if (!image) return;
532 QRect rc;
533 rc.setX(x);
534 rc.setY(y);
535 rc.setWidth(w);
536 rc.setHeight(h);
537
538 image->resizeImage(rc);
539 image->waitForDone();
540}
541
542void Document::scaleImage(int w, int h, int xres, int yres, QString strategy)
543{
544 if (!d->document) return;
545 KisImageSP image = d->document->image();
546 if (!image) return;
547 QRect rc = image->bounds();
548 rc.setWidth(w);
549 rc.setHeight(h);
550
551 KisFilterStrategy *actualStrategy = KisFilterStrategyRegistry::instance()->get(strategy);
552 if (!actualStrategy) actualStrategy = KisFilterStrategyRegistry::instance()->get("Bicubic");
553
554 image->scaleImage(rc.size(), xres / 72.0, yres / 72.0, actualStrategy);
555 image->waitForDone();
556}
557
558void Document::rotateImage(double radians)
559{
560 if (!d->document) return;
561 KisImageSP image = d->document->image();
562 if (!image) return;
563 image->rotateImage(radians);
564 image->waitForDone();
565}
566
567void Document::shearImage(double angleX, double angleY)
568{
569 if (!d->document) return;
570 KisImageSP image = d->document->image();
571 if (!image) return;
572 image->shear(angleX, angleY);
573 image->waitForDone();
574}
575
577{
578 if (!d->document) return false;
579 if (d->document->path().isEmpty()) return false;
580
581 bool retval = d->document->save(true, 0);
582 d->document->waitForSavingToComplete();
583
584 return retval;
585}
586
587bool Document::saveAs(const QString &filename)
588{
589 if (!d->document) return false;
590
591 setFileName(filename);
592 const QString outputFormatString = KisMimeDatabase::mimeTypeForFile(filename, false);
593 const QByteArray outputFormat = outputFormatString.toLatin1();
594 QString oldPath = d->document->path();
595 d->document->setPath(filename);
596 bool retval = d->document->saveAs(filename, outputFormat, true);
597 d->document->waitForSavingToComplete();
598 d->document->setPath(oldPath);
599
600 return retval;
601}
602
603Node* Document::createNode(const QString &name, const QString &nodeType)
604{
605 if (!d->document) return 0;
606 if (!d->document->image()) return 0;
607 KisImageSP image = d->document->image();
608
609 Node *node = 0;
610
611 if (nodeType.toLower()== "paintlayer") {
612 node = new Node(image, new KisPaintLayer(image, name, OPACITY_OPAQUE_U8));
613 }
614 else if (nodeType.toLower() == "grouplayer") {
615 node = new Node(image, new KisGroupLayer(image, name, OPACITY_OPAQUE_U8));
616 }
617 else if (nodeType.toLower() == "filelayer") {
618 node = new Node(image, new KisFileLayer(image, name, OPACITY_OPAQUE_U8));
619 }
620 else if (nodeType.toLower() == "filterlayer") {
621 node = new Node(image, new KisAdjustmentLayer(image, name, 0, 0));
622 }
623 else if (nodeType.toLower() == "filllayer") {
624 node = new Node(image, new KisGeneratorLayer(image, name, 0, 0));
625 }
626 else if (nodeType.toLower() == "clonelayer") {
627 node = new Node(image, new KisCloneLayer(0, image, name, OPACITY_OPAQUE_U8));
628 }
629 else if (nodeType.toLower() == "vectorlayer") {
630 node = new Node(image, new KisShapeLayer(d->document->shapeController(), image, name, OPACITY_OPAQUE_U8));
631 }
632 else if (nodeType.toLower() == "transparencymask") {
633 node = new Node(image, new KisTransparencyMask(image, name));
634 }
635 else if (nodeType.toLower() == "filtermask") {
636 node = new Node(image, new KisFilterMask(image, name));
637 }
638 else if (nodeType.toLower() == "transformmask") {
639 node = new Node(image, new KisTransformMask(image, name));
640 }
641 else if (nodeType.toLower() == "selectionmask") {
642 node = new Node(image, new KisSelectionMask(image, name));
643 }
644 else if (nodeType.toLower() == "colorizemask") {
645 node = new Node(image, new KisColorizeMask(image, name));
646 }
647
648 return node;
649}
650
652{
653 if (!d->document) return 0;
654 if (!d->document->image()) return 0;
655 KisImageSP image = d->document->image();
656
657 return new GroupLayer(image, name);
658}
659
660FileLayer *Document::createFileLayer(const QString &name, const QString fileName, const QString scalingMethod, const QString scalingFilter)
661{
662 if (!d->document) return 0;
663 if (!d->document->image()) return 0;
664 KisImageSP image = d->document->image();
665
666 return new FileLayer(image, name, this->fileName(), fileName, scalingMethod, scalingFilter);
667}
668
670{
671 if (!d->document) return 0;
672 if (!d->document->image()) return 0;
673 KisImageSP image = d->document->image();
674
675 return new FilterLayer(image, name, filter, selection);
676}
677
678FillLayer *Document::createFillLayer(const QString &name, const QString generatorName, InfoObject &configuration, Selection &selection)
679{
680 if (!d->document) return 0;
681 if (!d->document->image()) return 0;
682 KisImageSP image = d->document->image();
683
684 KisGeneratorSP generator = KisGeneratorRegistry::instance()->value(generatorName);
685 if (generator) {
686
687 KisFilterConfigurationSP config = generator->factoryConfiguration(KisGlobalResourcesInterface::instance());
688 Q_FOREACH(const QString property, configuration.properties().keys()) {
689 config->setProperty(property, configuration.property(property));
690 }
691
692 return new FillLayer(image, name, config, selection);
693 }
694 return 0;
695}
696
698{
699 if (!d->document) return 0;
700 if (!d->document->image()) return 0;
701 KisImageSP image = d->document->image();
702 KisLayerSP layer = qobject_cast<KisLayer*>(source->node().data());
703
704 return new CloneLayer(image, name, layer);
705}
706
708{
709 if (!d->document) return 0;
710 if (!d->document->image()) return 0;
711 KisImageSP image = d->document->image();
712
713 return new VectorLayer(d->document->shapeController(), image, name);
714}
715
716FilterMask *Document::createFilterMask(const QString &name, Filter &filter, const Node *selection_source)
717{
718 if (!d->document)
719 return 0;
720
721 if (!d->document->image())
722 return 0;
723
724 if(!selection_source)
725 return 0;
726
727 KisLayerSP layer = qobject_cast<KisLayer*>(selection_source->node().data());
728 if(layer.isNull())
729 return 0;
730
731 KisImageSP image = d->document->image();
732 FilterMask* mask = new FilterMask(image, name, filter);
733 qobject_cast<KisMask*>(mask->node().data())->initSelection(layer);
734
735 return mask;
736}
737
739{
740 if (!d->document)
741 return 0;
742
743 if (!d->document->image())
744 return 0;
745
746 KisImageSP image = d->document->image();
747 FilterMask* mask = new FilterMask(image, name, filter);
748 qobject_cast<KisMask*>(mask->node().data())->setSelection(selection.selection());
749
750 return mask;
751}
752
754{
755 if (!d->document) return 0;
756 if (!d->document->image()) return 0;
757 KisImageSP image = d->document->image();
758
759 return new SelectionMask(image, name);
760}
761
763{
764 if (!d->document) return 0;
765 if (!d->document->image()) return 0;
766 KisImageSP image = d->document->image();
767
768 return new TransparencyMask(image, name);
769}
770
772{
773 if (!d->document) return 0;
774 if (!d->document->image()) return 0;
775 KisImageSP image = d->document->image();
776
777 return new TransformMask(image, name);
778}
779
781{
782 if (!d->document) return 0;
783 if (!d->document->image()) return 0;
784 KisImageSP image = d->document->image();
785
786 return new ColorizeMask(image, name);
787}
788
789QImage Document::projection(int x, int y, int w, int h) const
790{
791 if (!d->document || !d->document->image()) return QImage();
792 return d->document->image()->convertToQImage(x, y, w, h, 0);
793}
794
795QImage Document::thumbnail(int w, int h) const
796{
797 if (!d->document || !d->document->image()) return QImage();
798 return d->document->generatePreview(QSize(w, h)).toImage();
799}
800
801
803{
804 if (!d->document || !d->document->image()) return;
805 d->document->image()->barrierLock();
806}
807
809{
810 if (!d->document || !d->document->image()) return;
811 d->document->image()->unlock();
812}
813
815{
816 if (!d->document || !d->document->image()) return;
817 KisLayerUtils::forceAllDelayedNodesUpdate(d->document->image()->rootLayer());
818 d->document->image()->waitForDone();
819}
820
822{
823 if (!d->document || !d->document->image()) return false;
824 return d->document->image()->tryBarrierLock();
825}
826
828{
829 if (!d->document || !d->document->image()) return;
830 d->document->image()->refreshGraphAsync();
831 d->document->image()->waitForDone();
832
833}
834
836{
837 warnScript << "DEPRECATED Document.horizontalGuides() - use Document.guidesConfig().horizontalGuides() instead";
838 QList<qreal> lines;
839 if (!d->document || !d->document->image()) return lines;
840 KisCoordinatesConverter converter;
841 converter.setImage(d->document->image());
842 QTransform transform = converter.imageToDocumentTransform().inverted();
843 QList<qreal> untransformedLines = d->document->guidesConfig().horizontalGuideLines();
844 for (int i = 0; i< untransformedLines.size(); i++) {
845 qreal line = untransformedLines[i];
846 lines.append(transform.map(QPointF(line, line)).x());
847 }
848 return lines;
849}
850
852{
853 warnScript << "DEPRECATED Document.verticalGuides() - use Document.guidesConfig().verticalGuides() instead";
854 QList<qreal> lines;
855 if (!d->document || !d->document->image()) return lines;
856 KisCoordinatesConverter converter;
857 converter.setImage(d->document->image());
858 QTransform transform = converter.imageToDocumentTransform().inverted();
859 QList<qreal> untransformedLines = d->document->guidesConfig().verticalGuideLines();
860 for (int i = 0; i< untransformedLines.size(); i++) {
861 qreal line = untransformedLines[i];
862 lines.append(transform.map(QPointF(line, line)).y());
863 }
864 return lines;
865}
866
868{
869 warnScript << "DEPRECATED Document.guidesVisible() - use Document.guidesConfig().visible() instead";
870 return d->document->guidesConfig().showGuides();
871}
872
874{
875 warnScript << "DEPRECATED Document.guidesLocked() - use Document.guidesConfig().locked() instead";
876 return d->document->guidesConfig().lockGuides();
877}
878
880{
881 if (!d->document) return 0;
882 QPointer<KisDocument> clone = d->document->clone();
883
884 /// We set ownsDocument to true, it will be reset
885 /// automatically as soon as we create the first
886 /// view for the document
887 Document * newDocument = new Document(clone, true);
888 return newDocument;
889}
890
892{
893 warnScript << "DEPRECATED Document.setHorizontalGuides() - use Document.guidesConfig().setHorizontalGuides() instead";
894 if (!d->document) return;
895 KisGuidesConfig config = d->document->guidesConfig();
896 KisCoordinatesConverter converter;
897 converter.setImage(d->document->image());
898 QTransform transform = converter.imageToDocumentTransform();
899 QList<qreal> transformedLines;
900 for (int i = 0; i< lines.size(); i++) {
901 qreal line = lines[i];
902 transformedLines.append(transform.map(QPointF(line, line)).x());
903 }
904 config.setHorizontalGuideLines(transformedLines);
905 d->document->setGuidesConfig(config);
906}
907
909{
910 warnScript << "DEPRECATED Document.setVerticalGuides() - use Document.guidesConfig().setVerticalGuides() instead";
911 if (!d->document) return;
912 KisGuidesConfig config = d->document->guidesConfig();
913 KisCoordinatesConverter converter;
914 converter.setImage(d->document->image());
915 QTransform transform = converter.imageToDocumentTransform();
916 QList<qreal> transformedLines;
917 for (int i = 0; i< lines.size(); i++) {
918 qreal line = lines[i];
919 transformedLines.append(transform.map(QPointF(line, line)).y());
920 }
921 config.setVerticalGuideLines(transformedLines);
922 d->document->setGuidesConfig(config);
923}
924
926{
927 warnScript << "DEPRECATED Document.setGuidesVisible() - use Document.guidesConfig().setVisible() instead";
928 if (!d->document) return;
929 KisGuidesConfig config = d->document->guidesConfig();
930 config.setShowGuides(visible);
931 d->document->setGuidesConfig(config);
932}
933
935{
936 warnScript << "DEPRECATED Document.setGuidesLocked() - use Document.guidesConfig().setLocked() instead";
937 if (!d->document) return;
938 KisGuidesConfig config = d->document->guidesConfig();
939 config.setLockGuides(locked);
940 d->document->setGuidesConfig(config);
941}
942
944{
945 if (!d->document) return false;
946 return d->document->isModified();
947}
948
949void Document::setModified(bool modified)
950{
951 if (!d->document) return;
952 d->document->setModified(modified);
953}
954
956{
957 if (!d->document) return QRect();
958 return d->document->image()->bounds();
959}
960
961QPointer<KisDocument> Document::document() const
962{
963 return d->document;
964}
965
966void Document::setOwnsDocument(bool ownsDocument)
967{
968 d->ownsDocument = ownsDocument;
969}
970
971/* Animation related function */
972
973bool Document::importAnimation(const QList<QString> &files, int firstFrame, int step)
974{
975 KisView *activeView = KisPart::instance()->currentMainwindow()->activeView();
976
977 KoUpdaterPtr updater = 0;
978 if (activeView && d->document->fileBatchMode()) {
979 updater = activeView->viewManager()->createUnthreadedUpdater(i18n("Import frames"));
980 }
981
982 KisAnimationImporter importer(d->document->image(), updater);
983 KisImportExportErrorCode status = importer.import(files, firstFrame, step);
984
985 return status.isOk();
986}
987
989{
990 if (!d->document) return false;
991 if (!d->document->image()) return false;
992
993 return d->document->image()->animationInterface()->framerate();
994}
995
997{
998 if (!d->document) return;
999 if (!d->document->image()) return;
1000
1001 d->document->image()->animationInterface()->setFramerate(fps);
1002}
1003
1005{
1006 if (!d->document) return;
1007 if (!d->document->image()) return;
1008
1009 d->document->image()->animationInterface()->setDocumentRangeStartFrame(startTime);
1010}
1011
1012
1014{
1015 if (!d->document) return false;
1016 if (!d->document->image()) return false;
1017
1018 return d->document->image()->animationInterface()->documentPlaybackRange().start();
1019}
1020
1021
1023{
1024 if (!d->document) return;
1025 if (!d->document->image()) return;
1026
1027 d->document->image()->animationInterface()->setDocumentRangeEndFrame(endTime);
1028}
1029
1030
1032{
1033 if (!d->document) return false;
1034 if (!d->document->image()) return false;
1035
1036 return d->document->image()->animationInterface()->documentPlaybackRange().end();
1037}
1038
1040{
1041 if (!d->document) return false;
1042 if (!d->document->image()) return false;
1043
1044 return d->document->image()->animationInterface()->totalLength();
1045}
1046
1048{
1049 if (!d->document) return;
1050 if (!d->document->image()) return;
1051
1052 const KisTimeSpan newTimeRange = KisTimeSpan::fromTimeWithDuration(start, (stop-start));
1053 d->document->image()->animationInterface()->setActivePlaybackRange(newTimeRange);
1054}
1055
1057{
1058 if (!d->document) return false;
1059 if (!d->document->image()) return false;
1060
1061 return d->document->image()->animationInterface()->activePlaybackRange().start();
1062}
1063
1065{
1066 if (!d->document) return false;
1067 if (!d->document->image()) return false;
1068
1069 return d->document->image()->animationInterface()->activePlaybackRange().end();
1070}
1071
1073{
1074 if (!d->document) return false;
1075 if (!d->document->image()) return false;
1076
1077 return d->document->image()->animationInterface()->currentTime();
1078}
1079
1081{
1082 if (!d->document) return;
1083 if (!d->document->image()) return;
1084
1085 return d->document->image()->animationInterface()->requestTimeSwitchWithUndo(time);
1086}
1087
1089{
1090 if (!d->document) return QStringList();
1091
1092 QStringList types;
1093
1094 KisImageSP image = d->document->image().toStrongRef();
1095
1096 if (!image) return QStringList();
1097
1098 vKisAnnotationSP_it beginIt = image->beginAnnotations();
1099 vKisAnnotationSP_it endIt = image->endAnnotations();
1100
1101 vKisAnnotationSP_it it = beginIt;
1102 while (it != endIt) {
1103 if (!(*it) || (*it)->type().isEmpty()) {
1104 qWarning() << "Warning: empty annotation";
1105 it++;
1106 continue;
1107 }
1108 types << (*it)->type();
1109
1110 it++;
1111 }
1112 return types;
1113}
1114
1116{
1117 KisImageSP image = d->document->image().toStrongRef();
1118 KisAnnotationSP annotation = image->annotation(type);
1119 return annotation->description();
1120}
1121
1123{
1124 KisImageSP image = d->document->image().toStrongRef();
1125 KisAnnotationSP annotation = image->annotation(type);
1126 if (annotation) {
1127 return annotation->annotation();
1128 }
1129 else {
1130 return QByteArray();
1131 }
1132}
1133
1134void Document::setAnnotation(const QString &key, const QString &description, const QByteArray &annotation)
1135{
1136 KisAnnotation *a = new KisAnnotation(key, description, annotation);
1137 KisImageSP image = d->document->image().toStrongRef();
1138 image->addAnnotation(a);
1139
1140}
1141
1143{
1144 KisImageSP image = d->document->image().toStrongRef();
1145 image->removeAnnotation(type);
1146}
1147
1148void Document::setAutosave(bool active)
1149{
1150 d->document->setAutoSaveActive(active);
1151}
1152
1154{
1155 return d->document->isAutoSaveActive();
1156}
1157
1159{
1160 // The way Krita manage guides position is a little bit strange
1161 //
1162 // Let's say, set a guide at a position of 100pixels from UI
1163 // In KisGuidesConfig, the saved position (using KoUnit 'px') is set taking in account the
1164 // document resolution
1165 // So:
1166 // 100px at 300dpi ==> the stored value will be 72 * 100 / 300.00 = 24.00
1167 // 100px at 600dpi ==> the stored value will be 72 * 100 / 600.00 = 12.00
1168 // We have a position saved in 'pt', with unit 'px'
1169 // This is also what is saved in maindoc.xml...
1170 //
1171 // The weird thing in this process:
1172 // - use unit 'px' as what is reallt stored is 'pt'
1173 // - use 'pt' to store an information that should be 'px' (because 100pixels is 100pixels whatever the
1174 // resolution of document)
1175 //
1176 // But OK, it works like this and reviewing this is probably a huge workload, and also there'll be
1177 // a problem with old saved documents (taht's store 100px@300dpi as '24.00')
1178 //
1179 // The solution here is, before restitue the guideConfig to user, the internal value is transformed...
1180 KisGuidesConfig *tmpConfig = new KisGuidesConfig(d->document->guidesConfig());
1181
1182 if (d->document && d->document->image()) {
1183 KisCoordinatesConverter converter;
1184 converter.setImage(d->document->image());
1185
1186 QTransform transform = converter.imageToDocumentTransform().inverted();
1187
1188 QList<qreal> transformedLines;
1189 QList<qreal> untransformedLines = tmpConfig->horizontalGuideLines();
1190 for (int i = 0; i< untransformedLines.size(); i++) {
1191 qreal untransformedLine = untransformedLines[i];
1192 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).x());
1193 }
1194 tmpConfig->setHorizontalGuideLines(transformedLines);
1195
1196 transformedLines.clear();
1197 untransformedLines = tmpConfig->verticalGuideLines();
1198 for (int i = 0; i< untransformedLines.size(); i++) {
1199 qreal untransformedLine = untransformedLines[i];
1200 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).y());
1201 }
1202 tmpConfig->setVerticalGuideLines(transformedLines);
1203 }
1204 else {
1205 // unable to proceed to transform, return no guides
1206 tmpConfig->removeAllGuides();
1207 }
1208
1209 GuidesConfig *guideConfig = new GuidesConfig(tmpConfig);
1210 return guideConfig;
1211}
1212
1214{
1215 if (!d->document) return;
1216 // Like for guidesConfig() method, need to manage transform from internal stored value
1217 // to pixels values
1218 KisGuidesConfig tmpConfig = guidesConfig->guidesConfig();
1219
1220 if (d->document->image()) {
1221 KisCoordinatesConverter converter;
1222 converter.setImage(d->document->image());
1223
1224 QTransform transform = converter.imageToDocumentTransform();
1225
1226 QList<qreal> transformedLines;
1227 QList<qreal> untransformedLines = tmpConfig.horizontalGuideLines();
1228 for (int i = 0; i< untransformedLines.size(); i++) {
1229 qreal untransformedLine = untransformedLines[i];
1230 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).x());
1231 }
1232 tmpConfig.setHorizontalGuideLines(transformedLines);
1233
1234 transformedLines.clear();
1235 untransformedLines = tmpConfig.verticalGuideLines();
1236 for (int i = 0; i< untransformedLines.size(); i++) {
1237 qreal untransformedLine = untransformedLines[i];
1238 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).x());
1239 }
1240 tmpConfig.setVerticalGuideLines(transformedLines);
1241 }
1242 else {
1243 // unable to proceed to transform, set no guides
1244 tmpConfig.removeAllGuides();
1245 }
1246
1247 d->document->setGuidesConfig(tmpConfig);
1248}
1249
1250
1252{
1253 KisGridConfig *tmpConfig = new KisGridConfig(d->document->gridConfig());
1254 GridConfig *gridConfig = new GridConfig(tmpConfig);
1255 return gridConfig;
1256}
1257
1259{
1260 if (!d->document) return;
1261 KisGridConfig tmpConfig = gridConfig->gridConfig();
1262 d->document->setGridConfig(tmpConfig);
1263}
1264
1266{
1267 return d->document->getAudioLevel();
1268}
1269
1270void Document::setAudioLevel(const qreal level)
1271{
1272 d->document->setAudioVolume(level);
1273}
1274
1276{
1277 QList<QString> fileList;
1278 Q_FOREACH(QFileInfo fileInfo, d->document->getAudioTracks()) {
1279 fileList.append(fileInfo.absoluteFilePath());
1280 }
1281 return fileList;
1282}
1283
1285{
1286 bool returned = true;
1287 QVector<QFileInfo> fileList;
1288 QFileInfo fileInfo;
1289 Q_FOREACH(QString fileName, files) {
1290 fileInfo.setFile(fileName);
1291 if (fileInfo.exists()) {
1292 // ensure the file exists before adding it
1293 fileList.append(fileName);
1294 }
1295 else {
1296 // if at least one file is not valid, return false
1297 returned = false;
1298 }
1299 }
1300 d->document->setAudioTracks(fileList);
1301 return returned;
1302}
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 Document class encapsulates a Krita Document/Image.
Definition Document.h:37
QImage projection(int x=0, int y=0, int w=0, int h=0) const
projection creates a QImage from the rendered image or a cutout rectangle.
Definition Document.cpp:789
Q_DECL_DEPRECATED bool guidesVisible() const
DEPRECATED - use guidesConfig() instead Returns guide visibility.
Definition Document.cpp:867
int resolution() const
Definition Document.cpp:311
TransformMask * createTransformMask(const QString &name)
createTransformMask Creates a transform mask, which can be used to apply a transformation non-destruc...
Definition Document.cpp:771
int animationLength()
get total frame range for animation
Q_DECL_DEPRECATED void setGuidesLocked(bool locked)
DEPRECATED - use guidesConfig() instead set guides locked on this document.
Definition Document.cpp:934
void setGuidesConfig(GuidesConfig *guidesConfig)
void setFramesPerSecond(int fps)
set frames per second of document
Definition Document.cpp:996
void setFullClipRangeEndTime(int endTime)
set full clip range end time
void setSelection(Selection *value)
setSelection set or replace the global selection
Definition Document.cpp:351
void setFullClipRangeStartTime(int startTime)
set start time of animation
int height() const
Definition Document.cpp:279
SelectionMask * createSelectionMask(const QString &name)
createSelectionMask Creates a selection mask, which can be used to store selections.
Definition Document.cpp:753
QList< Node * > topLevelNodes() const
toplevelNodes return a list with all top level nodes in the image graph
Definition Document.cpp:151
int currentTime()
get current frame selected of animation
bool close()
close Close the document: remove it from Krita's internal list of documents and close all views.
Definition Document.cpp:476
bool modified() const
modified returns true if the document has unsaved modifications.
Definition Document.cpp:943
void setDocumentInfo(const QString &document)
setDocumentInfo set the Document information to the information contained in document
Definition Document.cpp:255
int fullClipRangeEndTime()
get the full clip range end time
QImage thumbnail(int w, int h) const
thumbnail create a thumbnail of the given dimensions.
Definition Document.cpp:795
ColorizeMask * createColorizeMask(const QString &name)
createColorizeMask Creates a colorize mask, which can be used to color fill via keystrokes.
Definition Document.cpp:780
void flatten()
flatten all layers in the image
Definition Document.cpp:519
void setXOffset(int x)
setXOffset sets the left edge of the canvas to x.
Definition Document.cpp:391
bool importAnimation(const QList< QString > &files, int firstFrame, int step)
Import an image sequence of files from a directory.
Definition Document.cpp:973
int fullClipRangeStartTime()
get the full clip range start time
bool setBackgroundColor(const QColor &color)
setBackgroundColor sets the background color of the document.
Definition Document.cpp:233
void setActiveNode(Node *value)
setActiveNode make the given node active in the currently active view and window
Definition Document.cpp:134
void setYOffset(int y)
setYOffset sets the top edge of the canvas to y.
Definition Document.cpp:410
void setGridConfig(GridConfig *gridConfig)
QString name() const
Definition Document.cpp:298
Q_DECL_DEPRECATED void setHorizontalGuides(const QList< qreal > &lines)
DEPRECATED - use guidesConfig() instead replace all existing horizontal guides with the entries in th...
Definition Document.cpp:891
QString colorProfile() const
Definition Document.cpp:192
void resizeImage(int x, int y, int w, int h)
resizeImage resizes the canvas to the given left edge, top edge, width and height.
Definition Document.cpp:527
Node * rootNode() const
rootNode the root node is the invisible group layer that contains the entire node hierarchy.
Definition Document.cpp:334
QString colorModel() const
colorModel retrieve the current color model of this document:
Definition Document.cpp:186
bool setAudioTracks(const QList< QString > files) const
Set a list of audio tracks for document Note: the function allows to add more than one file while fro...
bool saveAs(const QString &filename)
saveAs save the document under the filename.
Definition Document.cpp:587
QString fileName() const
Definition Document.cpp:265
void unlock()
Unlocks the image and starts/resumes all the pending internal jobs.
Definition Document.cpp:808
Node * activeNode() const
activeNode retrieve the node that is currently active in the currently active window
Definition Document.cpp:117
QStringList annotationTypes() const
annotationTypes returns the list of annotations present in the document.
void rotateImage(double radians)
rotateImage Rotate the image by the given radians.
Definition Document.cpp:558
int playBackEndTime()
get end time of current playback
FillLayer * createFillLayer(const QString &name, const QString generatorName, InfoObject &configuration, Selection &selection)
createFillLayer creates a fill layer object, which is a layer
Definition Document.cpp:678
bool setColorProfile(const QString &colorProfile)
setColorProfile set the color profile of the image to the given profile.
Definition Document.cpp:198
void setPlayBackRange(int start, int stop)
set temporary playback range of document
GuidesConfig * guidesConfig()
Returns a GuidesConfig guides configuration for current document.
void scaleImage(int w, int h, int xres, int yres, QString strategy)
scaleImage
Definition Document.cpp:542
void setAudioLevel(const qreal level)
Set current audio level for document.
void setAutosave(bool active)
Allow to activate/deactivate autosave for document When activated, it will use default Krita autosave...
double yRes() const
Definition Document.cpp:441
Document * clone() const
clone create a shallow clone of this document.
Definition Document.cpp:879
void setName(QString value)
setName sets the name of the document to value.
Definition Document.cpp:304
void setXRes(double xRes) const
setXRes set the horizontal resolution of the image to xRes in pixels per inch
Definition Document.cpp:428
CloneLayer * createCloneLayer(const QString &name, const Node *source)
createCloneLayer
Definition Document.cpp:697
qreal audioLevel() const
Return current audio level for document.
bool setColorSpace(const QString &colorModel, const QString &colorDepth, const QString &colorProfile)
setColorSpace convert the nodes and the image to the given colorspace.
Definition Document.cpp:209
int yOffset() const
Definition Document.cpp:402
void removeAnnotation(const QString &type)
removeAnnotation remove the specified annotation from the image
bool batchmode() const
Batchmode means that no actions on the document should show dialogs or popups.
Definition Document.cpp:105
void waitForDone()
Wait for all the internal image jobs to complete and return without locking the image.
Definition Document.cpp:814
Q_DECL_DEPRECATED void setGuidesVisible(bool visible)
DEPRECATED - use guidesConfig() instead set guides visible on this document.
Definition Document.cpp:925
void setModified(bool modified)
setModified sets the modified status of the document
Definition Document.cpp:949
Q_DECL_DEPRECATED QList< qreal > verticalGuides() const
DEPRECATED - use guidesConfig() instead The vertical guide lines.
Definition Document.cpp:851
void refreshProjection()
Starts a synchronous recomposition of the projection: everything will wait until the image is fully r...
Definition Document.cpp:827
Q_DECL_DEPRECATED bool guidesLocked() const
DEPRECATED - use guidesConfig() instead Returns guide lockedness.
Definition Document.cpp:873
QString documentInfo() const
documentInfo creates and XML document representing document and author information.
Definition Document.cpp:247
Node * nodeByUniqueID(const QUuid &id) const
nodeByUniqueID searches the node tree for a node with the given name and returns it.
Definition Document.cpp:169
VectorLayer * createVectorLayer(const QString &name)
createVectorLayer Creates a vector layer that can contain vector shapes.
Definition Document.cpp:707
Node * createNode(const QString &name, const QString &nodeType)
Definition Document.cpp:603
Q_DECL_DEPRECATED QList< qreal > horizontalGuides() const
DEPRECATED - use guidesConfig() instead The horizontal guides.
Definition Document.cpp:835
void setWidth(int value)
setWidth resize the document to
Definition Document.cpp:372
GridConfig * gridConfig()
Returns a GridConfig grid configuration for current document.
int width() const
Definition Document.cpp:364
Q_DECL_DEPRECATED void setVerticalGuides(const QList< qreal > &lines)
DEPRECATED - use guidesConfig() instead replace all existing horizontal guides with the entries in th...
Definition Document.cpp:908
bool tryBarrierLock()
Tries to lock the image without waiting for the jobs to finish.
Definition Document.cpp:821
QString colorDepth() const
colorDepth A string describing the color depth of the image:
Definition Document.cpp:180
bool save()
save the image to its currently set path.
Definition Document.cpp:576
void setYRes(double yRes) const
setYRes set the vertical resolution of the image to yRes in pixels per inch
Definition Document.cpp:448
bool autosave()
Return autosave status for document Notes:
void setFileName(QString value)
setFileName set the full path of the document to
Definition Document.cpp:271
FileLayer * createFileLayer(const QString &name, const QString fileName, const QString scalingMethod, const QString scalingFilter="Bicubic")
createFileLayer returns a layer that shows an external image.
Definition Document.cpp:660
int playBackStartTime()
get start time of current playback
TransparencyMask * createTransparencyMask(const QString &name)
createTransparencyMask Creates a transparency mask, which can be used to assign transparency to regio...
Definition Document.cpp:762
bool exportImage(const QString &filename, const InfoObject &exportConfiguration)
exportImage export the image, without changing its URL to the given path.
Definition Document.cpp:509
void setBatchmode(bool value)
Set batchmode to value.
Definition Document.cpp:111
void setAnnotation(const QString &type, const QString &description, const QByteArray &annotation)
setAnnotation Add the given annotation to the document
int framesPerSecond()
frames per second of document
Definition Document.cpp:988
void crop(int x, int y, int w, int h)
crop the image to rectangle described by x, y, w and h
Definition Document.cpp:499
int xOffset() const
Definition Document.cpp:383
Selection * selection() const
selection Create a Selection object around the global selection, if there is one.
Definition Document.cpp:343
void setResolution(int value)
setResolution set the resolution of the image; this does not scale the image
Definition Document.cpp:320
QColor backgroundColor()
backgroundColor returns the current background color of the document.
Definition Document.cpp:224
QByteArray pixelData(int x, int y, int w, int h) const
pixelData reads the given rectangle from the image projection and returns it as a byte array.
Definition Document.cpp:462
QRect bounds() const
bounds return the bounds of the image
Definition Document.cpp:955
void lock()
[low-level] Lock the image without waiting for all the internal job queues are processed
Definition Document.cpp:802
QString annotationDescription(const QString &type) const
annotationDescription gets the pretty description for the current annotation
void shearImage(double angleX, double angleY)
shearImage shear the whole image.
Definition Document.cpp:567
FilterLayer * createFilterLayer(const QString &name, Filter &filter, Selection &selection)
createFilterLayer creates a filter layer, which is a layer that represents a filter applied non-destr...
Definition Document.cpp:669
Node * nodeByName(const QString &name) const
nodeByName searches the node tree for a node with the given name and returns it
Definition Document.cpp:159
QList< QString > audioTracks() const
Return a list of current audio tracks for document.
FilterMask * createFilterMask(const QString &name, Filter &filter, Selection &selection)
createFilterMask Creates a filter mask object that much like a filterlayer can apply a filter non-des...
Definition Document.cpp:738
double xRes() const
Definition Document.cpp:421
QByteArray annotation(const QString &type)
annotation the actual data for the annotation for this type.
void setCurrentTime(int time)
set current time of document's animation
GroupLayer * createGroupLayer(const QString &name)
createGroupLayer Returns a grouplayer object.
Definition Document.cpp:651
void setHeight(int value)
setHeight resize the document to
Definition Document.cpp:287
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
Filter: represents a filter and its configuration.
Definition Filter.h:31
The GridConfig class encapsulates a Krita Guides configuration.
Definition GridConfig.h:20
The GroupLayer class A group layer is a layer that can contain other layers.
Definition GroupLayer.h:30
The GuidesConfig class encapsulates a Krita Guides configuration.
InfoObject wrap a properties map.
Definition InfoObject.h:20
QVariant property(const QString &key)
return the value for the property identified by key, or None if there is no such key.
QMap< QString, QVariant > properties() const
Return all properties this InfoObject manages.
Node represents a layer or mask in a Krita image's Node hierarchy.
Definition Node.h:24
QList< Node * > childNodes() const
childNodes
Definition Node.cpp:211
The SelectionMask class A selection mask is a mask type node that can be used to store selections.
Selection represents a selection on Krita.
Definition Selection.h:31
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
void stop(Ekos::AlignState mode)
Q_SCRIPTABLE CaptureState status()
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18n(const char *text, const TYPE &arg...)
char * data()
void resize(qsizetype newSize, char c)
ParseResult setContent(QAnyStringView text, ParseOptions options)
QString toString(int indent) const const
QString absoluteFilePath() const const
bool exists(const QString &path)
void setFile(const QDir &dir, const QString &path)
void append(QList< T > &&value)
void clear()
T & first()
qsizetype size() const const
QVariant property(const char *name) const const
T qobject_cast(QObject *object)
void setHeight(int height)
void setWidth(int width)
void setX(int x)
void setY(int y)
QSize size() const const
QByteArray toLatin1() const const
QString toLower() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:35:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.