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 doc.setContent(document);
271 d->document->documentInfo()->load(doc);
272}
273
274
275QString Document::fileName() const
276{
277 if (!d->document) return QString();
278 return d->document->path();
279}
280
282{
283 if (!d->document) return;
284 QString mimeType = KisMimeDatabase::mimeTypeForFile(value, false);
285 d->document->setMimeType(mimeType.toLatin1());
286 d->document->setPath(value);
287}
288
290{
291 if (!d->document) return 0;
292 KisImageSP image = d->document->image();
293 if (!image) return 0;
294 return image->height();
295}
296
298{
299 if (!d->document) return;
300 if (!d->document->image()) return;
301 resizeImage(d->document->image()->bounds().x(),
302 d->document->image()->bounds().y(),
303 d->document->image()->width(),
304 value);
305}
306
307
308QString Document::name() const
309{
310 if (!d->document) return "";
311 return d->document->documentInfo()->aboutInfo("title");
312}
313
315{
316 if (!d->document) return;
317 d->document->documentInfo()->setAboutInfo("title", value);
318}
319
320
322{
323 if (!d->document) return 0;
324 KisImageSP image = d->document->image();
325 if (!image) return 0;
326
327 return qRound(d->document->image()->xRes() * 72);
328}
329
331{
332 if (!d->document) return;
333 KisImageSP image = d->document->image();
334 if (!image) return;
335
338
339 image->scaleImage(image->size(), value / 72.0, value / 72.0, strategy);
340 image->waitForDone();
341}
342
343
345{
346 if (!d->document) return 0;
347 KisImageSP image = d->document->image();
348 if (!image) return 0;
349
350 return Node::createNode(image, image->root());
351}
352
354{
355 if (!d->document) return 0;
356 if (!d->document->image()) return 0;
357 if (!d->document->image()->globalSelection()) return 0;
358 return new Selection(d->document->image()->globalSelection());
359}
360
362{
363 if (!d->document) return;
364 if (!d->document->image()) return;
365 if (value) {
366 d->document->image()->undoAdapter()->addCommand(new KisSetGlobalSelectionCommand(d->document->image(), value->selection()));
367 }
368 else {
369 d->document->image()->undoAdapter()->addCommand(new KisSetGlobalSelectionCommand(d->document->image(), nullptr));
370 }
371}
372
373
375{
376 if (!d->document) return 0;
377 KisImageSP image = d->document->image();
378 if (!image) return 0;
379 return image->width();
380}
381
383{
384 if (!d->document) return;
385 if (!d->document->image()) return;
386 resizeImage(d->document->image()->bounds().x(),
387 d->document->image()->bounds().y(),
388 value,
389 d->document->image()->height());
390}
391
392
394{
395 if (!d->document) return 0;
396 KisImageSP image = d->document->image();
397 if (!image) return 0;
398 return image->bounds().x();
399}
400
402{
403 if (!d->document) return;
404 if (!d->document->image()) return;
405 resizeImage(x,
406 d->document->image()->bounds().y(),
407 d->document->image()->width(),
408 d->document->image()->height());
409}
410
411
413{
414 if (!d->document) return 0;
415 KisImageSP image = d->document->image();
416 if (!image) return 0;
417 return image->bounds().y();
418}
419
421{
422 if (!d->document) return;
423 if (!d->document->image()) return;
424 resizeImage(d->document->image()->bounds().x(),
425 y,
426 d->document->image()->width(),
427 d->document->image()->height());
428}
429
430
431double Document::xRes() const
432{
433 if (!d->document) return 0.0;
434 if (!d->document->image()) return 0.0;
435 return d->document->image()->xRes()*72.0;
436}
437
438void Document::setXRes(double xRes) const
439{
440 if (!d->document) return;
441 KisImageSP image = d->document->image();
442 if (!image) return;
443
446
447 image->scaleImage(image->size(), xRes / 72.0, image->yRes(), strategy);
448 image->waitForDone();
449}
450
451double Document::yRes() const
452{
453 if (!d->document) return 0.0;
454 if (!d->document->image()) return 0.0;
455 return d->document->image()->yRes()*72.0;
456}
457
458void Document::setYRes(double yRes) const
459{
460 if (!d->document) return;
461 KisImageSP image = d->document->image();
462 if (!image) return;
463
466
467 image->scaleImage(image->size(), image->xRes(), yRes / 72.0, strategy);
468 image->waitForDone();
469}
470
471
472QByteArray Document::pixelData(int x, int y, int w, int h) const
473{
474 QByteArray ba;
475
476 if (!d->document) return ba;
477 KisImageSP image = d->document->image();
478 if (!image) return ba;
479
480 KisPaintDeviceSP dev = image->projection();
481 ba.resize(w * h * dev->pixelSize());
482 dev->readBytes(reinterpret_cast<quint8*>(ba.data()), x, y, w, h);
483 return ba;
484}
485
487{
488 bool retval = d->document->closePath(false);
489
490 Q_FOREACH(KisView *view, KisPart::instance()->views()) {
491 if (view->document() == d->document) {
492 view->close();
493 view->closeView();
494 view->deleteLater();
495 }
496 }
497
499
500 if (d->ownsDocument) {
501
502 delete d->document;
503 }
504
505 d->document = 0;
506 return retval;
507}
508
509void Document::crop(int x, int y, int w, int h)
510{
511 if (!d->document) return;
512 KisImageSP image = d->document->image();
513 if (!image) return;
514 QRect rc(x, y, w, h);
515 image->cropImage(rc);
516 image->waitForDone();
517}
518
519bool Document::exportImage(const QString &filename, const InfoObject &exportConfiguration)
520{
521 if (!d->document) return false;
522
523 const QString outputFormatString = KisMimeDatabase::mimeTypeForFile(filename, false);
524 const QByteArray outputFormat = outputFormatString.toLatin1();
525
526 return d->document->exportDocumentSync(filename, outputFormat, exportConfiguration.configuration());
527}
528
530{
531 if (!d->document) return;
532 if (!d->document->image()) return;
533 d->document->image()->flatten(0);
534 d->document->image()->waitForDone();
535}
536
537void Document::resizeImage(int x, int y, int w, int h)
538{
539 if (!d->document) return;
540 KisImageSP image = d->document->image();
541 if (!image) return;
542 QRect rc;
543 rc.setX(x);
544 rc.setY(y);
545 rc.setWidth(w);
546 rc.setHeight(h);
547
548 image->resizeImage(rc);
549 image->waitForDone();
550}
551
552void Document::scaleImage(int w, int h, int xres, int yres, QString strategy)
553{
554 if (!d->document) return;
555 KisImageSP image = d->document->image();
556 if (!image) return;
557 QRect rc = image->bounds();
558 rc.setWidth(w);
559 rc.setHeight(h);
560
561 KisFilterStrategy *actualStrategy = KisFilterStrategyRegistry::instance()->get(strategy);
562 if (!actualStrategy) actualStrategy = KisFilterStrategyRegistry::instance()->get("Bicubic");
563
564 image->scaleImage(rc.size(), xres / 72.0, yres / 72.0, actualStrategy);
565 image->waitForDone();
566}
567
568void Document::rotateImage(double radians)
569{
570 if (!d->document) return;
571 KisImageSP image = d->document->image();
572 if (!image) return;
573 image->rotateImage(radians);
574 image->waitForDone();
575}
576
577void Document::shearImage(double angleX, double angleY)
578{
579 if (!d->document) return;
580 KisImageSP image = d->document->image();
581 if (!image) return;
582 image->shear(angleX, angleY);
583 image->waitForDone();
584}
585
587{
588 if (!d->document) return false;
589 if (d->document->path().isEmpty()) return false;
590
591 bool retval = d->document->save(true, 0);
592 d->document->waitForSavingToComplete();
593
594 return retval;
595}
596
597bool Document::saveAs(const QString &filename)
598{
599 if (!d->document) return false;
600
601 setFileName(filename);
602 const QString outputFormatString = KisMimeDatabase::mimeTypeForFile(filename, false);
603 const QByteArray outputFormat = outputFormatString.toLatin1();
604 QString oldPath = d->document->path();
605 d->document->setPath(filename);
606 bool retval = d->document->saveAs(filename, outputFormat, true);
607 d->document->waitForSavingToComplete();
608 d->document->setPath(oldPath);
609
610 return retval;
611}
612
613Node* Document::createNode(const QString &name, const QString &nodeType)
614{
615 if (!d->document) return 0;
616 if (!d->document->image()) return 0;
617 KisImageSP image = d->document->image();
618
619 Node *node = 0;
620
621 if (nodeType.toLower()== "paintlayer") {
622 node = new Node(image, new KisPaintLayer(image, name, OPACITY_OPAQUE_U8));
623 }
624 else if (nodeType.toLower() == "grouplayer") {
625 node = new Node(image, new KisGroupLayer(image, name, OPACITY_OPAQUE_U8));
626 }
627 else if (nodeType.toLower() == "filelayer") {
628 node = new Node(image, new KisFileLayer(image, name, OPACITY_OPAQUE_U8));
629 }
630 else if (nodeType.toLower() == "filterlayer") {
631 node = new Node(image, new KisAdjustmentLayer(image, name, 0, 0));
632 }
633 else if (nodeType.toLower() == "filllayer") {
634 node = new Node(image, new KisGeneratorLayer(image, name, 0, 0));
635 }
636 else if (nodeType.toLower() == "clonelayer") {
637 node = new Node(image, new KisCloneLayer(0, image, name, OPACITY_OPAQUE_U8));
638 }
639 else if (nodeType.toLower() == "vectorlayer") {
640 node = new Node(image, new KisShapeLayer(d->document->shapeController(), image, name, OPACITY_OPAQUE_U8));
641 }
642 else if (nodeType.toLower() == "transparencymask") {
643 node = new Node(image, new KisTransparencyMask(image, name));
644 }
645 else if (nodeType.toLower() == "filtermask") {
646 node = new Node(image, new KisFilterMask(image, name));
647 }
648 else if (nodeType.toLower() == "transformmask") {
649 node = new Node(image, new KisTransformMask(image, name));
650 }
651 else if (nodeType.toLower() == "selectionmask") {
652 node = new Node(image, new KisSelectionMask(image, name));
653 }
654 else if (nodeType.toLower() == "colorizemask") {
655 node = new Node(image, new KisColorizeMask(image, name));
656 }
657
658 return node;
659}
660
662{
663 if (!d->document) return 0;
664 if (!d->document->image()) return 0;
665 KisImageSP image = d->document->image();
666
667 return new GroupLayer(image, name);
668}
669
670FileLayer *Document::createFileLayer(const QString &name, const QString fileName, const QString scalingMethod, const QString scalingFilter)
671{
672 if (!d->document) return 0;
673 if (!d->document->image()) return 0;
674 KisImageSP image = d->document->image();
675
676 return new FileLayer(image, name, this->fileName(), fileName, scalingMethod, scalingFilter);
677}
678
679FilterLayer *Document::createFilterLayer(const QString &name, Filter &filter, Selection &selection)
680{
681 if (!d->document) return 0;
682 if (!d->document->image()) return 0;
683 KisImageSP image = d->document->image();
684
685 return new FilterLayer(image, name, filter, selection);
686}
687
688FillLayer *Document::createFillLayer(const QString &name, const QString generatorName, InfoObject &configuration, Selection &selection)
689{
690 if (!d->document) return 0;
691 if (!d->document->image()) return 0;
692 KisImageSP image = d->document->image();
693
694 KisGeneratorSP generator = KisGeneratorRegistry::instance()->value(generatorName);
695 if (generator) {
696
698 Q_FOREACH(const QString property, configuration.properties().keys()) {
699 config->setProperty(property, configuration.property(property));
700 }
701
702 return new FillLayer(image, name, config, selection);
703 }
704 return 0;
705}
706
708{
709 if (!d->document) return 0;
710 if (!d->document->image()) return 0;
711 KisImageSP image = d->document->image();
712 KisLayerSP layer = qobject_cast<KisLayer*>(source->node().data());
713
714 return new CloneLayer(image, name, layer);
715}
716
718{
719 if (!d->document) return 0;
720 if (!d->document->image()) return 0;
721 KisImageSP image = d->document->image();
722
723 return new VectorLayer(d->document->shapeController(), image, name);
724}
725
726FilterMask *Document::createFilterMask(const QString &name, Filter &filter, const Node *selection_source)
727{
728 if (!d->document)
729 return 0;
730
731 if (!d->document->image())
732 return 0;
733
734 if(!selection_source)
735 return 0;
736
737 KisLayerSP layer = qobject_cast<KisLayer*>(selection_source->node().data());
738 if(layer.isNull())
739 return 0;
740
741 KisImageSP image = d->document->image();
742 FilterMask* mask = new FilterMask(image, name, filter);
743 qobject_cast<KisMask*>(mask->node().data())->initSelection(layer);
744
745 return mask;
746}
747
748FilterMask *Document::createFilterMask(const QString &name, Filter &filter, Selection &selection)
749{
750 if (!d->document)
751 return 0;
752
753 if (!d->document->image())
754 return 0;
755
756 KisImageSP image = d->document->image();
757 FilterMask* mask = new FilterMask(image, name, filter);
758 qobject_cast<KisMask*>(mask->node().data())->setSelection(selection.selection());
759
760 return mask;
761}
762
764{
765 if (!d->document) return 0;
766 if (!d->document->image()) return 0;
767 KisImageSP image = d->document->image();
768
769 return new SelectionMask(image, name);
770}
771
773{
774 if (!d->document) return 0;
775 if (!d->document->image()) return 0;
776 KisImageSP image = d->document->image();
777
778 return new TransparencyMask(image, name);
779}
780
782{
783 if (!d->document) return 0;
784 if (!d->document->image()) return 0;
785 KisImageSP image = d->document->image();
786
787 return new TransformMask(image, name);
788}
789
791{
792 if (!d->document) return 0;
793 if (!d->document->image()) return 0;
794 KisImageSP image = d->document->image();
795
796 return new ColorizeMask(image, name);
797}
798
799QImage Document::projection(int x, int y, int w, int h) const
800{
801 if (!d->document || !d->document->image()) return QImage();
802 return d->document->image()->convertToQImage(x, y, w, h, 0);
803}
804
805QImage Document::thumbnail(int w, int h) const
806{
807 if (!d->document || !d->document->image()) return QImage();
808 return d->document->generatePreview(QSize(w, h)).toImage();
809}
810
811
813{
814 if (!d->document || !d->document->image()) return;
815 d->document->image()->barrierLock();
816}
817
819{
820 if (!d->document || !d->document->image()) return;
821 d->document->image()->unlock();
822}
823
825{
826 if (!d->document || !d->document->image()) return;
828 d->document->image()->waitForDone();
829}
830
832{
833 if (!d->document || !d->document->image()) return false;
834 return d->document->image()->tryBarrierLock();
835}
836
838{
839 if (!d->document || !d->document->image()) return;
840 d->document->image()->refreshGraphAsync();
841 d->document->image()->waitForDone();
842
843}
844
846{
847 warnScript << "DEPRECATED Document.horizontalGuides() - use Document.guidesConfig().horizontalGuides() instead";
848 QList<qreal> lines;
849 if (!d->document || !d->document->image()) return lines;
850 const QTransform documentToImage =
851 QTransform::fromScale(d->document->image()->xRes(), d->document->image()->yRes());
852
853 QList<qreal> untransformedLines = d->document->guidesConfig().horizontalGuideLines();
854 for (int i = 0; i< untransformedLines.size(); i++) {
855 qreal line = untransformedLines[i];
856 lines.append(documentToImage.map(QPointF(line, line)).x());
857 }
858 return lines;
859}
860
862{
863 warnScript << "DEPRECATED Document.verticalGuides() - use Document.guidesConfig().verticalGuides() instead";
864 QList<qreal> lines;
865 if (!d->document || !d->document->image()) return lines;
866 const QTransform documentToImage =
867 QTransform::fromScale(d->document->image()->xRes(), d->document->image()->yRes());
868 QList<qreal> untransformedLines = d->document->guidesConfig().verticalGuideLines();
869 for (int i = 0; i< untransformedLines.size(); i++) {
870 qreal line = untransformedLines[i];
871 lines.append(documentToImage.map(QPointF(line, line)).y());
872 }
873 return lines;
874}
875
877{
878 warnScript << "DEPRECATED Document.guidesVisible() - use Document.guidesConfig().visible() instead";
879 return d->document->guidesConfig().showGuides();
880}
881
883{
884 warnScript << "DEPRECATED Document.guidesLocked() - use Document.guidesConfig().locked() instead";
885 return d->document->guidesConfig().lockGuides();
886}
887
889{
890 if (!d->document) return 0;
892
896 Document * newDocument = new Document(clone, true);
897 return newDocument;
898}
899
901{
902 warnScript << "DEPRECATED Document.setHorizontalGuides() - use Document.guidesConfig().setHorizontalGuides() instead";
903 if (!d->document) return;
904 KisGuidesConfig config = d->document->guidesConfig();
905 const QTransform imageToDocument =
906 QTransform::fromScale(1.0 / d->document->image()->xRes(), 1.0 / d->document->image()->yRes());
907 QList<qreal> transformedLines;
908 for (int i = 0; i< lines.size(); i++) {
909 qreal line = lines[i];
910 transformedLines.append(imageToDocument.map(QPointF(line, line)).x());
911 }
912 config.setHorizontalGuideLines(transformedLines);
913 d->document->setGuidesConfig(config);
914}
915
917{
918 warnScript << "DEPRECATED Document.setVerticalGuides() - use Document.guidesConfig().setVerticalGuides() instead";
919 if (!d->document) return;
920 KisGuidesConfig config = d->document->guidesConfig();
921 const QTransform imageToDocument =
922 QTransform::fromScale(1.0 / d->document->image()->xRes(), 1.0 / d->document->image()->yRes());
923 QList<qreal> transformedLines;
924 for (int i = 0; i< lines.size(); i++) {
925 qreal line = lines[i];
926 transformedLines.append(imageToDocument.map(QPointF(line, line)).y());
927 }
928 config.setVerticalGuideLines(transformedLines);
929 d->document->setGuidesConfig(config);
930}
931
933{
934 warnScript << "DEPRECATED Document.setGuidesVisible() - use Document.guidesConfig().setVisible() instead";
935 if (!d->document) return;
936 KisGuidesConfig config = d->document->guidesConfig();
937 config.setShowGuides(visible);
938 d->document->setGuidesConfig(config);
939}
940
942{
943 warnScript << "DEPRECATED Document.setGuidesLocked() - use Document.guidesConfig().setLocked() instead";
944 if (!d->document) return;
945 KisGuidesConfig config = d->document->guidesConfig();
946 config.setLockGuides(locked);
947 d->document->setGuidesConfig(config);
948}
949
951{
952 if (!d->document) return false;
953 return d->document->isModified();
954}
955
956void Document::setModified(bool modified)
957{
958 if (!d->document) return;
959 d->document->setModified(modified);
960}
961
962QRect Document::bounds() const
963{
964 if (!d->document) return QRect();
965 return d->document->image()->bounds();
966}
967
969{
970 return d->document;
971}
972
973void Document::setOwnsDocument(bool ownsDocument)
974{
975 d->ownsDocument = ownsDocument;
976}
977
978/* Animation related function */
979
980bool Document::importAnimation(const QList<QString> &files, int firstFrame, int step)
981{
983
984 KoUpdaterPtr updater = 0;
985 if (activeView && d->document->fileBatchMode()) {
986 updater = activeView->viewManager()->createUnthreadedUpdater(i18n("Import frames"));
987 }
988
989 KisAnimationImporter importer(d->document->image(), updater);
990 KisImportExportErrorCode status = importer.import(files, firstFrame, step);
991
992 return status.isOk();
993}
994
996{
997 if (!d->document) return false;
998 if (!d->document->image()) return false;
999
1000 return d->document->image()->animationInterface()->framerate();
1001}
1002
1004{
1005 if (!d->document) return;
1006 if (!d->document->image()) return;
1007
1008 d->document->image()->animationInterface()->setFramerate(fps);
1009}
1010
1012{
1013 if (!d->document) return;
1014 if (!d->document->image()) return;
1015
1016 d->document->image()->animationInterface()->setDocumentRangeStartFrame(startTime);
1017}
1018
1019
1021{
1022 if (!d->document) return false;
1023 if (!d->document->image()) return false;
1024
1025 return d->document->image()->animationInterface()->documentPlaybackRange().start();
1026}
1027
1028
1030{
1031 if (!d->document) return;
1032 if (!d->document->image()) return;
1033
1034 d->document->image()->animationInterface()->setDocumentRangeEndFrame(endTime);
1035}
1036
1037
1039{
1040 if (!d->document) return false;
1041 if (!d->document->image()) return false;
1042
1043 return d->document->image()->animationInterface()->documentPlaybackRange().end();
1044}
1045
1047{
1048 if (!d->document) return false;
1049 if (!d->document->image()) return false;
1050
1051 return d->document->image()->animationInterface()->totalLength();
1052}
1053
1054void Document::setPlayBackRange(int start, int stop)
1055{
1056 if (!d->document) return;
1057 if (!d->document->image()) return;
1058
1059 const KisTimeSpan newTimeRange = KisTimeSpan::fromTimeWithDuration(start, (stop-start));
1060 d->document->image()->animationInterface()->setActivePlaybackRange(newTimeRange);
1061}
1062
1064{
1065 if (!d->document) return false;
1066 if (!d->document->image()) return false;
1067
1068 return d->document->image()->animationInterface()->activePlaybackRange().start();
1069}
1070
1072{
1073 if (!d->document) return false;
1074 if (!d->document->image()) return false;
1075
1076 return d->document->image()->animationInterface()->activePlaybackRange().end();
1077}
1078
1080{
1081 if (!d->document) return false;
1082 if (!d->document->image()) return false;
1083
1084 return d->document->image()->animationInterface()->currentTime();
1085}
1086
1088{
1089 if (!d->document) return;
1090 if (!d->document->image()) return;
1091
1092 return d->document->image()->animationInterface()->requestTimeSwitchWithUndo(time);
1093}
1094
1096{
1097 if (!d->document) return QStringList();
1098
1099 QStringList types;
1100
1101 KisImageSP image = d->document->image().toStrongRef();
1102
1103 if (!image) return QStringList();
1104
1105 vKisAnnotationSP_it beginIt = image->beginAnnotations();
1106 vKisAnnotationSP_it endIt = image->endAnnotations();
1107
1108 vKisAnnotationSP_it it = beginIt;
1109 while (it != endIt) {
1110 if (!(*it) || (*it)->type().isEmpty()) {
1111 qWarning() << "Warning: empty annotation";
1112 it++;
1113 continue;
1114 }
1115 types << (*it)->type();
1116
1117 it++;
1118 }
1119 return types;
1120}
1121
1122QString Document::annotationDescription(const QString &type) const
1123{
1124 KisImageSP image = d->document->image().toStrongRef();
1125 KisAnnotationSP annotation = image->annotation(type);
1126 return annotation->description();
1127}
1128
1129QByteArray Document::annotation(const QString &type)
1130{
1131 KisImageSP image = d->document->image().toStrongRef();
1132 KisAnnotationSP annotation = image->annotation(type);
1133 if (annotation) {
1134 return annotation->annotation();
1135 }
1136 else {
1137 return QByteArray();
1138 }
1139}
1140
1141void Document::setAnnotation(const QString &key, const QString &description, const QByteArray &annotation)
1142{
1143 KisAnnotation *a = new KisAnnotation(key, description, annotation);
1144 KisImageSP image = d->document->image().toStrongRef();
1145 image->addAnnotation(a);
1146
1147}
1148
1149void Document::removeAnnotation(const QString &type)
1150{
1151 KisImageSP image = d->document->image().toStrongRef();
1152 image->removeAnnotation(type);
1153}
1154
1155void Document::setAutosave(bool active)
1156{
1157 d->document->setAutoSaveActive(active);
1158}
1159
1161{
1162 return d->document->isAutoSaveActive();
1163}
1164
1166{
1167 // The way Krita manage guides position is a little bit strange
1168 //
1169 // Let's say, set a guide at a position of 100pixels from UI
1170 // In KisGuidesConfig, the saved position (using KoUnit 'px') is set taking in account the
1171 // document resolution
1172 // So:
1173 // 100px at 300dpi ==> the stored value will be 72 * 100 / 300.00 = 24.00
1174 // 100px at 600dpi ==> the stored value will be 72 * 100 / 600.00 = 12.00
1175 // We have a position saved in 'pt', with unit 'px'
1176 // This is also what is saved in maindoc.xml...
1177 //
1178 // The weird thing in this process:
1179 // - use unit 'px' as what is reallt stored is 'pt'
1180 // - use 'pt' to store an information that should be 'px' (because 100pixels is 100pixels whatever the
1181 // resolution of document)
1182 //
1183 // But OK, it works like this and reviewing this is probably a huge workload, and also there'll be
1184 // a problem with old saved documents (taht's store 100px@300dpi as '24.00')
1185 //
1186 // The solution here is, before restitue the guideConfig to user, the internal value is transformed...
1187 KisGuidesConfig *tmpConfig = new KisGuidesConfig(d->document->guidesConfig());
1188
1189 if (d->document && d->document->image()) {
1190 const QTransform documentToImage =
1191 QTransform::fromScale(d->document->image()->xRes(), d->document->image()->yRes());
1192 QList<qreal> transformedLines;
1193 QList<qreal> untransformedLines = tmpConfig->horizontalGuideLines();
1194 for (int i = 0; i< untransformedLines.size(); i++) {
1195 qreal untransformedLine = untransformedLines[i];
1196 transformedLines.append(documentToImage.map(QPointF(untransformedLine, untransformedLine)).x());
1197 }
1198 tmpConfig->setHorizontalGuideLines(transformedLines);
1199
1200 transformedLines.clear();
1201 untransformedLines = tmpConfig->verticalGuideLines();
1202 for (int i = 0; i< untransformedLines.size(); i++) {
1203 qreal untransformedLine = untransformedLines[i];
1204 transformedLines.append(documentToImage.map(QPointF(untransformedLine, untransformedLine)).y());
1205 }
1206 tmpConfig->setVerticalGuideLines(transformedLines);
1207 }
1208 else {
1209 // unable to proceed to transform, return no guides
1210 tmpConfig->removeAllGuides();
1211 }
1212
1213 GuidesConfig *guideConfig = new GuidesConfig(tmpConfig);
1214 return guideConfig;
1215}
1216
1218{
1219 if (!d->document) return;
1220 // Like for guidesConfig() method, need to manage transform from internal stored value
1221 // to pixels values
1223
1224 if (d->document->image()) {
1225 const QTransform imageToDocument =
1226 QTransform::fromScale(1.0 / d->document->image()->xRes(), 1.0 / d->document->image()->yRes());
1227 QList<qreal> transformedLines;
1228 QList<qreal> untransformedLines = tmpConfig.horizontalGuideLines();
1229 for (int i = 0; i< untransformedLines.size(); i++) {
1230 qreal untransformedLine = untransformedLines[i];
1231 transformedLines.append(imageToDocument.map(QPointF(untransformedLine, untransformedLine)).x());
1232 }
1233 tmpConfig.setHorizontalGuideLines(transformedLines);
1234
1235 transformedLines.clear();
1236 untransformedLines = tmpConfig.verticalGuideLines();
1237 for (int i = 0; i< untransformedLines.size(); i++) {
1238 qreal untransformedLine = untransformedLines[i];
1239 transformedLines.append(imageToDocument.map(QPointF(untransformedLine, untransformedLine)).x());
1240 }
1241 tmpConfig.setVerticalGuideLines(transformedLines);
1242 }
1243 else {
1244 // unable to proceed to transform, set no guides
1245 tmpConfig.removeAllGuides();
1246 }
1247
1248 d->document->setGuidesConfig(tmpConfig);
1249}
1250
1251
1253{
1254 KisGridConfig *tmpConfig = new KisGridConfig(d->document->gridConfig());
1255 GridConfig *gridConfig = new GridConfig(tmpConfig);
1256 return gridConfig;
1257}
1258
1260{
1261 if (!d->document) return;
1262 KisGridConfig tmpConfig = gridConfig->gridConfig();
1263 d->document->setGridConfig(tmpConfig);
1264}
1265
1267{
1268 return d->document->getAudioLevel();
1269}
1270
1271void Document::setAudioLevel(const qreal level)
1272{
1273 d->document->setAudioVolume(level);
1274}
1275
1277{
1278 QList<QString> fileList;
1279 Q_FOREACH(QFileInfo fileInfo, d->document->getAudioTracks()) {
1280 fileList.append(fileInfo.absoluteFilePath());
1281 }
1282 return fileList;
1283}
1284
1286{
1287 bool returned = true;
1288 QVector<QFileInfo> fileList;
1289 QFileInfo fileInfo;
1290 Q_FOREACH(QString fileName, files) {
1291 fileInfo.setFile(fileName);
1292 if (fileInfo.exists()) {
1293 // ensure the file exists before adding it
1294 fileList.append(fileInfo);
1295 }
1296 else {
1297 // if at least one file is not valid, return false
1298 returned = false;
1299 }
1300 }
1301 d->document->setAudioTracks(fileList);
1302 return returned;
1303}
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:799
Q_DECL_DEPRECATED bool guidesVisible() const
DEPRECATED - use guidesConfig() instead Returns guide visibility.
Definition Document.cpp:876
int resolution() const
Definition Document.cpp:321
TransformMask * createTransformMask(const QString &name)
createTransformMask Creates a transform mask, which can be used to apply a transformation non-destruc...
Definition Document.cpp:781
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:941
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:968
void setSelection(Selection *value)
setSelection set or replace the global selection
Definition Document.cpp:361
void setFullClipRangeStartTime(int startTime)
set start time of animation
int height() const
Definition Document.cpp:289
SelectionMask * createSelectionMask(const QString &name)
createSelectionMask Creates a selection mask, which can be used to store selections.
Definition Document.cpp:763
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:486
bool modified() const
modified returns true if the document has unsaved modifications.
Definition Document.cpp:950
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:805
ColorizeMask * createColorizeMask(const QString &name)
createColorizeMask Creates a colorize mask, which can be used to color fill via keystrokes.
Definition Document.cpp:790
void flatten()
flatten all layers in the image
Definition Document.cpp:529
void setXOffset(int x)
setXOffset sets the left edge of the canvas to x.
Definition Document.cpp:401
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:980
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:420
void setGridConfig(GridConfig *gridConfig)
QString name() const
Definition Document.cpp:308
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:900
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:537
Node * rootNode() const
rootNode the root node is the invisible group layer that contains the entire node hierarchy.
Definition Document.cpp:344
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:597
QString fileName() const
Definition Document.cpp:275
void unlock()
Definition Document.cpp:818
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:568
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:688
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:552
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:451
bool operator==(const Document &other) const
Definition Document.cpp:96
Document * clone() const
clone create a shallow clone of this document.
Definition Document.cpp:888
void setName(QString value)
setName sets the name of the document to value. This is the title field in the documentInfo
Definition Document.cpp:314
void setXRes(double xRes) const
setXRes set the horizontal resolution of the image to xRes in pixels per inch
Definition Document.cpp:438
CloneLayer * createCloneLayer(const QString &name, const Node *source)
createCloneLayer
Definition Document.cpp:707
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:412
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:824
Q_DECL_DEPRECATED void setGuidesVisible(bool visible)
DEPRECATED - use guidesConfig() instead set guides visible on this document.
Definition Document.cpp:932
void setModified(bool modified)
setModified sets the modified status of the document
Definition Document.cpp:956
Q_DECL_DEPRECATED QList< qreal > verticalGuides() const
DEPRECATED - use guidesConfig() instead The vertical guide lines.
Definition Document.cpp:861
void refreshProjection()
Definition Document.cpp:837
Q_DECL_DEPRECATED bool guidesLocked() const
DEPRECATED - use guidesConfig() instead Returns guide lockedness.
Definition Document.cpp:882
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:717
Node * createNode(const QString &name, const QString &nodeType)
Definition Document.cpp:613
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:845
void setWidth(int value)
setWidth resize the document to
Definition Document.cpp:382
GridConfig * gridConfig()
Returns a GridConfig grid configuration for current document.
int width() const
Definition Document.cpp:374
~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:916
bool tryBarrierLock()
Tries to lock the image without waiting for the jobs to finish.
Definition Document.cpp:831
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:586
void setYRes(double yRes) const
setYRes set the vertical resolution of the image to yRes in pixels per inch
Definition Document.cpp:458
bool autosave()
Return autosave status for document Notes:
void setFileName(QString value)
setFileName set the full path of the document to
Definition Document.cpp:281
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:670
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:772
bool exportImage(const QString &filename, const InfoObject &exportConfiguration)
exportImage export the image, without changing its URL to the given path.
Definition Document.cpp:519
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:995
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:509
int xOffset() const
Definition Document.cpp:393
Selection * selection() const
selection Create a Selection object around the global selection, if there is one.
Definition Document.cpp:353
void setResolution(int value)
setResolution set the resolution of the image; this does not scale the image
Definition Document.cpp:330
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:472
QRect bounds() const
bounds return the bounds of the image
Definition Document.cpp:962
void lock()
Definition Document.cpp:812
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:577
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:679
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:748
double xRes() const
Definition Document.cpp:431
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:661
void setHeight(int value)
setHeight resize the document to
Definition Document.cpp:297
void setOwnsDocument(bool ownsDocument)
Definition Document.cpp:973
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
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:459
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:1433
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:825
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()