1 /*\r
2 * A simple utility for exporting an Inkscape svg image as a JavaFX\r
3 * scene tree.\r
4 *\r
5 * Authors:\r
6 * Bob Jamison <ishmal@inkscape.org>\r
7 * Silveira Neto <silveiraneto@gmail.com>\r
8 * Jim Clarke <Jim.Clarke@sun.com>\r
9 *\r
10 * Copyright (C) 2008 Authors\r
11 *\r
12 * Released under GNU GPL, read the file 'COPYING' for more information\r
13 */\r
14 \r
15 #ifndef EXTENSION_INTERNAL_JAVAFX_OUT_H\r
16 #define EXTENSION_INTERNAL_JAVAFX_OUT_H\r
17 \r
18 #include <glib.h>\r
19 #include "extension/implementation/implementation.h"\r
20 #include <document.h>\r
21 #include <sp-gradient.h>\r
22 \r
23 namespace Inkscape\r
24 {\r
25 namespace Extension\r
26 {\r
27 namespace Internal\r
28 {\r
29 \r
30 \r
31 \r
32 /**\r
33 * Output the current svg document in JavaFX format.\r
34 * \r
35 * For information, @see: \r
36 * https://openjfx.dev.java.net/\r
37 */ \r
38 class JavaFXOutput : public Inkscape::Extension::Implementation::Implementation\r
39 {\r
40 \r
41 \r
42 public:\r
43 \r
44 /**\r
45 * Our internal String definition\r
46 */\r
47 typedef Glib::ustring String;\r
48 \r
49 \r
50 /**\r
51 * Check whether we can actually output using this module\r
52 */\r
53 virtual bool check (Inkscape::Extension::Extension * module);\r
54 \r
55 /**\r
56 * API call to perform the output to a file\r
57 */\r
58 virtual void save (Inkscape::Extension::Output *mod,\r
59 SPDocument *doc, const gchar *uri);\r
60 \r
61 /**\r
62 * Inkscape runtime startup call.\r
63 */\r
64 static void init(void);\r
65 \r
66 /**\r
67 * Reset variables to initial state\r
68 */\r
69 void reset();\r
70 \r
71 private:\r
72 \r
73 //output class name\r
74 String name;\r
75 \r
76 //For formatted output\r
77 String outbuf; //main output buffer\r
78 String foutbuf; //header function buffer\r
79 \r
80 \r
81 /**\r
82 * Format text to our output buffer\r
83 */\r
84 void out(const char *fmt, ...) G_GNUC_PRINTF(2,3);\r
85 \r
86 /**\r
87 * Format text to our function output buffer\r
88 */\r
89 void fout(const char *fmt, ...) G_GNUC_PRINTF(2,3);\r
90 \r
91 //Output the parts of the file\r
92 \r
93 /**\r
94 * Output the file header\r
95 */\r
96 bool doHeader();\r
97 \r
98 /**\r
99 * Output gradient information to the buffer\r
100 */\r
101 bool doGradient(SPGradient *grad, const String &id);\r
102 \r
103 /**\r
104 * Output an element's style attribute\r
105 */\r
106 bool doStyle(SPStyle *style);\r
107 \r
108 /**\r
109 * Output the SVG document's curve data as JavaFX geometry types\r
110 */\r
111 bool doCurve(SPItem *item, const String &id);\r
112 bool doTreeRecursive(SPDocument *doc, SPObject *obj);\r
113 bool doTree(SPDocument *doc);\r
114 \r
115 bool doBody(SPDocument *doc, SPObject *obj);\r
116 \r
117 /**\r
118 * Output the file footer\r
119 */\r
120 bool doTail();\r
121 \r
122 \r
123 \r
124 /**\r
125 * Actual method to save document\r
126 */\r
127 bool saveDocument(SPDocument *doc, const gchar *uri);\r
128 \r
129 //For statistics\r
130 int nrNodes;\r
131 int nrShapes;\r
132 \r
133 int idindex;\r
134 \r
135 double minx;\r
136 double miny;\r
137 double maxx;\r
138 double maxy;\r
139 \r
140 \r
141 };\r
142 \r
143 \r
144 \r
145 \r
146 } // namespace Internal\r
147 } // namespace Extension\r
148 } // namespace Inkscape\r
149 \r
150 \r
151 \r
152 #endif /* EXTENSION_INTERNAL_POV_OUT_H */\r
153 \r