65 , m_nodeFileNames(nodeFileNames)
86 QList <KoShape *> shapes = referencesLayer->shapes();
88 Q_FOREACH(
KoShape *shape, shapes) {
91 bool saved = reference->saveImage(
m_store);
93 m_errorMessages << i18n(
"Failed to save reference image %1.", reference->internalFile());
110 result = shapeLayer->saveLayer(
m_store);
150 m_errorMessages << i18n(
"Failed to save the filter layer %1: it has no filter.", layer->
name());
154 m_errorMessages << i18n(
"Failed to save the selection for filter layer %1.", layer->
name());
158 m_errorMessages << i18n(
"Failed to save the filter configuration for filter layer %1.", layer->
name());
175 m_errorMessages << i18n(
"Failed to save the generator configuration for layer %1.", layer->
name());
206 m_errorMessages << i18n(
"Failed to save the filter configuration for filter mask %1.", mask->
name());
214 QDomDocument doc(
"transform_params");
216 QDomElement root = doc.createElement(
"transform_params");
218 QDomElement
main = doc.createElement(
"main");
221 QDomElement data = doc.createElement(
"data");
224 doc.appendChild(root);
225 root.appendChild(
main);
226 root.appendChild(data);
230 QByteArray a = doc.toByteArray();
234 warnFile <<
"Could not write transform mask configuration";
237 warnFile <<
"Could not close store after writing transform mask configuration";
248 m_errorMessages << i18n(
"Failed to save the selection for transparency mask %1.", mask->
name());
257 m_errorMessages << i18n(
"Failed to save the selection for local selection %1.", mask->
name());
279 QDomDocument doc(
"doc");
280 QDomElement root = doc.createElement(
"colorize");
281 doc.appendChild(root);
284 QTextStream stream(&storeDev);
313 return dev->
write(store);
347 if (frameInterface) {
348 frames = frameInterface->
frames();
351 if (!frameInterface || frames.count() <= 1) {
356 for (
int i = 0; i < frames.count(); i++) {
360 Q_ASSERT(!frameFilename.isEmpty());
373template<
class DevicePolicy>
377 if (!policy.write(device, *
m_writer)) {
378 device->disconnect();
395 if (!layer)
return false;
411 QByteArray profileRawData = profile->
rawData();
412 if (!profileRawData.isEmpty()) {
413 if (profile->
type() ==
"icc") {
437 if (node->inherits(
"KisMask")) {
438 selection =
static_cast<KisMask*
>(node)->selection();
439 }
else if (node->inherits(
"KisAdjustmentLayer")) {
441 }
else if (node->inherits(
"KisGeneratorLayer")) {
452 m_errorMessages << i18n(
"Failed to save the pixel selection data for layer %1.", node->
name());
462 if (!shapeSelection) {
467 m_errorMessages << i18n(
"Failed to save the vector selection data for layer %1.", node->
name());
483 if (filterInterface) {
484 filter = filterInterface->
filter();
492 QString s = filter->toXML();
501 if (!node->inherits(
"KisLayer"))
return true;
504 if (metadata->
isEmpty())
return true;
509 dbgFile <<
"Backend " << backend->
id() <<
" does not support saving.";
514 dbgFile <<
"going to save " << backend->
id() <<
", " << backend->
name() <<
" to " << location;
518 bool retval = backend->
saveTo(metadata, &buffer);
521 m_errorMessages << i18n(
"The metadata backend failed to save the metadata for %1", node->
name());
524 QByteArray data = buffer.data();
525 dbgFile <<
"\t information size is" << data.size();
A data extension mechanism for Krita.
const KoColorSpace * colorSpace() const override
KisPaintDeviceSP coloringProjection() const
QList< KisLazyFillTools::KeyStroke > fetchKeyStrokesDirect() const
bool compressKra(bool defaultValue=false) const
The KisFileLayer class loads a particular file as a layer into the layer stack.
QRect bounds() const override
bool saveAnnotations(KisLayer *layer)
~KisKraSaveVisitor() override
KisPaintDeviceWriter * m_writer
bool savePaintDeviceFrame(KisPaintDeviceSP device, QString location, DevicePolicy policy)
bool saveMetaData(KisNode *node)
bool saveFilterConfiguration(KisNode *node)
QStringList errorMessages() const
QString getLocation(KisNode *node, const QString &suffix=QString())
bool visit(KisNode *) override
QStringList m_errorMessages
QMap< const KisNode *, QString > m_nodeFileNames
KisKraSaveVisitor(KoStore *store, const QString &name, QMap< const KisNode *, QString > nodeFileNames)
void setExternalUri(const QString &uri)
bool saveIccProfile(KisNode *node, const KoColorProfile *profile)
bool savePaintDevice(KisPaintDeviceSP device, QString location)
bool saveSelection(KisNode *node)
virtual KisFilterConfigurationSP filter() const
bool visitAllInverse(KisNode *node, bool breakOnFail=false)
KoColor frameDefaultPixel(int frameId) const
bool writeFrame(KisPaintDeviceWriter &store, int frameId)
KisRasterKeyframeChannel * keyframeChannel() const
bool write(KisPaintDeviceWriter &store)
KisPaintDeviceFramesInterface * framesInterface()
const KoColorSpace * colorSpace() const
KoColor defaultPixel() const
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 saveSelection(KoStore *store, const QRect &imageRect) const
virtual quint32 pixelSize() const =0
virtual const KoColorProfile * profile() const =0
T get(const QString &id) const
static bool compareShapeZIndex(KoShape *s1, KoShape *s2)
qint64 write(const QByteArray &data)
virtual void setCompressionEnabled(bool e)
virtual bool enterDirectory(const QString &directory)
bool open(const QString &name)
This file is part of the Krita application in calligra.
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val)
int main(int argc, char **argv)
const QString DOT_SHAPE_SELECTION
const QString DOT_PIXEL_SELECTION
const QString DOT_METADATA
const QString DOT_SHAPE_LAYER
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
void saveValue(QDomElement *parent, const QString &tag, const QSize &size)
void setUtf8OnStream(QTextStream &stream)
bool write(KisPaintDeviceSP dev, KisPaintDeviceWriter &store)
FramedDevicePolicy(int frameId)
KoColor defaultPixel(KisPaintDeviceSP dev) const
virtual KisPaintDeviceSP paintDevice() const =0
KisPaintDeviceSP paintDevice
bool hasNonEmptyPixelSelection() const
KisPixelSelectionSP pixelSelection
bool hasNonEmptyShapeSelection() const
KisSelectionComponent * shapeSelection
virtual QByteArray rawData() const
virtual QString type() const
bool write(KisPaintDeviceSP dev, KisPaintDeviceWriter &store)
KoColor defaultPixel(KisPaintDeviceSP dev) const