Blender  V2.93
gpencil_io_export_svg.hh
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2020 Blender Foundation
17  * All rights reserved.
18  */
19 #pragma once
20 
24 #include "BLI_path_util.h"
25 
27 #include "pugixml.hpp"
28 
29 struct GpencilIOParams;
30 
31 #define SVG_EXPORTER_NAME "SVG Export for Grease Pencil"
32 #define SVG_EXPORTER_VERSION "v1.0"
33 
34 namespace blender::io::gpencil {
35 
37 
38  public:
39  GpencilExporterSVG(const char *filename, const struct GpencilIOParams *iparams);
40  bool add_newpage();
41  bool add_body();
42  bool write();
43 
44  protected:
45  static void add_rect(pugi::xml_node node,
46  float x,
47  float y,
48  float width,
49  float height,
50  float thickness,
51  std::string hexcolor);
52 
53  static void add_text(pugi::xml_node node,
54  float x,
55  float y,
56  std::string text,
57  const float size,
58  std::string hexcolor);
59 
60  private:
61  /* XML doc. */
62  pugi::xml_document main_doc_;
63  /* Main document node. */
64  pugi::xml_node main_node_;
66  pugi::xml_node frame_node_;
67  void create_document_header();
68  void export_gpencil_layers();
69 
70  void export_stroke_to_path(struct bGPDlayer *gpl,
71  struct bGPDstroke *gps,
72  pugi::xml_node node_gpl,
73  const bool do_fill);
74 
75  void export_stroke_to_polyline(struct bGPDlayer *gpl,
76  struct bGPDstroke *gps,
77  pugi::xml_node node_gpl,
78  const bool is_stroke,
79  const bool do_fill);
80 
81  void color_string_set(struct bGPDlayer *gpl,
82  struct bGPDstroke *gps,
83  pugi::xml_node node_gps,
84  const bool do_fill);
85 
86  std::string rgb_to_hexstr(const float color[3]);
87 };
88 
89 } // namespace blender::io::gpencil
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
GpencilExporterSVG(const char *filename, const struct GpencilIOParams *iparams)
static void add_text(pugi::xml_node node, float x, float y, std::string text, const float size, std::string hexcolor)
static void add_rect(pugi::xml_node node, float x, float y, float width, float height, float thickness, std::string hexcolor)
OperationNode * node