~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/extension/internal/pov-out.h

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Kees Cook, Ted Gould
  • Date: 2008-02-10 14:20:16 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20080210142016-vcnb2zqyhszu0xvb
Tags: 0.46~pre1-0ubuntu1
[ Kees Cook ]
* debian/control:
  - add libgtkspell-dev build-dep to gain GtkSpell features (LP: #183547).
  - update Standards version (no changes needed).
  - add Vcs and Homepage fields.
  - switch to new python-lxml dep.
* debian/{control,rules}: switch from dpatch to quilt for more sanity.
* debian/patches/20_fix_glib_and_gxx43_ftbfs.patch:
  - merged against upstream fixes.
  - added additional fixes for newly written code.
* debian/rules: enable parallel building.

[ Ted Gould ]
* Updating POTFILES.in to make it so things build correctly.
* debian/control:
  - add ImageMagick++ and libboost-dev to build-deps

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <glib.h>
20
20
#include "extension/implementation/implementation.h"
21
21
 
22
 
namespace Inkscape {
23
 
namespace Extension {
24
 
namespace Internal {
25
 
 
 
22
namespace Inkscape
 
23
{
 
24
namespace Extension
 
25
{
 
26
namespace Internal
 
27
{
 
28
 
 
29
 
 
30
 
 
31
/**
 
32
 * Output bezier splines in POVRay format.
 
33
 * 
 
34
 * For information, @see:  
 
35
 * http://www.povray.org 
 
36
 */ 
26
37
class PovOutput : public Inkscape::Extension::Implementation::Implementation
27
38
{
28
39
 
 
40
 
 
41
/**
 
42
 * Our internal String definition
 
43
 */ 
 
44
typedef Glib::ustring String;
 
45
 
 
46
 
 
47
public:
 
48
 
 
49
    /**
 
50
     * Check whether we can actually output using this module
 
51
     */
 
52
        bool check (Inkscape::Extension::Extension * module);
 
53
 
 
54
    /**
 
55
     * API call to perform the output to a file
 
56
     */
 
57
        void save (Inkscape::Extension::Output *mod,
 
58
                   SPDocument *doc, const gchar *uri);
 
59
 
 
60
    /**
 
61
     * Inkscape runtime startup call.
 
62
     */
 
63
        static void init(void);
 
64
        
 
65
    /**
 
66
     * Reset variables to initial state
 
67
     */
 
68
        void reset();
 
69
        
 
70
private:
 
71
 
 
72
        /**
 
73
         * Format text to our output buffer
 
74
         */             
 
75
        void out(char const *fmt, ...) G_GNUC_PRINTF(2,3);
 
76
 
 
77
    /**
 
78
     * Output a 2d vector
 
79
     */
 
80
    void vec2(double a, double b);
 
81
 
 
82
    /**
 
83
     * Output a 3d vector
 
84
     */
 
85
    void vec3(double a, double b, double c);
 
86
 
 
87
    /**
 
88
     * Output a 4d vector
 
89
     */
 
90
    void vec4(double a, double b, double c, double d);
 
91
 
 
92
    /**
 
93
     * Output an rgbf color vector
 
94
     */
 
95
    void rgbf(double r, double g, double b, double f);
 
96
 
 
97
    /**
 
98
     * Output one bezier's start, start-control, 
 
99
     *      end-control, and end nodes
 
100
     */
 
101
    void segment(int segNr, double a0, double a1,
 
102
                            double b0, double b1,
 
103
                            double c0, double c1,
 
104
                            double d0, double d1);
 
105
 
 
106
 
 
107
    /**
 
108
     * Output the file header
 
109
     */
 
110
    void doHeader();
 
111
 
 
112
    /**
 
113
     * Output the file footer
 
114
     */
 
115
    void doTail();
 
116
 
 
117
    /**
 
118
     * Output the SVG document's curve data as POV curves
 
119
     */
 
120
    void doCurves(SPDocument *doc);
 
121
 
 
122
    /**
 
123
     * Actual method to save document
 
124
     */
 
125
        void saveDocument(SPDocument *doc, const gchar *uri);
 
126
 
 
127
 
 
128
    /**
 
129
     * used for saving information about shapes
 
130
     */
 
131
    class PovShapeInfo
 
132
    {
29
133
    public:
30
 
 
31
 
        bool check (Inkscape::Extension::Extension * module);
32
 
 
33
 
        void          save  (Inkscape::Extension::Output *mod,
34
 
                             SPDocument *doc,
35
 
                             const gchar *uri);
36
 
 
37
 
        static void   init  (void);
38
 
        
 
134
        PovShapeInfo()
 
135
            {}
 
136
        PovShapeInfo(const PovShapeInfo &other)
 
137
            { assign(other); }
 
138
        PovShapeInfo operator=(const PovShapeInfo &other)
 
139
            { assign(other); return *this; }
 
140
        virtual ~PovShapeInfo()
 
141
            {}
 
142
        String id;
 
143
        String color;
 
144
 
 
145
    private:
 
146
        void assign(const PovShapeInfo &other)
 
147
            {
 
148
            id    = other.id;
 
149
            color = other.color;
 
150
            }
 
151
    };
 
152
 
 
153
    //A list for saving information about the shapes
 
154
    std::vector<PovShapeInfo> povShapes;
 
155
    
 
156
    //For formatted output
 
157
        String outbuf;
 
158
 
 
159
    //For statistics
 
160
    int nrNodes;
 
161
    int nrSegments;
 
162
    int nrShapes;
39
163
 
40
164
};
41
165
 
42
166
 
43
167
 
44
168
 
45
 
}  //namespace Internal
46
 
}  //namespace Extension
47
 
}  //namespace Inkscape
 
169
}  // namespace Internal
 
170
}  // namespace Extension
 
171
}  // namespace Inkscape
48
172
 
49
173
 
50
174