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

KDE's Doxygen guidelines are available online.