Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_kra_load_visitor.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
3 * SPDX-FileCopyrightText: 2005 C. Boemann <cbo@boemann.dk>
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 */
7
9#include "kis_kra_tags.h"
12#include "KisReferenceImage.h"
14
15#include <QBuffer>
16#include <QByteArray>
17#include <QMessageBox>
18#include <QApplication>
19
20#include <KoMD5Generator.h>
22#include <KoColorProfile.h>
23#include <KoFileDialog.h>
24#include <KoStore.h>
25#include <KoColorSpace.h>
28
29// kritaimage
31#include "kis_dom_utils.h"
32#include "kis_filter_registry.h"
36#include "kis_shape_selection.h"
41#include <kis_clone_layer.h>
42#include <kis_datamanager.h>
43#include <kis_filter_mask.h>
44#include <kis_group_layer.h>
45#include <kis_image.h>
46#include <kis_layer.h>
48#include <kis_meta_data_store.h>
49#include <kis_node_visitor.h>
50#include <kis_paint_layer.h>
51#include <kis_pixel_selection.h>
52#include <kis_selection.h>
53#include <kis_selection_mask.h>
54#include <kis_transform_mask.h>
57#include <kis_types.h>
60
61using namespace KRA;
62
63QString expandEncodedDirectory(const QString& _intern)
64{
65
66 QString intern = _intern;
67
68 QString result;
69 int pos;
70 while ((pos = intern.indexOf('/')) != -1) {
71 if (QChar(intern.at(0)).isDigit())
72 result += "part";
73 result += intern.left(pos + 1); // copy numbers (or "pictures") + "/"
74 intern = intern.mid(pos + 1); // remove the dir we just processed
75 }
76
77 if (!intern.isEmpty() && QChar(intern.at(0)).isDigit())
78 result += "part";
79 result += intern;
80
81 return result;
82}
83
84
86 KoStore *store,
87 KoShapeControllerBase *shapeController,
88 QMap<KisNode *, QString> &layerFilenames,
89 QMap<KisNode *, QString> &keyframeFilenames,
90 const QString & name,
91 int syntaxVersion)
93 , m_image(image)
94 , m_store(store)
95 , m_external(false)
96 , m_layerFilenames(layerFilenames)
97 , m_keyframeFilenames(keyframeFilenames)
98 , m_name(name)
99 , m_shapeController(shapeController)
100{
102
104 QStringList directories = m_store->directoryList();
105 dbgKrita << directories;
106 if (directories.size() > 0) {
107 dbgFile << "Could not locate the directory, maybe some encoding issue? Grab the first directory, that'll be the image one." << m_name << directories;
108 m_name = directories.first();
109 }
110 else {
111 dbgFile << "Could not enter directory" << m_name << ", probably an old-style file with 'part' added.";
113 }
114 }
115 else {
117 }
118 m_syntaxVersion = syntaxVersion;
119}
120
121void KisKraLoadVisitor::setExternalUri(const QString &uri)
122{
123 m_external = true;
124 m_uri = uri;
125}
126
128{
129 bool result = false;
130
131 if (auto *referencesLayer = dynamic_cast<KisReferenceImagesLayer*>(layer)) {
132 Q_FOREACH(KoShape *shape, referencesLayer->shapes()) {
133 auto *reference = dynamic_cast<KisReferenceImage*>(shape);
134 KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(reference, false);
135
136 while (!reference->loadImage(m_store)) {
137 if (reference->embed()) {
138 m_errorMessages << i18n("Could not load embedded reference image %1 ", reference->internalFile());
139 break;
140 } else {
141 QString msg = i18nc(
142 "@info",
143 "A reference image linked to an external file could not be loaded.\n\n"
144 "Path: %1\n\n"
145 "Do you want to select another location?", reference->filename());
146
147 // qApp->activeWindow() doesn't work here
148 int locateManually = QMessageBox::warning(qApp->activeWindow(), i18nc("@title:window", "File not found"), msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
149
150 QString url;
151 if (locateManually == QMessageBox::Yes) {
152 KoFileDialog dialog(0, KoFileDialog::OpenFile, "OpenDocument");
154 url = dialog.filename();
155 }
156
157 if (url.isEmpty()) {
158 break;
159 } else {
160 reference->setFilename(url);
161 reference->setEmbed(false);
162 }
163 }
164 }
165 }
166 } else if (KisShapeLayer *shapeLayer = dynamic_cast<KisShapeLayer*>(layer)) {
167 loadNodeKeyframes(shapeLayer);
168
169 if (!loadMetaData(layer)) {
170 return false;
171 }
172
173 QStringList vectorWarnings;
174
177 result = shapeLayer->loadLayer(m_store, &vectorWarnings);
179
180 m_warningMessages << vectorWarnings;
181 }
182
183 result = visitAll(layer) && result;
184 return result;
185}
186
188{
189 loadNodeKeyframes(layer);
190
191 if (!loadPaintDevice(layer->paintDevice(), getLocation(layer))) {
192 return false;
193 }
194 if (!loadProfile(layer->paintDevice(), getLocation(layer, DOT_ICC))) {
195 return false;
196 }
197 if (!loadMetaData(layer)) {
198 return false;
199 }
200
201 if (m_syntaxVersion == 1) {
202 // Check whether there is a file with a .mask extension in the
203 // layer directory, if so, it's an old-style transparency mask
204 // that should be converted.
205 QString location = getLocation(layer, ".mask");
206
207 if (m_store->open(location)) {
208
209 KisSelectionSP selection = KisSelectionSP(new KisSelection());
210 KisPixelSelectionSP pixelSelection = selection->pixelSelection();
211 if (!pixelSelection->read(m_store->device())) {
212 pixelSelection->disconnect();
213 } else {
214 KisTransparencyMask* mask = new KisTransparencyMask(m_image, i18n("Transparency Mask"));
215 mask->setSelection(selection);
216 m_image->addNode(mask, layer, layer->firstChild());
217 }
218 m_store->close();
219 }
220 }
221 bool result = visitAll(layer);
222 return result;
223}
224
226{
227 loadNodeKeyframes(layer);
228
229 if (!loadMetaData(layer)) {
230 return false;
231 }
232
233 bool result = visitAll(layer);
234 return result;
235}
236
238{
239 loadNodeKeyframes(layer);
240
241 // Adjustmentlayers are tricky: there's the 1.x style and the 2.x
242 // style, which has selections with selection components
243 bool result = true;
244 if (m_syntaxVersion == 1) {
245 KisSelectionSP selection = new KisSelection();
246 KisPixelSelectionSP pixelSelection = selection->pixelSelection();
247 result = loadPaintDevice(pixelSelection, getLocation(layer, ".selection"));
248 layer->setInternalSelection(selection);
249 } else if (m_syntaxVersion == 2) {
250 result = loadSelection(getLocation(layer), layer->internalSelection());
251
252 } else {
253 // We use the default, empty selection
254 }
255
256 if (!result) {
257 m_warningMessages.append(i18nc("Warning during loading a kra file with a filter layer",
258 "Selection on layer %s couldn't be loaded. It will be replaced by an empty selection.", layer->name()));
259 // otherwise ignore and just use what is there already
260 // (most probably an empty selection)
261 }
262
263 if (!loadMetaData(layer)) {
264 return false;
265 }
266
267 KisFilterSP filter = KisFilterRegistry::instance()->value(layer->filter()->name());
269
272 kfc->createLocalResourcesSnapshot();
273
274 layer->setFilter(kfc);
275
276 result = visitAll(layer);
277 return result;
278}
279
281{
282 if (!loadMetaData(layer)) {
283 return false;
284 }
285 bool result = true;
286
287 loadNodeKeyframes(layer);
288 result = loadSelection(getLocation(layer), layer->internalSelection());
289
290 KisGeneratorSP filter = KisGeneratorRegistry::instance()->value(layer->filter()->name());
292
294 kfc->createLocalResourcesSnapshot();
295
296 layer->setFilter(kfc);
297
298 result = visitAll(layer);
299 return result;
300}
301
303{
304 if (!loadMetaData(layer)) {
305 return false;
306 }
307
308 // the layer might have already been lazily initialized
309 // from the mask loading code
310 if (layer->copyFrom()) {
311 return true;
312 }
313
314 KisNodeSP srcNode = layer->copyFromInfo().findNode(m_image->rootLayer());
315 if (!srcNode.isNull()) {
316 KisLayerSP srcLayer = qobject_cast<KisLayer*>(srcNode.data());
317 Q_ASSERT(srcLayer);
318
319 layer->setCopyFrom(srcLayer);
320 } else {
321 m_warningMessages.append(i18nc("Loading a .kra file", "The file contains a clone layer that has an incorrect source node id. "
322 "This layer will be converted into a paint layer."));
323 }
324
325 // Clone layers have no data except for their masks
326 bool result = visitAll(layer);
327 return result;
328}
329
331{
332 KisLayer *cloneLayer = dynamic_cast<KisCloneLayer*>(mask->parent().data());
333 if (cloneLayer) {
334 // the clone layers should be initialized out of order
335 // and lazily, because their original() is still not
336 // initialized
337 cloneLayer->accept(*this);
338 }
339
340 KisLayer *parentLayer = qobject_cast<KisLayer*>(mask->parent().data());
341 // the KisKraLoader must have already set the parent for us
342 Q_ASSERT(parentLayer);
343 mask->initSelection(parentLayer);
344}
345
347{
349
350 loadNodeKeyframes(mask);
351
352 bool result = true;
353 result = loadSelection(getLocation(mask), mask->selection());
354
355 KisFilterSP filter = KisFilterRegistry::instance()->value(mask->filter()->name());
359 kfc->createLocalResourcesSnapshot();
360
361 mask->setFilter(kfc);
362
363 return result;
364}
365
367{
368 QString location = getLocation(mask, DOT_TRANSFORMCONFIG);
369 if (m_store->hasFile(location)) {
370 QByteArray data;
371 m_store->open(location);
372 data = m_store->read(m_store->size());
373 m_store->close();
374 if (!data.isEmpty()) {
375 QDomDocument doc;
376 doc.setContent(data);
377
378 QDomElement rootElement = doc.documentElement();
379
380 QDomElement main;
381
382 if (!KisDomUtils::findOnlyElement(rootElement, "main", &main/*, &m_errorMessages*/)) {
383 return false;
384 }
385
386 QString id = main.attribute("id", "not-valid");
387
388 // backward compatibility
389 if (id == "animatedtransformparams") {
390 id = "tooltransformparams";
391 }
392 if (id == "not-valid") {
393 m_errorMessages << i18n("Could not load \"id\" of the transform mask");
394 return false;
395 }
396
397 QDomElement data;
398
399 if (!KisDomUtils::findOnlyElement(rootElement, "data", &data, &m_errorMessages)) {
400 m_errorMessages << i18n("Could not find transform mask XML element");
401 return false;
402 }
403
406
416 if (id == "dumbparams") {
417 const QPointF center = m_image->bounds().center();
418 params->transformSrcAndDst(QTransform::fromTranslate(center.x(), center.y()));
419 }
420
421 if (!params) {
422 m_errorMessages << i18n("Could not create transform mask params");
423 return false;
424 }
425
426 mask->setTransformParams(params);
427
428 loadNodeKeyframes(mask);
429
430 return true;
431 }
432 }
433
434 return false;
435}
436
438{
440
441 loadNodeKeyframes(mask);
442
443 return loadSelection(getLocation(mask), mask->selection());
444}
445
447{
449 return loadSelection(getLocation(mask), mask->selection());
450}
451
453{
455 QString location = getLocation(mask, DOT_COLORIZE_MASK);
456 m_store->enterDirectory(location) ;
457
458 QByteArray data;
459 if (!m_store->extractFile("content.xml", data))
460 return false;
461
462 QDomDocument doc;
463 if (!doc.setContent(data))
464 return false;
465
467 if (!KisDomUtils::loadValue(doc.documentElement(),
469 &strokes,
470 mask->colorSpace(),
471 QPoint(mask->x(), mask->y()))) {
472 return false;
473 }
474
475 int i = 0;
476 Q_FOREACH (const KisLazyFillTools::KeyStroke &stroke, strokes) {
477 const QString fileName = QString("%1_%2").arg(COLORIZE_KEYSTROKE).arg(i++);
478 loadPaintDevice(stroke.dev, fileName);
479 }
480
482
484
485 const KoColorProfile *profile =
487
488 if (!profile) {
489 KisNodeSP parent = mask->parent();
491 parent = m_image->root();
492 }
493
494 if (parent->colorSpace()->colorModelId() == mask->colorSpace()->colorModelId() &&
495 parent->colorSpace()->colorDepthId() == mask->colorSpace()->colorDepthId()) {
496
497 profile = parent->colorSpace()->profile();
498 }
499 }
500
501 if (!profile) {
502 if (m_image->colorSpace()->colorModelId() == mask->colorSpace()->colorModelId() &&
504
505 profile = m_image->colorSpace()->profile();
506 }
507 }
508
509 if (profile) {
510 mask->setProfile(profile, 0);
511 }
512
513 mask->resetCache();
514
516 return true;
517}
518
523
528
530{
531 bool read(KisPaintDeviceSP dev, QIODevice *stream) {
532 return dev->read(stream);
533 }
534
536 return dev->setDefaultPixel(defaultPixel);
537 }
538};
539
541{
543 : m_frameId(frameId) {}
544
545 bool read(KisPaintDeviceSP dev, QIODevice *stream) {
546 return dev->framesInterface()->readFrame(stream, m_frameId);
547 }
548
552
554};
555
556bool KisKraLoadVisitor::loadPaintDevice(KisPaintDeviceSP device, const QString& location)
557{
558 // Layer data
559 KisPaintDeviceFramesInterface *frameInterface = device->framesInterface();
560 QList<int> frames;
561
562 if (frameInterface) {
563 frames = device->framesInterface()->frames();
564 }
565
566 if (!frameInterface || frames.count() <= 1) {
567 return loadPaintDeviceFrame(device, location, SimpleDevicePolicy());
568 } else {
569 KisRasterKeyframeChannel *keyframeChannel = device->keyframeChannel();
570
571 for (int i = 0; i < frames.count(); i++) {
572 int id = frames[i];
573 if (keyframeChannel->frameFilename(id).isEmpty()) {
574 m_warningMessages << i18n("Could not find keyframe pixel data for frame %1 in %2.", id, location);
575 }
576 else {
577 Q_ASSERT(!keyframeChannel->frameFilename(id).isEmpty());
578 QString frameFilename = getLocation(keyframeChannel->frameFilename(id));
579 Q_ASSERT(!frameFilename.isEmpty());
580
581 if (!loadPaintDeviceFrame(device, frameFilename, FramedDevicePolicy(id))) {
582 m_warningMessages << i18n("Could not load keyframe pixel data for frame %1 in %2.", id, location);
583 }
584 }
585 }
586 }
587
588 return true;
589}
590
591template<class DevicePolicy>
592bool KisKraLoadVisitor::loadPaintDeviceFrame(KisPaintDeviceSP device, const QString &location, DevicePolicy policy)
593{
594 {
595 const int pixelSize = device->colorSpace()->pixelSize();
597
598 if (m_store->open(location + ".defaultpixel")) {
599 if (m_store->size() == pixelSize) {
600 m_store->read((char*)color.data(), pixelSize);
601 }
602
603 m_store->close();
604 }
605
606 policy.setDefaultPixel(device, color);
607 }
608
609 if (m_store->open(location)) {
610 if (!policy.read(device, m_store->device())) {
611 m_warningMessages << i18n("Could not read pixel data: %1.", location);
612 device->disconnect();
613 m_store->close();
614 return true;
615 }
616 m_store->close();
617 } else {
618 m_warningMessages << i18n("Could not load pixel data: %1.", location);
619 return true;
620 }
621
622 return true;
623}
624
625
626bool KisKraLoadVisitor::loadProfile(KisPaintDeviceSP device, const QString& location)
627{
628 const KoColorProfile *profile = loadProfile(location, device->colorSpace()->colorModelId().id(), device->colorSpace()->colorDepthId().id());
629
630 if (profile) {
631 // TODO: check result!
632 device->setProfile(profile, 0);
633 } else {
634 m_warningMessages << i18n("Could not load profile: %1.", location);
635 }
636
637 return true;
638}
639
640const KoColorProfile *KisKraLoadVisitor::loadProfile(const QString &location, const QString &colorModelId, const QString &colorDepthId)
641{
642 const KoColorProfile *result = 0;
643
644 if (m_store->hasFile(location)) {
645 m_store->open(location);
646 QByteArray data;
647 data.resize(m_store->size());
648 dbgFile << "Data to load: " << m_store->size() << " from " << location << " with color space " << colorModelId << colorDepthId;
649 int read = m_store->read(data.data(), m_store->size());
650 dbgFile << "Profile size: " << data.size() << " " << m_store->atEnd() << " " << m_store->device()->bytesAvailable() << " " << read;
651 m_store->close();
652
653 QString hash = KoMD5Generator::generateHash(data);
654
655 if (m_profileCache.contains(hash)) {
656 result = m_profileCache[hash];
657 }
658 else {
659 // Create a colorspace with the embedded profile
660 const KoColorProfile *profile = KoColorSpaceRegistry::instance()->createColorProfile(colorModelId, colorDepthId, data);
661 m_profileCache[hash] = profile;
662 result = profile;
663 }
664 }
665
666 return result;
667}
668
670{
671 if (m_store->hasFile(location)) {
672 QByteArray data;
673 m_store->open(location);
674 data = m_store->read(m_store->size());
675 m_store->close();
676 if (!data.isEmpty()) {
677 QDomDocument doc;
678 doc.setContent(data);
679 QDomElement e = doc.documentElement();
680 if (e.tagName() == "filterconfig") {
681 kfc->fromLegacyXML(e);
682 } else {
683 kfc->fromXML(e);
684 }
686 return true;
687 }
688 }
689 m_warningMessages << i18n("Could not filter configuration %1.", location);
690 return true;
691}
692
704
706{
707 KisLayer* layer = qobject_cast<KisLayer*>(node);
708 if (!layer) return true;
709
711
712 if (!backend || !backend->supportLoading()) {
713 if (backend)
714 dbgFile << "Backend " << backend->id() << " does not support loading.";
715 else
716 dbgFile << "Could not load the XMP backend at all";
717 return true;
718 }
719
720 QString location = getLocation(node, QString(".") + backend->id() + DOT_METADATA);
721 dbgFile << "going to load " << backend->id() << ", " << backend->name() << " from " << location;
722
723 if (m_store->hasFile(location)) {
724 QByteArray data;
725 m_store->open(location);
726 data = m_store->read(m_store->size());
727 m_store->close();
728 QBuffer buffer(&data);
729 if (!backend->loadFrom(layer->metaData(), &buffer)) {
730 m_warningMessages << i18n("Could not load metadata for layer %1.", layer->name());
731 }
732 }
733 return true;
734}
735
736bool KisKraLoadVisitor::loadSelection(const QString& location, KisSelectionSP dstSelection)
737{
738 // by default the selection is expected to be fully transparent
739 {
740 KisPixelSelectionSP pixelSelection = dstSelection->pixelSelection();
741 KoColor transparent = KoColor::createTransparent(pixelSelection->colorSpace());
742 pixelSelection->setDefaultPixel(transparent);
743 }
744
745 bool result = true;
746
747 // Shape selection
748 QString shapeSelectionLocation = location + DOT_SHAPE_SELECTION;
749 if (m_store->hasFile(shapeSelectionLocation + "/content.svg") ||
750 m_store->hasFile(shapeSelectionLocation + "/content.xml")) {
751
753 m_store->enterDirectory(shapeSelectionLocation) ;
754
755 KisShapeSelection* shapeSelection = new KisShapeSelection(m_shapeController, dstSelection);
756 dstSelection->convertToVectorSelectionNoUndo(shapeSelection);
757 result = shapeSelection->loadSelection(m_store, m_image->bounds());
758
770 dstSelection->updateProjection();
772 if (!result) {
773 m_warningMessages << i18n("Could not load vector selection %1.", location);
774 }
775 } else {
783 // Pixel selection
784 QString pixelSelectionLocation = location + DOT_PIXEL_SELECTION;
785 if (m_store->hasFile(pixelSelectionLocation)) {
786 KisPixelSelectionSP pixelSelection = dstSelection->pixelSelection();
787 result = loadPaintDevice(pixelSelection, pixelSelectionLocation);
788 if (!result) {
789 m_warningMessages << i18n("Could not load raster selection %1.", location);
790 }
791 pixelSelection->invalidateOutlineCache();
792 }
793 }
794
795 return true;
796}
797
798QString KisKraLoadVisitor::getLocation(KisNode* node, const QString& suffix)
799{
800 return getLocation(m_layerFilenames[node], suffix);
801}
802
803QString KisKraLoadVisitor::getLocation(const QString &filename, const QString& suffix)
804{
805 QString location = m_external ? QString() : m_uri;
806 location += m_name + LAYER_PATH + filename + suffix;
807 return location;
808}
809
811{
812 if (!m_keyframeFilenames.contains(node)) return;
813
814 node->enableAnimation();
815
816 const QString &location = getLocation(m_keyframeFilenames[node]);
817
818 if (!m_store->open(location)) {
819 m_errorMessages << i18n("Could not load keyframes from %1.", location);
820 return;
821 }
822
823 QString errorMsg;
824 int errorLine;
825 int errorColumn;
826
827 QDomDocument dom;
828 bool ok = dom.setContent(m_store->device(), &errorMsg, &errorLine, &errorColumn);
829 m_store->close();
830
831
832 if (!ok) {
833 m_errorMessages << i18n("parsing error in the keyframe file %1 at line %2, column %3\nError message: %4", location, errorLine, errorColumn, i18n(errorMsg.toUtf8()));
834 return;
835 }
836
837 QDomElement root = dom.firstChildElement();
838
839 for (QDomElement child = root.firstChildElement(); !child.isNull(); child = child.nextSiblingElement()) {
840 if (child.nodeName().toUpper() == "CHANNEL") {
841 QString id = child.attribute("name");
842
843 KisKeyframeChannel *channel = node->getKeyframeChannel(id, true);
844
845 if (!channel) {
846 m_warningMessages << i18n("unknown keyframe channel type: %1 in %2", id, location);
847 continue;
848 }
849
850 channel->loadXML(child);
851 }
852 }
853}
854
856{
857 if (cfg->getString("legacy") == "left edge detections") {
858 cfg->setProperty("horizRadius", 1);
859 cfg->setProperty("vertRadius", 1);
860 cfg->setProperty("type", "prewitt");
861 cfg->setProperty("output", "yFall");
862 cfg->setProperty("lockAspect", true);
863 cfg->setProperty("transparency", false);
864 } else if (cfg->getString("legacy") == "right edge detections") {
865 cfg->setProperty("horizRadius", 1);
866 cfg->setProperty("vertRadius", 1);
867 cfg->setProperty("type", "prewitt");
868 cfg->setProperty("output", "yGrowth");
869 cfg->setProperty("lockAspect", true);
870 cfg->setProperty("transparency", false);
871 } else if (cfg->getString("legacy") == "top edge detections") {
872 cfg->setProperty("horizRadius", 1);
873 cfg->setProperty("vertRadius", 1);
874 cfg->setProperty("type", "prewitt");
875 cfg->setProperty("output", "xGrowth");
876 cfg->setProperty("lockAspect", true);
877 cfg->setProperty("transparency", false);
878 } else if (cfg->getString("legacy") == "bottom edge detections") {
879 cfg->setProperty("horizRadius", 1);
880 cfg->setProperty("vertRadius", 1);
881 cfg->setProperty("type", "prewitt");
882 cfg->setProperty("output", "xFall");
883 cfg->setProperty("lockAspect", true);
884 cfg->setProperty("transparency", false);
885 }
886}
void setFilter(KisFilterConfigurationSP filterConfig, bool checkCompareConfig=true) override
void setKeyStrokesDirect(const QList< KisLazyFillTools::KeyStroke > &strokes)
const KoColorSpace * colorSpace() const override
void setProfile(const KoColorProfile *profile, KUndo2Command *parentCommand)
qint32 y() const override
KisPaintDeviceSP coloringProjection() const
qint32 x() const override
void setFilter(KisFilterConfigurationSP filterConfig, bool checkCompareConfig=true) override
static KisFilterRegistry * instance()
virtual bool configurationAllowedForMask(KisFilterConfigurationSP config) const
virtual void fixLoadedFilterConfigurationForMasks(KisFilterConfigurationSP config) const
static KisGeneratorRegistry * instance()
static KisResourcesInterfaceSP instance()
KisGroupLayerSP rootLayer() const
const KoColorSpace * colorSpace() const
QRect bounds() const override
static QStringList supportedMimeTypes(Direction direction)
KisKeyframeChannel stores and manages KisKeyframes. Maps units of time to virtual keyframe values....
virtual void loadXML(const QDomElement &channelNode)
bool loadProfile(KisPaintDeviceSP device, const QString &location)
bool loadPaintDevice(KisPaintDeviceSP device, const QString &location)
void initSelectionForMask(KisMask *mask)
QMap< KisNode *, QString > m_keyframeFilenames
KoShapeControllerBase * m_shapeController
bool loadFilterConfiguration(KisFilterConfigurationSP kfc, const QString &location)
bool loadMetaData(KisNode *node)
void fixOldFilterConfigurations(KisFilterConfigurationSP kfc)
QMap< QString, const KoColorProfile * > m_profileCache
QMap< KisNode *, QString > m_layerFilenames
void setExternalUri(const QString &uri)
KisKraLoadVisitor(KisImageSP image, KoStore *store, KoShapeControllerBase *shapeController, QMap< KisNode *, QString > &layerFilenames, QMap< KisNode *, QString > &keyframeFilenames, const QString &name, int syntaxVersion)
void loadDeprecatedFilter(KisFilterConfigurationSP cfg)
bool loadSelection(const QString &location, KisSelectionSP dstSelection)
void loadNodeKeyframes(KisNode *node)
QStringList warningMessages() const
QString getLocation(KisNode *node, const QString &suffix=QString())
bool loadPaintDeviceFrame(KisPaintDeviceSP device, const QString &location, DevicePolicy policy)
bool visit(KisNode *) override
QStringList errorMessages() const
virtual QString name() const =0
virtual bool supportLoading() const =0
virtual bool loadFrom(Store *store, QIODevice *ioDevice) const =0
virtual QString id() const =0
static KisMetadataBackendRegistry * instance()
virtual KisFilterConfigurationSP filter() const
KisNodeSP findNode(KisNodeSP rootNode)
bool visitAll(KisNode *node, bool breakOnFail=false)
void setFrameDefaultPixel(const KoColor &defPixel, int frameId)
bool readFrame(QIODevice *stream, int frameId)
bool read(QIODevice *stream)
KisRasterKeyframeChannel * keyframeChannel() const
void setDefaultPixel(const KoColor &defPixel)
KisPaintDeviceFramesInterface * framesInterface()
const KoColorSpace * colorSpace() const
bool setProfile(const KoColorProfile *profile, KUndo2Command *parentCommand)
The KisRasterKeyframeChannel is a concrete KisKeyframeChannel subclass that stores and manages KisRas...
QString frameFilename(int frameId) const
The KisReferenceImage class represents a single reference image.
bool loadSelection(KoStore *store, const QRect &imageRect)
bool isNull() const
static KisTransformMaskParamsFactoryRegistry * instance()
KisTransformMaskParamsInterfaceSP createParams(const QString &id, const QDomElement &e)
virtual quint32 pixelSize() const =0
virtual KoID colorModelId() const =0
virtual KoID colorDepthId() const =0
virtual const KoColorProfile * profile() const =0
static KoColor createTransparent(const KoColorSpace *cs)
Definition KoColor.cpp:681
quint8 * data()
Definition KoColor.h:144
const T value(const QString &id) const
T get(const QString &id) const
QString id() const
Definition KoID.cpp:63
static QString generateHash(const QString &filename)
generateHash reads the given file and generates a hex-encoded md5sum for the file.
QIODevice * device() const
Definition KoStore.cpp:171
bool close()
Definition KoStore.cpp:156
qint64 size() const
Definition KoStore.cpp:239
bool extractFile(const QString &sourceName, QByteArray &data)
Definition KoStore.cpp:308
void pushDirectory()
Definition KoStore.cpp:294
void popDirectory()
Definition KoStore.cpp:300
virtual QStringList directoryList() const
Definition KoStore.cpp:426
virtual bool enterDirectory(const QString &directory)
Definition KoStore.cpp:253
bool atEnd() const
Definition KoStore.cpp:353
bool hasFile(const QString &fileName) const
Definition KoStore.cpp:384
bool open(const QString &name)
Definition KoStore.cpp:109
QByteArray read(qint64 max)
Definition KoStore.cpp:181
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:129
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
#define dbgKrita
Definition kis_debug.h:45
#define dbgFile
Definition kis_debug.h:53
QString expandEncodedDirectory(const QString &_intern)
KisSharedPtr< KisSelection > KisSelectionSP
Definition kis_types.h:149
int main(int argc, char **argv)
Definition main.cpp:26
const QString LAYER_PATH
const QString DOT_SHAPE_SELECTION
const QString DOT_PIXEL_SELECTION
const QString DOT_METADATA
const QString DOT_SHAPE_LAYER
const QString DOT_ICC
const QString DOT_FILTERCONFIG
const QString DOT_COLORIZE_MASK
const QString COLORIZE_KEYSTROKE
const QString DOT_TRANSFORMCONFIG
const QString COLORIZE_COLORING_DEVICE
const QString COLORIZE_KEYSTROKES_SECTION
bool findOnlyElement(const QDomElement &parent, const QString &tag, QDomElement *el, QStringList *errorMessages)
bool read(KisPaintDeviceSP dev, QIODevice *stream)
void setDefaultPixel(KisPaintDeviceSP dev, const KoColor &defaultPixel) const
KoColor defaultPixel(KisPaintDeviceSP dev) const
KisKeyframeChannel * getKeyframeChannel(const QString &id, bool create)
QString name() const
void enableAnimation()
virtual KisFilterConfigurationSP factoryConfiguration(KisResourcesInterfaceSP resourcesInterface) const
void setCopyFrom(KisLayerSP layer)
KisLayerSP copyFrom
KisNodeUuidInfo copyFromInfo
void setFilter(KisFilterConfigurationSP filterConfig, bool checkCompareConfig=true) override
KisMetaData::Store * metaData()
void initSelection(KisSelectionSP copyFrom, KisLayerSP parentLayer)
initSelection initializes the selection for the mask from the given selection's projection.
Definition kis_mask.cc:157
void setSelection(KisSelectionSP selection)
Definition kis_mask.cc:252
KisSelectionSP selection
Definition kis_mask.cc:44
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
KisNodeSP firstChild() const
Definition kis_node.cpp:361
bool accept(KisNodeVisitor &v) override
Definition kis_node.cpp:269
KisNodeWSP parent
Definition kis_node.cpp:86
KisPaintDeviceSP paintDevice
bool read(QIODevice *stream)
void setInternalSelection(KisSelectionSP selection)
KisSelectionSP internalSelection() const
void updateProjection(const QRect &rect)
KisPixelSelectionSP pixelSelection
void convertToVectorSelectionNoUndo(KisSelectionComponent *shapeSelection)
void setTransformParams(KisTransformMaskParamsInterfaceSP params)
static KoColorSpaceRegistry * instance()
const KoColorProfile * createColorProfile(const QString &colorModelId, const QString &colorDepthId, const QByteArray &rawData)
bool read(KisPaintDeviceSP dev, QIODevice *stream)
void setDefaultPixel(KisPaintDeviceSP dev, const KoColor &defaultPixel) const
KoColor defaultPixel(KisPaintDeviceSP dev) const