Changeset View
Changeset View
Standalone View
Standalone View
libs/libkis/Document.cpp
Show All 37 Lines | |||||
38 | #include <kis_group_layer.h> | 38 | #include <kis_group_layer.h> | ||
39 | #include <kis_filter_mask.h> | 39 | #include <kis_filter_mask.h> | ||
40 | #include <kis_transform_mask.h> | 40 | #include <kis_transform_mask.h> | ||
41 | #include <kis_transparency_mask.h> | 41 | #include <kis_transparency_mask.h> | ||
42 | #include <kis_selection_mask.h> | 42 | #include <kis_selection_mask.h> | ||
43 | #include <kis_effect_mask.h> | 43 | #include <kis_effect_mask.h> | ||
44 | #include <kis_paint_layer.h> | 44 | #include <kis_paint_layer.h> | ||
45 | #include <kis_generator_layer.h> | 45 | #include <kis_generator_layer.h> | ||
46 | #include <kis_generator_registry.h> | ||||
46 | #include <kis_shape_layer.h> | 47 | #include <kis_shape_layer.h> | ||
47 | #include <kis_filter_configuration.h> | 48 | #include <kis_filter_configuration.h> | ||
49 | #include <kis_filter_registry.h> | ||||
48 | #include <kis_selection.h> | 50 | #include <kis_selection.h> | ||
49 | #include <KisMimeDatabase.h> | 51 | #include <KisMimeDatabase.h> | ||
50 | #include <kis_filter_strategy.h> | 52 | #include <kis_filter_strategy.h> | ||
51 | #include <kis_guides_config.h> | 53 | #include <kis_guides_config.h> | ||
52 | #include <kis_coordinates_converter.h> | 54 | #include <kis_coordinates_converter.h> | ||
53 | 55 | | |||
54 | #include <KisMimeDatabase.h> | 56 | #include <KisMimeDatabase.h> | ||
55 | #include <KoColorSpace.h> | 57 | #include <KoColorSpace.h> | ||
▲ Show 20 Lines • Show All 500 Lines • ▼ Show 20 Line(s) | 557 | else if (nodeType == "transformmask") { | |||
556 | node = new Node(image, new KisTransformMask()); | 558 | node = new Node(image, new KisTransformMask()); | ||
557 | } | 559 | } | ||
558 | else if (nodeType == "selectionmask") { | 560 | else if (nodeType == "selectionmask") { | ||
559 | node = new Node(image, new KisSelectionMask(image)); | 561 | node = new Node(image, new KisSelectionMask(image)); | ||
560 | } | 562 | } | ||
561 | return node; | 563 | return node; | ||
562 | } | 564 | } | ||
563 | 565 | | |||
566 | GroupLayer *Document::createGroupLayer(const QString &name) | ||||
567 | { | ||||
568 | if (!d->document) return 0; | ||||
569 | if (!d->document->image()) return 0; | ||||
570 | KisImageSP image = d->document->image(); | ||||
571 | | ||||
572 | return new GroupLayer(image, name); | ||||
573 | } | ||||
574 | | ||||
575 | FileLayer *Document::createFileLayer(const QString &name, const QString FileName, const QString ScalingMethod) | ||||
576 | { | ||||
577 | if (!d->document) return 0; | ||||
578 | if (!d->document->image()) return 0; | ||||
579 | KisImageSP image = d->document->image(); | ||||
580 | | ||||
581 | return new FileLayer(image, name, fileName(), FileName, ScalingMethod); | ||||
582 | } | ||||
583 | | ||||
584 | FilterLayer *Document::createFilterLayer(const QString &name, Filter &filter, Selection &selection) | ||||
585 | { | ||||
586 | if (!d->document) return 0; | ||||
587 | if (!d->document->image()) return 0; | ||||
588 | KisImageSP image = d->document->image(); | ||||
589 | | ||||
590 | return new FilterLayer(image, name, filter, selection); | ||||
591 | } | ||||
592 | | ||||
593 | FillLayer *Document::createFillLayer(const QString &name, const QString filterName, InfoObject &configuration, Selection &selection) | ||||
594 | { | ||||
595 | if (!d->document) return 0; | ||||
596 | if (!d->document->image()) return 0; | ||||
597 | KisImageSP image = d->document->image(); | ||||
598 | | ||||
599 | KisFilterConfigurationSP config = KisGeneratorRegistry::instance()->value(filterName)->defaultConfiguration(); | ||||
600 | Q_FOREACH(const QString property, configuration.properties().keys()) { | ||||
601 | config->setProperty(property, configuration.property(property)); | ||||
602 | } | ||||
603 | | ||||
604 | return new FillLayer(image, name, config, selection); | ||||
605 | } | ||||
606 | | ||||
607 | CloneLayer *Document::createCloneLayer(const QString &name, const Node *source) | ||||
608 | { | ||||
609 | if (!d->document) return 0; | ||||
610 | if (!d->document->image()) return 0; | ||||
611 | KisImageSP image = d->document->image(); | ||||
612 | KisLayerSP layer = qobject_cast<KisLayer*>(source->node().data()); | ||||
613 | | ||||
614 | return new CloneLayer(image, name, layer); | ||||
615 | } | ||||
616 | | ||||
617 | VectorLayer *Document::createVectorLayer(const QString &name) | ||||
618 | { | ||||
619 | if (!d->document) return 0; | ||||
620 | if (!d->document->image()) return 0; | ||||
621 | KisImageSP image = d->document->image(); | ||||
622 | | ||||
623 | return new VectorLayer(d->document->shapeController(), image, name); | ||||
624 | } | ||||
625 | | ||||
626 | FilterMask *Document::createFilterMask(const QString &name, Filter &filter) | ||||
627 | { | ||||
628 | if (!d->document) return 0; | ||||
629 | if (!d->document->image()) return 0; | ||||
630 | KisImageSP image = d->document->image(); | ||||
631 | | ||||
632 | return new FilterMask(image, name, filter); | ||||
633 | } | ||||
634 | | ||||
635 | SelectionMask *Document::createSelectionMask(const QString &name) | ||||
636 | { | ||||
637 | if (!d->document) return 0; | ||||
638 | if (!d->document->image()) return 0; | ||||
639 | KisImageSP image = d->document->image(); | ||||
640 | | ||||
641 | return new SelectionMask(image, name); | ||||
642 | } | ||||
643 | | ||||
644 | | ||||
564 | QImage Document::projection(int x, int y, int w, int h) const | 645 | QImage Document::projection(int x, int y, int w, int h) const | ||
565 | { | 646 | { | ||
566 | if (!d->document || !d->document->image()) return QImage(); | 647 | if (!d->document || !d->document->image()) return QImage(); | ||
567 | return d->document->image()->convertToQImage(x, y, w, h, 0); | 648 | return d->document->image()->convertToQImage(x, y, w, h, 0); | ||
568 | } | 649 | } | ||
569 | 650 | | |||
570 | QImage Document::thumbnail(int w, int h) const | 651 | QImage Document::thumbnail(int w, int h) const | ||
571 | { | 652 | { | ||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |