2
* A simple utility for exporting Inkscape svg Shapes as PovRay bezier
3
* prisms. Note that this is output-only, and would thus seem to be
4
* better placed as an 'export' rather than 'output'. However, Export
5
* handles all or partial documents, while this outputs ALL shapes in
6
* the current SVG document.
9
* Bob Jamison <ishmal@inkscape.org>
11
* Copyright (C) 2004-2008 Authors
13
* Released under GNU GPL, read the file 'COPYING' for more information
16
#ifndef EXTENSION_INTERNAL_POV_OUT_H
17
#define EXTENSION_INTERNAL_POV_OUT_H
20
#include "extension/implementation/implementation.h"
34
* Output bezier splines in POVRay format.
36
* For information, @see:
37
* http://www.povray.org
39
class PovOutput : public Inkscape::Extension::Implementation::Implementation
46
* Our internal String definition
48
typedef Glib::ustring String;
52
* Check whether we can actually output using this module
54
bool check (Inkscape::Extension::Extension * module);
57
* API call to perform the output to a file
59
void save(Inkscape::Extension::Output *mod,
60
SPDocument *doc, gchar const *filename);
63
* Inkscape runtime startup call.
65
static void init(void);
68
* Reset variables to initial state
75
* Format text to our output buffer
77
void out(const char *fmt, ...) G_GNUC_PRINTF(2,3);
82
void vec2(double a, double b);
87
void vec3(double a, double b, double c);
92
void vec4(double a, double b, double c, double d);
95
* Output an rgbf color vector
97
void rgbf(double r, double g, double b, double f);
100
* Output one bezier's start, start-control,
101
* end-control, and end nodes
103
void segment(int segNr, double a0, double a1,
104
double b0, double b1,
105
double c0, double c1,
106
double d0, double d1);
110
* Output the file header
115
* Output the file footer
120
* Output the SVG document's curve data as POV curves
122
bool doCurve(SPItem *item, const String &id);
123
bool doTreeRecursive(SPDocument *doc, SPObject *obj);
124
bool doTree(SPDocument *doc);
127
* Actual method to save document
129
void saveDocument(SPDocument *doc, gchar const *filename);
133
* used for saving information about shapes
140
PovShapeInfo(const PovShapeInfo &other)
142
PovShapeInfo operator=(const PovShapeInfo &other)
143
{ assign(other); return *this; }
144
virtual ~PovShapeInfo()
150
void assign(const PovShapeInfo &other)
157
//A list for saving information about the shapes
158
std::vector<PovShapeInfo> povShapes;
160
//For formatted output
179
} // namespace Internal
180
} // namespace Extension
181
} // namespace Inkscape
185
#endif /* EXTENSION_INTERNAL_POV_OUT_H */