diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-09-02 22:14:59 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-09-02 22:14:59 +0000 |
| commit | d59a51e55765fd636cc8683fedb5e908a9ef02e4 (patch) | |
| tree | 8e9fe51d394993a173753963db4d4d664071b65c /src/svg/svg-path.cpp | |
| parent | Fixed forgotten variable assignment (diff) | |
| download | inkscape-d59a51e55765fd636cc8683fedb5e908a9ef02e4.tar.gz inkscape-d59a51e55765fd636cc8683fedb5e908a9ef02e4.zip | |
add method to write single paths to svg
(bzr r6756)
Diffstat (limited to 'src/svg/svg-path.cpp')
| -rw-r--r-- | src/svg/svg-path.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp index 12b282577..81eb7da59 100644 --- a/src/svg/svg-path.cpp +++ b/src/svg/svg-path.cpp @@ -784,20 +784,32 @@ static void sp_svg_write_curve(Inkscape::SVG::PathString & str, Geom::Curve cons } } +static void sp_svg_write_path(Inkscape::SVG::PathString & str, Geom::Path const & p) { + str.moveTo( p.initialPoint()[0], p.initialPoint()[1] ); + + for(Geom::Path::const_iterator cit = p.begin(); cit != p.end_open(); cit++) { + sp_svg_write_curve(str, &(*cit)); + } + + if (p.closed()) { + str.closePath(); + } +} + gchar * sp_svg_write_path(Geom::PathVector const &p) { Inkscape::SVG::PathString str; for(Geom::PathVector::const_iterator pit = p.begin(); pit != p.end(); pit++) { - str.moveTo( pit->initialPoint()[0], pit->initialPoint()[1] ); + sp_svg_write_path(str, *pit); + } - for(Geom::Path::const_iterator cit = pit->begin(); cit != pit->end_open(); cit++) { - sp_svg_write_curve(str, &(*cit)); - } + return g_strdup(str.c_str()); +} - if (pit->closed()) { - str.closePath(); - } - } +gchar * sp_svg_write_path(Geom::Path const &p) { + Inkscape::SVG::PathString str; + + sp_svg_write_path(str, p); return g_strdup(str.c_str()); } |
