Krita Source Code Documentation
Loading...
Searching...
No Matches
Document.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6#include "Document.h"
7#include <QPointer>
8#include <QUrl>
9#include <QDomDocument>
10
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>
20#include <KisViewManager.h>
21#include <kis_file_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>
29#include <kis_selection_mask.h>
31#include <kis_effect_mask.h>
32#include <kis_paint_layer.h>
33#include <kis_generator_layer.h>
35#include <kis_shape_layer.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>
44#include <kis_time_span.h>
46#include <kis_types.h>
47#include <kis_annotation.h>
48
49#include <KoColor.h>
50#include <KoColorSpace.h>
51#include <KoColorProfile.h>
54#include <KoDocumentInfo.h>
56
57#include <InfoObject.h>
58#include <Node.h>
59#include <Selection.h>
60#include <LibKisUtils.h>
61
63#include <kis_canvas2.h>
64#include <KoUpdater.h>
65#include <QMessageBox>
66
68#include <kis_layer_utils.h>
69#include <kis_undo_adapter.h>
71
72
78
79Document::Document(KisDocument *document, bool ownsDocument, QObject *parent)
80 : QObject(parent)
81 , d(new Private)
82{
84 d->ownsDocument = ownsDocument;
85}
86
88{
89 if (d->ownsDocument && 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
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;
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
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
171Node *Document::nodeByName(const QString &name) const
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
181Node *Document::nodeByUniqueID(const QUuid &id) const
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
192QString Document::colorDepth() const
193{
194 if (!d->document) return "";
195 return d->document->image()->colorSpace()->colorDepthId().id();
196}
197
198QString Document::colorModel() const
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;
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;
226 if (!colorSpace) return false;
227
228 d->document->image()->convertImageColorSpace(colorSpace,
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
245bool Document::setBackgroundColor(const QColor &color)
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
267void Document::setDocumentInfo(const QString &document)
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
277QString Document::fileName() const
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
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
310QString Document::name() const
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
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
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
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
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
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
681FilterLayer *Document::createFilterLayer(const QString &name, Filter &filter, Selection &selection)
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
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
750FilterMask *Document::createFilterMask(const QString &name, Filter &filter, Selection &selection)
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;
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 const QTransform documentToImage =
853 QTransform::fromScale(d->document->image()->xRes(), d->document->image()->yRes());
854
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(documentToImage.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 const QTransform documentToImage =
869 QTransform::fromScale(d->document->image()->xRes(), d->document->image()->yRes());
870 QList<qreal> untransformedLines = d->document->guidesConfig().verticalGuideLines();
871 for (int i = 0; i< untransformedLines.size(); i++) {
872 qreal line = untransformedLines[i];
873 lines.append(documentToImage.map(QPointF(line, line)).y());
874 }
875 return lines;
876}
877
879{
880 warnScript << "DEPRECATED Document.guidesVisible() - use Document.guidesConfig().visible() instead";
881 return d->document->guidesConfig().showGuides();
882}
883
885{
886 warnScript << "DEPRECATED Document.guidesLocked() - use Document.guidesConfig().locked() instead";
887 return d->document->guidesConfig().lockGuides();
888}
889
891{
892 if (!d->document) return 0;
894
898 Document * newDocument = new Document(clone, true);
899 return newDocument;
900}
901
903{
904 warnScript << "DEPRECATED Document.setHorizontalGuides() - use Document.guidesConfig().setHorizontalGuides() instead";
905 if (!d->document) return;
906 KisGuidesConfig config = d->document->guidesConfig();
907 const QTransform imageToDocument =
908 QTransform::fromScale(1.0 / d->document->image()->xRes(), 1.0 / d->document->image()->yRes());
909 QList<qreal> transformedLines;
910 for (int i = 0; i< lines.size(); i++) {
911 qreal line = lines[i];
912 transformedLines.append(imageToDocument.map(QPointF(line, line)).x());
913 }
914 config.setHorizontalGuideLines(transformedLines);
915 d->document->setGuidesConfig(config);
916}
917
919{
920 warnScript << "DEPRECATED Document.setVerticalGuides() - use Document.guidesConfig().setVerticalGuides() instead";
921 if (!d->document) return;
922 KisGuidesConfig config = d->document->guidesConfig();
923 const QTransform imageToDocument =
924 QTransform::fromScale(1.0 / d->document->image()->xRes(), 1.0 / d->document->image()->yRes());
925 QList<qreal> transformedLines;
926 for (int i = 0; i< lines.size(); i++) {
927 qreal line = lines[i];
928 transformedLines.append(imageToDocument.map(QPointF(line, line)).y());
929 }
930 config.setVerticalGuideLines(transformedLines);
931 d->document->setGuidesConfig(config);
932}
933
935{
936 warnScript << "DEPRECATED Document.setGuidesVisible() - use Document.guidesConfig().setVisible() instead";
937 if (!d->document) return;
938 KisGuidesConfig config = d->document->guidesConfig();
939 config.setShowGuides(visible);
940 d->document->setGuidesConfig(config);
941}
942
944{
945 warnScript << "DEPRECATED Document.setGuidesLocked() - use Document.guidesConfig().setLocked() instead";
946 if (!d->document) return;
947 KisGuidesConfig config = d->document->guidesConfig();
948 config.setLockGuides(locked);
949 d->document->setGuidesConfig(config);
950}
951
953{
954 if (!d->document) return false;
955 return d->document->isModified();
956}
957
958void Document::setModified(bool modified)
959{
960 if (!d->document) return;
961 d->document->setModified(modified);
962}
963
964QRect Document::bounds() const
965{
966 if (!d->document) return QRect();
967 return d->document->image()->bounds();
968}
969
971{
972 return d->document;
973}
974
975void Document::setOwnsDocument(bool ownsDocument)
976{
977 d->ownsDocument = ownsDocument;
978}
979
980/* Animation related function */
981
982bool Document::importAnimation(const QList<QString> &files, int firstFrame, int step)
983{
985
986 KoUpdaterPtr updater = 0;
987 if (activeView && d->document->fileBatchMode()) {
988 updater = activeView->viewManager()->createUnthreadedUpdater(i18n("Import frames"));
989 }
990
991 KisAnimationImporter importer(d->document->image(), updater);
992 KisImportExportErrorCode status = importer.import(files, firstFrame, step);
993
994 return status.isOk();
995}
996
998{
999 if (!d->document) return false;
1000 if (!d->document->image()) return false;
1001
1002 return d->document->image()->animationInterface()->framerate();
1003}
1004
1006{
1007 if (!d->document) return;
1008 if (!d->document->image()) return;
1009
1010 d->document->image()->animationInterface()->setFramerate(fps);
1011}
1012
1014{
1015 if (!d->document) return;
1016 if (!d->document->image()) return;
1017
1018 d->document->image()->animationInterface()->setDocumentRangeStartFrame(startTime);
1019}
1020
1021
1023{
1024 if (!d->document) return false;
1025 if (!d->document->image()) return false;
1026
1027 return d->document->image()->animationInterface()->documentPlaybackRange().start();
1028}
1029
1030
1032{
1033 if (!d->document) return;
1034 if (!d->document->image()) return;
1035
1036 d->document->image()->animationInterface()->setDocumentRangeEndFrame(endTime);
1037}
1038
1039
1041{
1042 if (!d->document) return false;
1043 if (!d->document->image()) return false;
1044
1045 return d->document->image()->animationInterface()->documentPlaybackRange().end();
1046}
1047
1049{
1050 if (!d->document) return false;
1051 if (!d->document->image()) return false;
1052
1053 return d->document->image()->animationInterface()->totalLength();
1054}
1055
1056void Document::setPlayBackRange(int start, int stop)
1057{
1058 if (!d->document) return;
1059 if (!d->document->image()) return;
1060
1061 const KisTimeSpan newTimeRange = KisTimeSpan::fromTimeWithDuration(start, (stop-start));
1062 d->document->image()->animationInterface()->setActivePlaybackRange(newTimeRange);
1063}
1064
1066{
1067 if (!d->document) return false;
1068 if (!d->document->image()) return false;
1069
1070 return d->document->image()->animationInterface()->activePlaybackRange().start();
1071}
1072
1074{
1075 if (!d->document) return false;
1076 if (!d->document->image()) return false;
1077
1078 return d->document->image()->animationInterface()->activePlaybackRange().end();
1079}
1080
1082{
1083 if (!d->document) return false;
1084 if (!d->document->image()) return false;
1085
1086 return d->document->image()->animationInterface()->currentTime();
1087}
1088
1090{
1091 if (!d->document) return;
1092 if (!d->document->image()) return;
1093
1094 return d->document->image()->animationInterface()->requestTimeSwitchWithUndo(time);
1095}
1096
1098{
1099 if (!d->document) return QStringList();
1100
1101 QStringList types;
1102
1103 KisImageSP image = d->document->image().toStrongRef();
1104
1105 if (!image) return QStringList();
1106
1107 vKisAnnotationSP_it beginIt = image->beginAnnotations();
1108 vKisAnnotationSP_it endIt = image->endAnnotations();
1109
1110 vKisAnnotationSP_it it = beginIt;
1111 while (it != endIt) {
1112 if (!(*it) || (*it)->type().isEmpty()) {
1113 qWarning() << "Warning: empty annotation";
1114 it++;
1115 continue;
1116 }
1117 types << (*it)->type();
1118
1119 it++;
1120 }
1121 return types;
1122}
1123
1124QString Document::annotationDescription(const QString &type) const
1125{
1126 KisImageSP image = d->document->image().toStrongRef();
1127 KisAnnotationSP annotation = image->annotation(type);
1128 return annotation->description();
1129}
1130
1131QByteArray Document::annotation(const QString &type)
1132{
1133 KisImageSP image = d->document->image().toStrongRef();
1134 KisAnnotationSP annotation = image->annotation(type);
1135 if (annotation) {
1136 return annotation->annotation();
1137 }
1138 else {
1139 return QByteArray();
1140 }
1141}
1142
1143void Document::setAnnotation(const QString &key, const QString &description, const QByteArray &annotation)
1144{
1145 KisAnnotation *a = new KisAnnotation(key, description, annotation);
1146 KisImageSP image = d->document->image().toStrongRef();
1147 image->addAnnotation(a);
1148
1149}
1150
1151void Document::removeAnnotation(const QString &type)
1152{
1153 KisImageSP image = d->document->image().toStrongRef();
1154 image->removeAnnotation(type);
1155}
1156
1157void Document::setAutosave(bool active)
1158{
1159 d->document->setAutoSaveActive(active);
1160}
1161
1163{
1164 return d->document->isAutoSaveActive();
1165}
1166
1168{
1169 // The way Krita manage guides position is a little bit strange
1170 //
1171 // Let's say, set a guide at a position of 100pixels from UI
1172 // In KisGuidesConfig, the saved position (using KoUnit 'px') is set taking in account the
1173 // document resolution
1174 // So:
1175 // 100px at 300dpi ==> the stored value will be 72 * 100 / 300.00 = 24.00
1176 // 100px at 600dpi ==> the stored value will be 72 * 100 / 600.00 = 12.00
1177 // We have a position saved in 'pt', with unit 'px'
1178 // This is also what is saved in maindoc.xml...
1179 //
1180 // The weird thing in this process:
1181 // - use unit 'px' as what is reallt stored is 'pt'
1182 // - use 'pt' to store an information that should be 'px' (because 100pixels is 100pixels whatever the
1183 // resolution of document)
1184 //
1185 // But OK, it works like this and reviewing this is probably a huge workload, and also there'll be
1186 // a problem with old saved documents (taht's store 100px@300dpi as '24.00')
1187 //
1188 // The solution here is, before restitue the guideConfig to user, the internal value is transformed...
1189 KisGuidesConfig *tmpConfig = new KisGuidesConfig(d->document->guidesConfig());
1190
1191 if (d->document && d->document->image()) {
1192 const QTransform documentToImage =
1193 QTransform::fromScale(d->document->image()->xRes(), d->document->image()->yRes());
1194 QList<qreal> transformedLines;
1195 QList<qreal> untransformedLines = tmpConfig->horizontalGuideLines();
1196 for (int i = 0; i< untransformedLines.size(); i++) {
1197 qreal untransformedLine = untransformedLines[i];
1198 transformedLines.append(documentToImage.map(QPointF(untransformedLine, untransformedLine)).x());
1199 }
1200 tmpConfig->setHorizontalGuideLines(transformedLines);
1201
1202 transformedLines.clear();
1203 untransformedLines = tmpConfig->verticalGuideLines();
1204 for (int i = 0; i< untransformedLines.size(); i++) {
1205 qreal untransformedLine = untransformedLines[i];
1206 transformedLines.append(documentToImage.map(QPointF(untransformedLine, untransformedLine)).y());
1207 }
1208 tmpConfig->setVerticalGuideLines(transformedLines);
1209 }
1210 else {
1211 // unable to proceed to transform, return no guides
1212 tmpConfig->removeAllGuides();
1213 }
1214
1215 GuidesConfig *guideConfig = new GuidesConfig(tmpConfig);
1216 return guideConfig;
1217}
1218
1220{
1221 if (!d->document) return;
1222 // Like for guidesConfig() method, need to manage transform from internal stored value
1223 // to pixels values
1225
1226 if (d->document->image()) {
1227 const QTransform imageToDocument =
1228 QTransform::fromScale(1.0 / d->document->image()->xRes(), 1.0 / d->document->image()->yRes());
1229 QList<qreal> transformedLines;
1230 QList<qreal> untransformedLines = tmpConfig.horizontalGuideLines();
1231 for (int i = 0; i< untransformedLines.size(); i++) {
1232 qreal untransformedLine = untransformedLines[i];
1233 transformedLines.append(imageToDocument.map(QPointF(untransformedLine, untransformedLine)).x());
1234 }
1235 tmpConfig.setHorizontalGuideLines(transformedLines);
1236
1237 transformedLines.clear();
1238 untransformedLines = tmpConfig.verticalGuideLines();
1239 for (int i = 0; i< untransformedLines.size(); i++) {
1240 qreal untransformedLine = untransformedLines[i];
1241 transformedLines.append(imageToDocument.map(QPointF(untransformedLine, untransformedLine)).x());
1242 }
1243 tmpConfig.setVerticalGuideLines(transformedLines);
1244 }
1245 else {
1246 // unable to proceed to transform, set no guides
1247 tmpConfig.removeAllGuides();
1248 }
1249
1250 d->document->setGuidesConfig(tmpConfig);
1251}
1252
1253
1255{
1256 KisGridConfig *tmpConfig = new KisGridConfig(d->document->gridConfig());
1257 GridConfig *gridConfig = new GridConfig(tmpConfig);
1258 return gridConfig;
1259}
1260
1262{
1263 if (!d->document) return;
1264 KisGridConfig tmpConfig = gridConfig->gridConfig();
1265 d->document->setGridConfig(tmpConfig);
1266}
1267
1269{
1270 return d->document->getAudioLevel();
1271}
1272
1273void Document::setAudioLevel(const qreal level)
1274{
1275 d->document->setAudioVolume(level);
1276}
1277
1279{
1280 QList<QString> fileList;
1281 Q_FOREACH(QFileInfo fileInfo, d->document->getAudioTracks()) {
1282 fileList.append(fileInfo.absoluteFilePath());
1283 }
1284 return fileList;
1285}
1286
1288{
1289 bool returned = true;
1290 QVector<QFileInfo> fileList;
1291 QFileInfo fileInfo;
1292 Q_FOREACH(QString fileName, files) {
1293 fileInfo.setFile(fileName);
1294 if (fileInfo.exists()) {
1295 // ensure the file exists before adding it
1296 fileList.append(fileInfo);
1297 }
1298 else {
1299 // if at least one file is not valid, return false
1300 returned = false;
1301 }
1302 }
1303 d->document->setAudioTracks(fileList);
1304 return returned;
1305}
float value(const T *src, size_t ch)
KisMagneticGraph::vertex_descriptor source(typename KisMagneticGraph::edge_descriptor e, KisMagneticGraph g)
QList< QString > QStringList
const quint8 OPACITY_OPAQUE_U8
char nodeType(const KoPathPoint *point)
The CloneLayer class A clone layer is a layer that takes a reference inside the image and shows the e...
Definition CloneLayer.h:26
The ColorizeMask class A colorize mask is a mask type node that can be used to color in line art.
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:878
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:943
void setGuidesConfig(GuidesConfig *guidesConfig)
void setFramesPerSecond(int fps)
set frames per second of document
void setFullClipRangeEndTime(int endTime)
set full clip range end time
QPointer< KisDocument > document() const
Definition Document.cpp:970
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:952
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. This will grab all images from the directory and ...
Definition Document.cpp:982
int fullClipRangeStartTime()
get the full clip range start time
bool setBackgroundColor(const QColor &color)
setBackgroundColor sets the background color of the document. It will trigger a projection update.
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:902
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 operator!=(const Document &other) const
Definition Document.cpp:101
bool saveAs(const QString &filename)
saveAs save the document under the filename. The document's filename will be reset to filename.
Definition Document.cpp:599
QString fileName() const
Definition Document.cpp:277
void unlock()
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. Each annotation type is uniq...
Document(KisDocument *document, bool ownsDocument, QObject *parent=0)
Definition Document.cpp:79
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. The profile has to be regist...
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
bool operator==(const Document &other) const
Definition Document.cpp:96
Document * clone() const
clone create a shallow clone of this document.
Definition Document.cpp:890
void setName(QString value)
setName sets the name of the document to value. This is the title field in the documentInfo
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. The conversion is done with Pe...
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
Definition Document.cpp:106
void waitForDone()
Definition Document.cpp:826
Q_DECL_DEPRECATED void setGuidesVisible(bool visible)
DEPRECATED - use guidesConfig() instead set guides visible on this document.
Definition Document.cpp:934
void setModified(bool modified)
setModified sets the modified status of the document
Definition Document.cpp:958
Q_DECL_DEPRECATED QList< qreal > verticalGuides() const
DEPRECATED - use guidesConfig() instead The vertical guide lines.
Definition Document.cpp:863
void refreshProjection()
Definition Document.cpp:839
Q_DECL_DEPRECATED bool guidesLocked() const
DEPRECATED - use guidesConfig() instead Returns guide lockedness.
Definition Document.cpp:884
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
friend class VectorLayer
Definition Document.h:1058
Private *const d
Definition Document.h:1065
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
~Document() override
Definition Document.cpp:87
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:918
bool tryBarrierLock()
Tries to lock the image without waiting for the jobs to finish.
Definition Document.cpp:833
QString colorDepth() const
Definition Document.cpp:192
bool save()
save the image to its currently set path. The modified flag of the document will be reset
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)
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
Definition Document.cpp:997
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. The color will also include the...
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:964
void lock()
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. It's a simple QByteArray,...
void setCurrentTime(int time)
set current time of document's animation
GroupLayer * createGroupLayer(const QString &name)
createGroupLayer Returns a grouplayer object. Grouplayers are nodes that can have other layers as chi...
Definition Document.cpp:663
void setHeight(int value)
setHeight resize the document to
Definition Document.cpp:299
void setOwnsDocument(bool ownsDocument)
Definition Document.cpp:975
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
KisGridConfig gridConfig() const
The GroupLayer class A group layer is a layer that can contain other layers. In Krita,...
Definition GroupLayer.h:30
KisGuidesConfig guidesConfig() const
QVariant property(const QString &key)
QMap< QString, QVariant > properties() const
KisPropertiesConfigurationSP configuration() const
configuration gives access to the internal configuration object. Must be used internally in libkis
KisImportExportErrorCode import(QStringList files, int firstFrame, int step, bool autoAddHoldframes=false, bool startfrom0=false, int isAscending=0, bool assignDocumentProfile=false, QList< int > optionalKeyframeTimeList={})
A data extension mechanism for Krita.
QDomDocument createDomDocument(const QString &tagName, const QString &version) const
The KisFileLayer class loads a particular file as a layer into the layer stack.
static KisFilterStrategyRegistry * instance()
static KisGeneratorRegistry * instance()
static KisResourcesInterfaceSP instance()
void setHorizontalGuideLines(const QList< qreal > &lines)
Set the positions of the horizontal guide lines.
void setShowGuides(bool value)
const QList< qreal > & verticalGuideLines() const
Returns the list of vertical guide lines.
void setLockGuides(bool value)
void setVerticalGuideLines(const QList< qreal > &lines)
Set the positions of the vertical guide lines.
const QList< qreal > & horizontalGuideLines() const
Returns the list of horizontal guide lines.
void resizeImage(const QRect &newRect)
start asynchronous operation on resizing the image
Definition kis_image.cc:865
vKisAnnotationSP_it endAnnotations()
void addAnnotation(KisAnnotationSP annotation)
void waitForDone()
void shear(double angleX, double angleY)
start asynchronous operation on shearing the image
KisAnnotationSP annotation(const QString &type)
void rotateImage(double radians)
start asynchronous operation on rotating the image
KisPaintDeviceSP projection() const
qint32 width() const
QSize size() const
Definition kis_image.h:547
void scaleImage(const QSize &size, qreal xres, qreal yres, KisFilterStrategy *filterStrategy)
start asynchronous operation on scaling the image
Definition kis_image.cc:961
void cropImage(const QRect &newRect)
start asynchronous operation on cropping the image
Definition kis_image.cc:870
double xRes() const
double yRes() const
qint32 height() const
void removeAnnotation(const QString &type)
QRect bounds() const override
vKisAnnotationSP_it beginAnnotations()
Main window for Krita.
QPointer< KisView > activeView
KisViewManager * viewManager
static QString mimeTypeForFile(const QString &file, bool checkExistingFiles=true)
Find the mimetype for the given filename. The filename must include a suffix.
KisNodeSelectionAdapter * nodeSelectionAdapter() const
quint32 pixelSize() const
void readBytes(quint8 *data, qint32 x, qint32 y, qint32 w, qint32 h) const
static KisPart * instance()
Definition KisPart.cpp:131
KisMainWindow * currentMainwindow() const
Definition KisPart.cpp:483
void removeDocument(KisDocument *document, bool deleteDocument=true)
Definition KisPart.cpp:248
bool isNull() const
static KisTimeSpan fromTimeWithDuration(int start, int duration)
KisDocument * document() const
QPointer< KoUpdater > createUnthreadedUpdater(const QString &name)
create a new progress updater
KisNodeManager * nodeManager() const
The node manager handles everything about nodes.
void closeView()
Definition KisView.cpp:1441
KisViewManager * viewManager
Definition KisView.cpp:129
QPointer< KisDocument > document
Definition KisView.cpp:121
void toQColor(QColor *c) const
a convenience method for the above.
Definition KoColor.cpp:198
const T value(const QString &id) const
T get(const QString &id) const
Definition Node.h:24
QList< Node * > childNodes() const
childNodes
Definition Node.cpp:212
KisNodeSP node() const
Definition Node.cpp:827
static Node * createNode(KisImageSP image, KisNodeSP node, QObject *parent=0)
Definition Node.cpp:91
The SelectionMask class A selection mask is a mask type node that can be used to store selections....
KisSelectionSP selection() const
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
This file is part of the Krita application in calligra.
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define warnScript
Definition kis_debug.h:98
vKisAnnotationSP::iterator vKisAnnotationSP_it
Definition kis_types.h:181
KisNodeSP findNodeByName(KisNodeSP root, const QString &name)
KisNodeSP findNodeByUuid(KisNodeSP root, const QUuid &uuid)
void forceAllDelayedNodesUpdate(KisNodeSP root)
QList< Node * > createNodeList(KisNodeList kisnodes, KisImageWSP image)
QPointer< KisDocument > document
Definition Document.cpp:75
virtual KisFilterConfigurationSP factoryConfiguration(KisResourcesInterfaceSP resourcesInterface) const
const KoColorProfile * profileByName(const QString &name) const
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()