File indexing completed on 2025-01-05 04:01:21
0001 /* 0002 * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QIODevice> 0010 #include <QDomDocument> 0011 0012 #include "model/shapes/shape.hpp" 0013 0014 namespace glaxnimate::model { 0015 class EmbeddedFont; 0016 } // namespace glaxnimate::model 0017 0018 namespace glaxnimate::io::svg { 0019 0020 enum AnimationType 0021 { 0022 NotAnimated, 0023 SMIL 0024 }; 0025 0026 enum class CssFontType 0027 { 0028 None, 0029 Embedded, 0030 FontFace, 0031 Link, 0032 }; 0033 0034 class SvgRenderer 0035 { 0036 public: 0037 SvgRenderer(AnimationType animated, CssFontType font_type); 0038 ~SvgRenderer(); 0039 0040 void write_composition(model::Composition* comp); 0041 void write_main(model::Composition* comp); 0042 void write_shape(model::ShapeElement* shape); 0043 void write_node(model::DocumentNode* node); 0044 0045 QDomDocument dom() const; 0046 0047 void write(QIODevice* device, bool indent); 0048 0049 static CssFontType suggested_type(model::EmbeddedFont* font); 0050 private: 0051 class Private; 0052 std::unique_ptr<Private> d; 0053 }; 0054 0055 /** 0056 * \brief Converts a multi bezier into path data 0057 * \returns pair of [path data, sodipodi nodetypes] 0058 */ 0059 std::pair<QString, QString> path_data(const math::bezier::MultiBezier& shape); 0060 0061 } // namespace glaxnimate::io::svg