Skip to content

armgit / krita

Public Imported from GitHub
0

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++
2.3 KB
Raw Blame
/* This file is part of the KDE project
   SPDX-FileCopyrightText: 2002 Lars Siebold <[email protected]>
   SPDX-FileCopyrightText: 2002 Werner Trobin <[email protected]>
   SPDX-FileCopyrightText: 2002 Lennart Kudling <[email protected]>
   SPDX-FileCopyrightText: 2002-2003, 2005 Rob Buis <[email protected]>
   SPDX-FileCopyrightText: 2005 Boudewijn Rempt <[email protected]>
   SPDX-FileCopyrightText: 2005 Raphael Langerhorst <[email protected]>
   SPDX-FileCopyrightText: 2005 Thomas Zander <[email protected]>
   SPDX-FileCopyrightText: 2005, 2008 Jan Hambrecht <[email protected]>
   SPDX-FileCopyrightText: 2006 Inge Wallin <[email protected]>
   SPDX-FileCopyrightText: 2006 Laurent Montel <[email protected]>

   SPDX-License-Identifier: LGPL-2.0-or-later
*/

#ifndef SVGWRITER_H
#define SVGWRITER_H

#include "kritaflake_export.h"
#include <QList>
#include <QSizeF>

class SvgSavingContext;
class KoShapeLayer;
class KoShapeGroup;
class KoShape;
class KoPathShape;
class QIODevice;
class QString;

/// Implements exporting shapes to SVG
class KRITAFLAKE_EXPORT SvgWriter
{
public:
    /// Creates svg writer to export specified layers
    SvgWriter(const QList<KoShapeLayer*> &layers);

    /// Creates svg writer to export specified shapes
    SvgWriter(const QList<KoShape*> &toplevelShapes);

    /// Destroys the svg writer
    virtual ~SvgWriter();

    /// Writes svg to specified output device
    bool save(QIODevice &outputDevice, const QSizeF &pageSize);

    /// Writes svg to the specified file
    bool save(const QString &filename, const QSizeF &pageSize, bool writeInlineImages);

    bool saveDetached(QIODevice &outputDevice);

    bool saveDetached(SvgSavingContext &savingContext);

    void setDocumentTitle(QString title);
    void setDocumentDescription(QString description);

private:
    void saveShapes(const QList<KoShape*> shapes, SvgSavingContext &savingContext);

    void saveLayer(KoShapeLayer *layer, SvgSavingContext &context);
    void saveGroup(KoShapeGroup *group, SvgSavingContext &context);
    void saveShape(KoShape *shape, SvgSavingContext &context);
    void savePath(KoPathShape *path, SvgSavingContext &context);
    void saveGeneric(KoShape *shape, SvgSavingContext &context);

    QList<KoShape*> m_toplevelShapes;
    bool m_writeInlineImages;
    QString m_documentTitle;
    QString m_documentDescription;
};

#endif // SVGWRITER_H