Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
/*
* SPDX-FileCopyrightText: 2017 Boudewijn Rempt <[email protected]>
*
* SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "HtmlSavingContext.h"
#include <KoXmlWriter.h>
#include <KoShape.h>
#include <QBuffer>
struct HtmlSavingContext::Private {
Private(QIODevice *_shapeDevice)
: shapeDevice(_shapeDevice)
, shapeWriter(0)
{
shapeWriter.reset(new KoXmlWriter(&shapeBuffer, 1));
}
QIODevice *shapeDevice;
QBuffer shapeBuffer;
QScopedPointer<KoXmlWriter> shapeWriter;
};
HtmlSavingContext::HtmlSavingContext(QIODevice &shapeDevice)
: d(new Private(&shapeDevice))
{
}
HtmlSavingContext::~HtmlSavingContext()
{
d->shapeDevice->write(d->shapeBuffer.data());
}
KoXmlWriter &HtmlSavingContext::shapeWriter()
{
return *d->shapeWriter;
}