Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_open_raster_save_context.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
8
9#include <QDomDocument>
10
11#include <KoStore.h>
12#include <KoStoreDevice.h>
14#include <kundo2command.h>
15#include <kis_paint_layer.h>
16#include <kis_paint_device.h>
17#include <kis_image.h>
18
19#include <kis_meta_data_store.h>
20
21#include "kis_png_converter.h"
22
24 : m_id(0)
25 , m_store(store)
26{
27}
28
29QString KisOpenRasterSaveContext::saveDeviceData(KisPaintDeviceSP dev, KisMetaData::Store* metaData, const QRect &imageRect, const qreal xRes, const qreal yRes)
30{
31 QString filename = QString("data/layer%1.png").arg(m_id++);
32 if (KisPNGConverter::saveDeviceToStore(filename, imageRect, xRes, yRes, dev, m_store, metaData)) {
33 return filename;
34 }
35 return "";
36}
37
38
39void KisOpenRasterSaveContext::saveStack(const QDomDocument& doc)
40{
41 if (m_store->open("stack.xml")) {
43 io.write(doc.toByteArray());
44 io.close();
45 m_store->close();
46 } else {
47 dbgFile << "Opening of the stack.xml file failed :";
48 }
49}
void saveStack(const QDomDocument &doc)
QString saveDeviceData(KisPaintDeviceSP dev, KisMetaData::Store *metaData, const QRect &imageRect, qreal xRes, qreal yRes)
static bool saveDeviceToStore(const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP dev, KoStore *store, KisMetaData::Store *metaData=0)
saveDeviceToStore saves the given paint device to the KoStore. If the device is not 8 bits sRGB,...
void close() override
bool close()
Definition KoStore.cpp:156
bool open(const QString &name)
Definition KoStore.cpp:109
#define dbgFile
Definition kis_debug.h:53