diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-08-14 20:54:48 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-08-14 20:54:48 +0000 |
| commit | 55d43e4e27e0ba58a47fad70957dfa989aa173ad (patch) | |
| tree | 2ccfbac1c50023d08ae32975c876fa2478c1ad2a /src/sp-star.cpp | |
| parent | Fix for bug #1752113; added set_preview_widget_active(false) to FileSaveDialo... (diff) | |
| download | inkscape-55d43e4e27e0ba58a47fad70957dfa989aa173ad.tar.gz inkscape-55d43e4e27e0ba58a47fad70957dfa989aa173ad.zip | |
Commit LivePathEffect branch to trunk!
(disabled extension/internal/bitmap/*.* in build.xml to fix compilation)
(bzr r3472)
Diffstat (limited to 'src/sp-star.cpp')
| -rw-r--r-- | src/sp-star.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/sp-star.cpp b/src/sp-star.cpp index ea2525054..767175e87 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -38,6 +38,7 @@ static gchar * sp_star_description (SPItem * item); static void sp_star_snappoints(SPItem const *item, SnapPointsIter p); static void sp_star_set_shape (SPShape *shape); +static void sp_star_update_patheffect (SPShape *shape, bool write); static SPShapeClass *parent_class; @@ -88,6 +89,7 @@ sp_star_class_init (SPStarClass *klass) item_class->snappoints = sp_star_snappoints; shape_class->set_shape = sp_star_set_shape; + shape_class->update_patheffect = sp_star_update_patheffect; } static void @@ -269,6 +271,30 @@ sp_star_update (SPObject *object, SPCtx *ctx, guint flags) ((SPObjectClass *) parent_class)->update (object, ctx, flags); } +static void +sp_star_update_patheffect(SPShape *shape, bool write) +{ + sp_star_set_shape(shape); + + if (write) { + Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape); + if ( shape->curve != NULL ) { + NArtBpath *abp = sp_curve_first_bpath(shape->curve); + if (abp) { + gchar *str = sp_svg_write_path(abp); + repr->setAttribute("d", str); + g_free(str); + } else { + repr->setAttribute("d", ""); + } + } else { + repr->setAttribute("d", NULL); + } + } + + ((SPObject *)shape)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); +} + static gchar * sp_star_description (SPItem *item) { @@ -470,9 +496,10 @@ sp_star_set_shape (SPShape *shape) } } - sp_curve_closepath (c); - sp_shape_set_curve_insync (SP_SHAPE (star), c, TRUE); - sp_curve_unref (c); + sp_curve_closepath (c); + sp_shape_perform_path_effect(c, SP_SHAPE (star)); + sp_shape_set_curve_insync (SP_SHAPE (star), c, TRUE); + sp_curve_unref (c); } void |
