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()->refreshGraph();
831}
832
834{
835 warnScript << "DEPRECATED Document.horizontalGuides() - use Document.guidesConfig().horizontalGuides() instead";
836 QList<qreal> lines;
837 if (!d->document || !d->document->image()) return lines;
838 KisCoordinatesConverter converter;
839 converter.setImage(d->document->image());
840 QTransform transform = converter.imageToDocumentTransform().inverted();
841 QList<qreal> untransformedLines = d->document->guidesConfig().horizontalGuideLines();
842 for (int i = 0; i< untransformedLines.size(); i++) {
843 qreal line = untransformedLines[i];
844 lines.append(transform.map(QPointF(line, line)).x());
845 }
846 return lines;
847}
848
850{
851 warnScript << "DEPRECATED Document.verticalGuides() - use Document.guidesConfig().verticalGuides() instead";
852 QList<qreal> lines;
853 if (!d->document || !d->document->image()) return lines;
854 KisCoordinatesConverter converter;
855 converter.setImage(d->document->image());
856 QTransform transform = converter.imageToDocumentTransform().inverted();
857 QList<qreal> untransformedLines = d->document->guidesConfig().verticalGuideLines();
858 for (int i = 0; i< untransformedLines.size(); i++) {
859 qreal line = untransformedLines[i];
860 lines.append(transform.map(QPointF(line, line)).y());
861 }
862 return lines;
863}
864
866{
867 warnScript << "DEPRECATED Document.guidesVisible() - use Document.guidesConfig().visible() instead";
868 return d->document->guidesConfig().showGuides();
869}
870
872{
873 warnScript << "DEPRECATED Document.guidesLocked() - use Document.guidesConfig().locked() instead";
874 return d->document->guidesConfig().lockGuides();
875}
876
878{
879 if (!d->document) return 0;
880 QPointer<KisDocument> clone = d->document->clone();
881
882 /// We set ownsDocument to true, it will be reset
883 /// automatically as soon as we create the first
884 /// view for the document
885 Document * newDocument = new Document(clone, true);
886 return newDocument;
887}
888
890{
891 warnScript << "DEPRECATED Document.setHorizontalGuides() - use Document.guidesConfig().setHorizontalGuides() instead";
892 if (!d->document) return;
893 KisGuidesConfig config = d->document->guidesConfig();
894 KisCoordinatesConverter converter;
895 converter.setImage(d->document->image());
896 QTransform transform = converter.imageToDocumentTransform();
897 QList<qreal> transformedLines;
898 for (int i = 0; i< lines.size(); i++) {
899 qreal line = lines[i];
900 transformedLines.append(transform.map(QPointF(line, line)).x());
901 }
902 config.setHorizontalGuideLines(transformedLines);
903 d->document->setGuidesConfig(config);
904}
905
907{
908 warnScript << "DEPRECATED Document.setVerticalGuides() - use Document.guidesConfig().setVerticalGuides() instead";
909 if (!d->document) return;
910 KisGuidesConfig config = d->document->guidesConfig();
911 KisCoordinatesConverter converter;
912 converter.setImage(d->document->image());
913 QTransform transform = converter.imageToDocumentTransform();
914 QList<qreal> transformedLines;
915 for (int i = 0; i< lines.size(); i++) {
916 qreal line = lines[i];
917 transformedLines.append(transform.map(QPointF(line, line)).y());
918 }
919 config.setVerticalGuideLines(transformedLines);
920 d->document->setGuidesConfig(config);
921}
922
924{
925 warnScript << "DEPRECATED Document.setGuidesVisible() - use Document.guidesConfig().setVisible() instead";
926 if (!d->document) return;
927 KisGuidesConfig config = d->document->guidesConfig();
928 config.setShowGuides(visible);
929 d->document->setGuidesConfig(config);
930}
931
933{
934 warnScript << "DEPRECATED Document.setGuidesLocked() - use Document.guidesConfig().setLocked() instead";
935 if (!d->document) return;
936 KisGuidesConfig config = d->document->guidesConfig();
937 config.setLockGuides(locked);
938 d->document->setGuidesConfig(config);
939}
940
942{
943 if (!d->document) return false;
944 return d->document->isModified();
945}
946
947void Document::setModified(bool modified)
948{
949 if (!d->document) return;
950 d->document->setModified(modified);
951}
952
954{
955 if (!d->document) return QRect();
956 return d->document->image()->bounds();
957}
958
959QPointer<KisDocument> Document::document() const
960{
961 return d->document;
962}
963
964void Document::setOwnsDocument(bool ownsDocument)
965{
966 d->ownsDocument = ownsDocument;
967}
968
969/* Animation related function */
970
971bool Document::importAnimation(const QList<QString> &files, int firstFrame, int step)
972{
973 KisView *activeView = KisPart::instance()->currentMainwindow()->activeView();
974
975 KoUpdaterPtr updater = 0;
976 if (activeView && d->document->fileBatchMode()) {
977 updater = activeView->viewManager()->createUnthreadedUpdater(i18n("Import frames"));
978 }
979
980 KisAnimationImporter importer(d->document->image(), updater);
981 KisImportExportErrorCode status = importer.import(files, firstFrame, step);
982
983 return status.isOk();
984}
985
987{
988 if (!d->document) return false;
989 if (!d->document->image()) return false;
990
991 return d->document->image()->animationInterface()->framerate();
992}
993
995{
996 if (!d->document) return;
997 if (!d->document->image()) return;
998
999 d->document->image()->animationInterface()->setFramerate(fps);
1000}
1001
1003{
1004 if (!d->document) return;
1005 if (!d->document->image()) return;
1006
1007 d->document->image()->animationInterface()->setDocumentRangeStartFrame(startTime);
1008}
1009
1010
1012{
1013 if (!d->document) return false;
1014 if (!d->document->image()) return false;
1015
1016 return d->document->image()->animationInterface()->documentPlaybackRange().start();
1017}
1018
1019
1021{
1022 if (!d->document) return;
1023 if (!d->document->image()) return;
1024
1025 d->document->image()->animationInterface()->setDocumentRangeEndFrame(endTime);
1026}
1027
1028
1030{
1031 if (!d->document) return false;
1032 if (!d->document->image()) return false;
1033
1034 return d->document->image()->animationInterface()->documentPlaybackRange().end();
1035}
1036
1038{
1039 if (!d->document) return false;
1040 if (!d->document->image()) return false;
1041
1042 return d->document->image()->animationInterface()->totalLength();
1043}
1044
1046{
1047 if (!d->document) return;
1048 if (!d->document->image()) return;
1049
1050 const KisTimeSpan newTimeRange = KisTimeSpan::fromTimeWithDuration(start, (stop-start));
1051 d->document->image()->animationInterface()->setActivePlaybackRange(newTimeRange);
1052}
1053
1055{
1056 if (!d->document) return false;
1057 if (!d->document->image()) return false;
1058
1059 return d->document->image()->animationInterface()->activePlaybackRange().start();
1060}
1061
1063{
1064 if (!d->document) return false;
1065 if (!d->document->image()) return false;
1066
1067 return d->document->image()->animationInterface()->activePlaybackRange().end();
1068}
1069
1071{
1072 if (!d->document) return false;
1073 if (!d->document->image()) return false;
1074
1075 return d->document->image()->animationInterface()->currentTime();
1076}
1077
1079{
1080 if (!d->document) return;
1081 if (!d->document->image()) return;
1082
1083 return d->document->image()->animationInterface()->requestTimeSwitchWithUndo(time);
1084}
1085
1087{
1088 if (!d->document) return QStringList();
1089
1090 QStringList types;
1091
1092 KisImageSP image = d->document->image().toStrongRef();
1093
1094 if (!image) return QStringList();
1095
1096 vKisAnnotationSP_it beginIt = image->beginAnnotations();
1097 vKisAnnotationSP_it endIt = image->endAnnotations();
1098
1099 vKisAnnotationSP_it it = beginIt;
1100 while (it != endIt) {
1101 if (!(*it) || (*it)->type().isEmpty()) {
1102 qWarning() << "Warning: empty annotation";
1103 it++;
1104 continue;
1105 }
1106 types << (*it)->type();
1107
1108 it++;
1109 }
1110 return types;
1111}
1112
1114{
1115 KisImageSP image = d->document->image().toStrongRef();
1116 KisAnnotationSP annotation = image->annotation(type);
1117 return annotation->description();
1118}
1119
1121{
1122 KisImageSP image = d->document->image().toStrongRef();
1123 KisAnnotationSP annotation = image->annotation(type);
1124 if (annotation) {
1125 return annotation->annotation();
1126 }
1127 else {
1128 return QByteArray();
1129 }
1130}
1131
1132void Document::setAnnotation(const QString &key, const QString &description, const QByteArray &annotation)
1133{
1134 KisAnnotation *a = new KisAnnotation(key, description, annotation);
1135 KisImageSP image = d->document->image().toStrongRef();
1136 image->addAnnotation(a);
1137
1138}
1139
1141{
1142 KisImageSP image = d->document->image().toStrongRef();
1143 image->removeAnnotation(type);
1144}
1145
1146void Document::setAutosave(bool active)
1147{
1148 d->document->setAutoSaveActive(active);
1149}
1150
1152{
1153 return d->document->isAutoSaveActive();
1154}
1155
1157{
1158 // The way Krita manage guides position is a little bit strange
1159 //
1160 // Let's say, set a guide at a position of 100pixels from UI
1161 // In KisGuidesConfig, the saved position (using KoUnit 'px') is set taking in account the
1162 // document resolution
1163 // So:
1164 // 100px at 300dpi ==> the stored value will be 72 * 100 / 300.00 = 24.00
1165 // 100px at 600dpi ==> the stored value will be 72 * 100 / 600.00 = 12.00
1166 // We have a position saved in 'pt', with unit 'px'
1167 // This is also what is saved in maindoc.xml...
1168 //
1169 // The weird thing in this process:
1170 // - use unit 'px' as what is reallt stored is 'pt'
1171 // - use 'pt' to store an information that should be 'px' (because 100pixels is 100pixels whatever the
1172 // resolution of document)
1173 //
1174 // But OK, it works like this and reviewing this is probably a huge workload, and also there'll be
1175 // a problem with old saved documents (taht's store 100px@300dpi as '24.00')
1176 //
1177 // The solution here is, before restitue the guideConfig to user, the internal value is transformed...
1178 KisGuidesConfig *tmpConfig = new KisGuidesConfig(d->document->guidesConfig());
1179
1180 if (d->document && d->document->image()) {
1181 KisCoordinatesConverter converter;
1182 converter.setImage(d->document->image());
1183
1184 QTransform transform = converter.imageToDocumentTransform().inverted();
1185
1186 QList<qreal> transformedLines;
1187 QList<qreal> untransformedLines = tmpConfig->horizontalGuideLines();
1188 for (int i = 0; i< untransformedLines.size(); i++) {
1189 qreal untransformedLine = untransformedLines[i];
1190 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).x());
1191 }
1192 tmpConfig->setHorizontalGuideLines(transformedLines);
1193
1194 transformedLines.clear();
1195 untransformedLines = tmpConfig->verticalGuideLines();
1196 for (int i = 0; i< untransformedLines.size(); i++) {
1197 qreal untransformedLine = untransformedLines[i];
1198 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).y());
1199 }
1200 tmpConfig->setVerticalGuideLines(transformedLines);
1201 }
1202 else {
1203 // unable to proceed to transform, return no guides
1204 tmpConfig->removeAllGuides();
1205 }
1206
1207 GuidesConfig *guideConfig = new GuidesConfig(tmpConfig);
1208 return guideConfig;
1209}
1210
1212{
1213 if (!d->document) return;
1214 // Like for guidesConfig() method, need to manage transform from internal stored value
1215 // to pixels values
1216 KisGuidesConfig tmpConfig = guidesConfig->guidesConfig();
1217
1218 if (d->document->image()) {
1219 KisCoordinatesConverter converter;
1220 converter.setImage(d->document->image());
1221
1222 QTransform transform = converter.imageToDocumentTransform();
1223
1224 QList<qreal> transformedLines;
1225 QList<qreal> untransformedLines = tmpConfig.horizontalGuideLines();
1226 for (int i = 0; i< untransformedLines.size(); i++) {
1227 qreal untransformedLine = untransformedLines[i];
1228 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).x());
1229 }
1230 tmpConfig.setHorizontalGuideLines(transformedLines);
1231
1232 transformedLines.clear();
1233 untransformedLines = tmpConfig.verticalGuideLines();
1234 for (int i = 0; i< untransformedLines.size(); i++) {
1235 qreal untransformedLine = untransformedLines[i];
1236 transformedLines.append(transform.map(QPointF(untransformedLine, untransformedLine)).x());
1237 }
1238 tmpConfig.setVerticalGuideLines(transformedLines);
1239 }
1240 else {
1241 // unable to proceed to transform, set no guides
1242 tmpConfig.removeAllGuides();
1243 }
1244
1245 d->document->setGuidesConfig(tmpConfig);
1246}
1247
1248
1250{
1251 KisGridConfig *tmpConfig = new KisGridConfig(d->document->gridConfig());
1252 GridConfig *gridConfig = new GridConfig(tmpConfig);
1253 return gridConfig;
1254}
1255
1257{
1258 if (!d->document) return;
1259 KisGridConfig tmpConfig = gridConfig->gridConfig();
1260 d->document->setGridConfig(tmpConfig);
1261}
1262
1264{
1265 return d->document->getAudioLevel();
1266}
1267
1268void Document::setAudioLevel(const qreal level)
1269{
1270 d->document->setAudioVolume(level);
1271}
1272
1274{
1275 QList<QString> fileList;
1276 Q_FOREACH(QFileInfo fileInfo, d->document->getAudioTracks()) {
1277 fileList.append(fileInfo.absoluteFilePath());
1278 }
1279 return fileList;
1280}
1281
1283{
1284 bool returned = true;
1285 QVector<QFileInfo> fileList;
1286 QFileInfo fileInfo;
1287 Q_FOREACH(QString fileName, files) {
1288 fileInfo.setFile(fileName);
1289 if (fileInfo.exists()) {
1290 // ensure the file exists before adding it
1291 fileList.append(fileName);
1292 }
1293 else {
1294 // if at least one file is not valid, return false
1295 returned = false;
1296 }
1297 }
1298 d->document->setAudioTracks(fileList);
1299 return returned;
1300}
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:38
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:865
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:932
void setGuidesConfig(GuidesConfig *guidesConfig)
void setFramesPerSecond(int fps)
set frames per second of document
Definition Document.cpp:994
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:941
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:971
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:889
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:877
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:923
void setModified(bool modified)
setModified sets the modified status of the document
Definition Document.cpp:947
Q_DECL_DEPRECATED QList< qreal > verticalGuides() const
DEPRECATED - use guidesConfig() instead The vertical guide lines.
Definition Document.cpp:849
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:871
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:833
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:906
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:986
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:953
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
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:22
QList< Node * > childNodes() const
childNodes
Definition Node.cpp:205
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 Q_NOREPLY void start()
Q_SCRIPTABLE CaptureState status()
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 Fri Jul 12 2024 12:05:12 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.