Krita Source Code Documentation
Loading...
Searching...
No Matches
psd_export.cc
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2009 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#include "psd_export.h"
7
8#include <QCheckBox>
9#include <QSlider>
10#include <QApplication>
11
12#include <kpluginfactory.h>
13
16#include <ImageSizeCheck.h>
19
20#include <KisDocument.h>
21#include <kis_image.h>
22#include <kis_group_layer.h>
23#include <kis_paint_layer.h>
24#include <kis_paint_device.h>
25
26#include "psd_saver.h"
27
29
30K_PLUGIN_FACTORY_WITH_JSON(ExportFactory, "krita_psd_export.json", registerPlugin<psdExport>();)
31
32psdExport::psdExport(QObject *parent, const QVariantList &) : KisImportExportFilter(parent)
33{
34}
35
39
41{
42 PSDSaver psdSaver(document);
43 return psdSaver.buildFile(*io);
44}
45
47{
49 addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisGroupLayer")->create(KisExportCheckBase::SUPPORTED));
50 addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisGeneratorLayer")->create(KisExportCheckBase::SUPPORTED));
51 addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisShapeLayer")->create(KisExportCheckBase::SUPPORTED));
55 addCapability(KisExportCheckRegistry::instance()->get("NodeTypeCheck/KisTransparencyMask")->create(KisExportCheckBase::SUPPORTED));
56 addCapability(KisExportCheckRegistry::instance()->get("ColorModelHomogenousCheck")->create(KisExportCheckBase::UNSUPPORTED, i18nc("image conversion warning", "Your image contains one or more layers with a color model that is different from the image.")));
58
59 ImageSizeCheckFactory *factory = dynamic_cast<ImageSizeCheckFactory*>(KisExportCheckRegistry::instance()->get("ImageSizeCheck"));
60 if (factory) {
61 addCapability(factory->create(30000, 30000, KisExportCheckBase::SUPPORTED));
62 }
63
64 QList<QPair<KoID, KoID> > supportedColorModels;
65 supportedColorModels << QPair<KoID, KoID>()
66 << QPair<KoID, KoID>(RGBAColorModelID, Integer8BitsColorDepthID)
67 << QPair<KoID, KoID>(RGBAColorModelID, Integer16BitsColorDepthID)
68// << QPair<KoID, KoID>(RGBAColorModelID, Float16BitsColorDepthID)
69// << QPair<KoID, KoID>(RGBAColorModelID, Float32BitsColorDepthID)
70 << QPair<KoID, KoID>(GrayAColorModelID, Integer8BitsColorDepthID)
71 << QPair<KoID, KoID>(GrayAColorModelID, Integer16BitsColorDepthID)
72 << QPair<KoID, KoID>(CMYKAColorModelID, Integer8BitsColorDepthID)
73 << QPair<KoID, KoID>(CMYKAColorModelID, Integer16BitsColorDepthID)
74 << QPair<KoID, KoID>(LABAColorModelID, Integer8BitsColorDepthID)
75 << QPair<KoID, KoID>(LABAColorModelID, Integer16BitsColorDepthID);
76 addSupportedColorModels(supportedColorModels, "PSD");
77
80 addCapability(KisExportCheckRegistry::instance()->get("FillLayerTypeCheck/gradient")->create(KisExportCheckBase::SUPPORTED));
81
82 addCapability(KisExportCheckRegistry::instance()->get("ShapeLayerTypeCheck/KoPathShape")->create(KisExportCheckBase::SUPPORTED));
83 addCapability(KisExportCheckRegistry::instance()->get("ShapeLayerTypeCheck/KoPathShape/RectangleShape")->create(KisExportCheckBase::SUPPORTED));
84 addCapability(KisExportCheckRegistry::instance()->get("ShapeLayerTypeCheck/KoPathShape/EllipseShape")->create(KisExportCheckBase::SUPPORTED));
85 addCapability(KisExportCheckRegistry::instance()->get("ShapeLayerTypeCheck/KoPathShape/StarShape")->create(KisExportCheckBase::SUPPORTED));
86 addCapability(KisExportCheckRegistry::instance()->get("ShapeLayerTypeCheck/KoShapeGroup")->create(KisExportCheckBase::SUPPORTED));
87
88 const QString textShapeWarning = i18nc("image conversion warning", "While text shapes can be saved to psd, only basic features are supported. Advanced features, like text-on-path and opentype features will not be saved.");
89 addCapability(KisExportCheckRegistry::instance()->get("ShapeLayerTypeCheck/KoSvgTextShapeID")->create(KisExportCheckBase::PARTIALLY, textShapeWarning));
90}
91
93{
94 return true;
95}
96
97#include <psd_export.moc>
98
VertexDescriptor get(PredecessorMap const &m, VertexDescriptor v)
const KoID GrayAColorModelID("GRAYA", ki18n("Grayscale/Alpha"))
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID CMYKAColorModelID("CMYKA", ki18n("CMYK/Alpha"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
KisExportCheckBase * create(int maxWidth, int maxHeight, KisExportCheckBase::Level level, const QString &customWarning)
static KisExportCheckRegistry * instance()
The base class for import and export filters.
void addSupportedColorModels(QList< QPair< KoID, KoID > > supportedColorModels, const QString &name, KisExportCheckBase::Level level=KisExportCheckBase::PARTIALLY)
void addCapability(KisExportCheckBase *capability)
T get(const QString &id) const
KisImportExportErrorCode buildFile(QIODevice &io)
Definition psd_saver.cpp:92
void initializeCapabilities() override
Definition psd_export.cc:46
KisImportExportErrorCode convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration=0) override
Definition psd_export.cc:40
psdExport(QObject *parent, const QVariantList &)
Definition psd_export.cc:32
~psdExport() override
Definition psd_export.cc:36
bool exportSupportsGuides() const override
exportSupportsGuides Because guides are in the document and not the image, checking for guides cannot...
Definition psd_export.cc:92
K_PLUGIN_FACTORY_WITH_JSON(KritaASCCDLFactory, "kritaasccdl.json", registerPlugin< KritaASCCDL >();) KritaASCCDL
KisNodeWSP parent
Definition kis_node.cpp:86