Code

struct SPCurve => class SPCurve
authorjohanengelen <johanengelen@users.sourceforge.net>
Mon, 5 May 2008 19:00:20 +0000 (19:00 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Mon, 5 May 2008 19:00:20 +0000 (19:00 +0000)
change all sp_curve_methods functions to SPCurve::methods.

40 files changed:
src/box3d-side.cpp
src/connector-context.cpp
src/display/canvas-bpath.cpp
src/display/curve.cpp
src/display/curve.h
src/display/nr-arena-shape.cpp
src/draw-context.cpp
src/dropper-context.cpp
src/dyna-draw-context.cpp
src/eraser-context.cpp
src/extension/internal/odf.cpp
src/extension/internal/pov-out.cpp
src/libnrtype/Layout-TNG-Output.cpp
src/live_effects/lpe-spiro.cpp
src/live_effects/parameter/path.cpp
src/node-context.cpp
src/nodepath.cpp
src/object-snapper.cpp
src/path-chemistry.cpp
src/pen-context.cpp
src/pencil-context.cpp
src/rubberband.cpp
src/sp-conn-end-pair.cpp
src/sp-conn-end.cpp
src/sp-ellipse.cpp
src/sp-flowregion.cpp
src/sp-image.cpp
src/sp-line.cpp
src/sp-offset.cpp
src/sp-path.cpp
src/sp-polygon.cpp
src/sp-polyline.cpp
src/sp-rect.cpp
src/sp-shape.cpp
src/sp-spiral.cpp
src/sp-star.cpp
src/sp-use-reference.cpp
src/splivarot.cpp
src/tweak-context.cpp
src/verbs.cpp

index 632a697afbc051e59ad761c5f65e7b60b0d362ab..2fff9f7b5933586e89a05dedd60232e8efc8c9a2 100644 (file)
@@ -221,7 +221,7 @@ box3d_side_set_shape (SPShape *shape)
         return;
     }
 
-    SPCurve *c = sp_curve_new ();
+    SPCurve *c = new SPCurve();
     // TODO: Draw the correct quadrangle here
     //       To do this, determine the perspective of the box, the orientation of the side (e.g., XY-FRONT)
     //       compute the coordinates of the corners in P^3, project them onto the canvas, and draw the
@@ -230,15 +230,15 @@ box3d_side_set_shape (SPShape *shape)
     unsigned int corners[4];
     box3d_side_compute_corner_ids(side, corners);
 
-    sp_curve_moveto (c, box3d_get_corner_screen(box, corners[0]));
-    sp_curve_lineto (c, box3d_get_corner_screen(box, corners[1]));
-    sp_curve_lineto (c, box3d_get_corner_screen(box, corners[2]));
-    sp_curve_lineto (c, box3d_get_corner_screen(box, corners[3]));
+    c->moveto(box3d_get_corner_screen(box, corners[0]));
+    c->lineto(box3d_get_corner_screen(box, corners[1]));
+    c->lineto(box3d_get_corner_screen(box, corners[2]));
+    c->lineto(box3d_get_corner_screen(box, corners[3]));
 
-    sp_curve_closepath (c);
+    c->closepath();
     sp_lpe_item_perform_path_effect(SP_LPE_ITEM (side), c);
     sp_shape_set_curve_insync (SP_SHAPE (side), c, TRUE);
-    sp_curve_unref (c);
+    c->unref();
 }
 
 void
index d311cfabde9c6abbafa36ecfdef065724d6cc2ed..07e512e064aa6d85d0a3f9ac7eb08156b1cf298a 100644 (file)
@@ -275,10 +275,10 @@ sp_connector_context_setup(SPEventContext *ec)
     sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cc->red_bpath), 0x00000000,
             SP_WIND_RULE_NONZERO);
     /* Create red curve */
-    cc->red_curve = sp_curve_new_sized(4);
+    cc->red_curve = new SPCurve(4);
 
     /* Create green curve */
-    cc->green_curve = sp_curve_new_sized(64);
+    cc->green_curve = new SPCurve(64);
 
     // Notice the initial selection.
     cc_selection_changed(cc->selection, (gpointer) cc);
@@ -638,17 +638,17 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
             SPCurve *curve = (SP_SHAPE(path))->curve;
             if (cc->clickedhandle == cc->endpt_handle[0]) {
                 NR::Point o = cc->endpt_handle[1]->pos;
-                sp_curve_stretch_endpoints(curve, p * d2i, o * d2i);
+                curve->stretch_endpoints(p * d2i, o * d2i);
             }
             else {
                 NR::Point o = cc->endpt_handle[0]->pos;
-                sp_curve_stretch_endpoints(curve, o * d2i, p * d2i);
+                curve->stretch_endpoints(o * d2i, p * d2i);
             }
             sp_conn_adjust_path(path);
 
             // Copy this to the temporary visible path
-            cc->red_curve = sp_curve_copy(SP_SHAPE(path)->curve);
-            sp_curve_transform(cc->red_curve, i2d);
+            cc->red_curve = SP_SHAPE(path)->curve->copy();
+            cc->red_curve->transform(i2d);
 
             sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve);
             ret = TRUE;
@@ -772,7 +772,7 @@ cc_connector_rerouting_finish(SPConnectorContext *const cc, NR::Point *const p)
     SPDocument *doc = sp_desktop_document(desktop);
     
     // Clear the temporary path:
-    sp_curve_reset(cc->red_curve);
+    cc->red_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), NULL);
 
     if (p != NULL)
@@ -805,10 +805,10 @@ static void
 spcc_reset_colors(SPConnectorContext *cc)
 {
     /* Red */
-    sp_curve_reset(cc->red_curve);
+    cc->red_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), NULL);
 
-    sp_curve_reset(cc->green_curve);
+    cc->green_curve->reset();
     cc->npoints = 0;
 }
 
@@ -849,15 +849,15 @@ spcc_connector_set_subsequent_point(SPConnectorContext *const cc, NR::Point cons
     Avoid::PolyLine route = cc->newConnRef->route();
     cc->newConnRef->calcRouteDist();
 
-    sp_curve_reset(cc->red_curve);
+    cc->red_curve->reset();
     NR::Point pt(route.ps[0].x, route.ps[0].y);
-    sp_curve_moveto(cc->red_curve, pt);
+    cc->red_curve->moveto(pt);
 
     for (int i = 1; i < route.pn; ++i) {
         NR::Point p(route.ps[i].x, route.ps[i].y);
-        sp_curve_lineto(cc->red_curve, p);
+        cc->red_curve->lineto(p);
     }
-    sp_curve_transform(cc->red_curve, dt->doc2dt());
+    cc->red_curve->transform(dt->doc2dt());
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve);
 }
 
@@ -871,19 +871,19 @@ static void
 spcc_concat_colors_and_flush(SPConnectorContext *cc)
 {
     SPCurve *c = cc->green_curve;
-    cc->green_curve = sp_curve_new_sized(64);
+    cc->green_curve = new SPCurve(64);
 
-    sp_curve_reset(cc->red_curve);
+    cc->red_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), NULL);
 
-    if (sp_curve_empty(c)) {
-        sp_curve_unref(c);
+    if (c->is_empty()) {
+        c->unref();
         return;
     }
 
     spcc_flush_white(cc, c);
 
-    sp_curve_unref(c);
+    c->unref();
 }
 
 
@@ -902,20 +902,19 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc)
 
     if (gc) {
         c = gc;
-        sp_curve_ref(c);
+        c->ref();
     } else {
         return;
     }
 
     /* Now we have to go back to item coordinates at last */
-    sp_curve_transform(c,
-            sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc)));
+    c->transform(sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(cc)));
 
     SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(cc);
     SPDocument *doc = sp_desktop_document(desktop);
     Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
 
-    if ( c && !sp_curve_empty(c) ) {
+    if ( c && !c->is_empty() ) {
         /* We actually have something to write */
 
         Inkscape::XML::Node *repr = xml_doc->createElement("svg:path");
@@ -958,7 +957,7 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc)
         cc->newconn->updateRepr();
     }
 
-    sp_curve_unref(c);
+    c->unref();
 
     /* Flush pending updates */
     sp_document_done(doc, SP_VERB_CONTEXT_CONNECTOR, _("Create connector"));
@@ -969,14 +968,14 @@ spcc_flush_white(SPConnectorContext *cc, SPCurve *gc)
 static void
 spcc_connector_finish_segment(SPConnectorContext *const cc, NR::Point const /*p*/)
 {
-    if (!sp_curve_empty(cc->red_curve)) {
-        sp_curve_append_continuous(cc->green_curve, cc->red_curve, 0.0625);
+    if (!cc->red_curve->is_empty()) {
+        cc->green_curve->append_continuous(cc->red_curve, 0.0625);
 
         cc->p[0] = cc->p[3];
         cc->p[1] = cc->p[4];
         cc->npoints = 2;
 
-        sp_curve_reset(cc->red_curve);
+        cc->red_curve->reset();
     }
 }
 
@@ -987,7 +986,7 @@ spcc_connector_finish(SPConnectorContext *const cc)
     SPDesktop *const desktop = cc->desktop;
     desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Finishing connector"));
 
-    sp_curve_reset(cc->red_curve);
+    cc->red_curve->reset();
     spcc_concat_colors_and_flush(cc);
 
     cc->npoints = 0;
@@ -1078,11 +1077,10 @@ endpt_handler(SPKnot */*knot*/, GdkEvent *event, SPConnectorContext *cc)
                 }
 
                 // Show the red path for dragging.
-                cc->red_curve = sp_curve_copy(SP_PATH(cc->clickeditem)->curve);
+                cc->red_curve = SP_PATH(cc->clickeditem)->curve->copy();
                 NR::Matrix i2d = sp_item_i2d_affine(cc->clickeditem);
-                sp_curve_transform(cc->red_curve, i2d);
-                sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath),
-                        cc->red_curve);
+                cc->red_curve->transform(i2d);
+                sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(cc->red_bpath), cc->red_curve);
 
                 cc->clickeditem->setHidden(true);
 
@@ -1172,10 +1170,10 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item)
     if (cc->active_conn == item)
     {
         // Just adjust handle positions.
-        NR::Point startpt = sp_curve_first_point(curve) * i2d;
+        NR::Point startpt = curve->first_point() * i2d;
         sp_knot_set_position(cc->endpt_handle[0], &startpt, 0);
 
-        NR::Point endpt = sp_curve_last_point(curve) * i2d;
+        NR::Point endpt = curve->last_point() * i2d;
         sp_knot_set_position(cc->endpt_handle[1], &endpt, 0);
 
         return;
@@ -1239,10 +1237,10 @@ cc_set_active_conn(SPConnectorContext *cc, SPItem *item)
                 G_CALLBACK(endpt_handler), cc);
     }
 
-    NR::Point startpt = sp_curve_first_point(curve) * i2d;
+    NR::Point startpt = curve->first_point() * i2d;
     sp_knot_set_position(cc->endpt_handle[0], &startpt, 0);
 
-    NR::Point endpt = sp_curve_last_point(curve) * i2d;
+    NR::Point endpt = curve->last_point() * i2d;
     sp_knot_set_position(cc->endpt_handle[1], &endpt, 0);
 
     sp_knot_show(cc->endpt_handle[0]);
index ed317722cfac51283f888c7af560f4982f249149..6aa4136237ecddd8c0957914b0594b079475bc74 100644 (file)
@@ -103,7 +103,7 @@ sp_canvas_bpath_destroy (GtkObject *object)
         cbp->stroke_shp = NULL;
     }
     if (cbp->curve) {
-        cbp->curve = sp_curve_unref (cbp->curve);
+        cbp->curve = cbp->curve->unref();
     }
 
     if (GTK_OBJECT_CLASS (parent_class)->destroy)
@@ -272,11 +272,11 @@ sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve)
     g_return_if_fail (SP_IS_CANVAS_BPATH (cbp));
 
     if (cbp->curve) {
-        cbp->curve = sp_curve_unref (cbp->curve);
+        cbp->curve = cbp->curve->unref();
     }
 
     if (curve) {
-        cbp->curve = sp_curve_ref (curve);
+        cbp->curve = curve->ref();
     }
 
     sp_canvas_item_request_update (SP_CANVAS_ITEM (cbp));
index 8868107bc770d0bae52c11fd9d5b31bccb8393d0..e97b097443c6f040f4456a919e26842d667a5c32 100644 (file)
  * Copyright (C) 2000 Lauris Kaplinski
  * Copyright (C) 2000-2001 Ximian, Inc.
  * Copyright (C) 2002 Lauris Kaplinski
+ * Copyright (C) 2008 Johan Engelen
  *
  * Released under GNU GPL
  */
 
+#include <display/curve.h>
+
 #include <string.h>
 #include <glib/gmem.h>
-#include <display/curve.h>
+#include "libnr/nr-point.h"
+#include "libnr/nr-rect.h"
 #include <libnr/n-art-bpath.h>
 #include <libnr/nr-point-matrix-ops.h>
 #include <libnr/nr-translate-ops.h>
 #include <cstring>
 #include <string>
 
-#define SP_CURVE_LENSTEP 32
-
 static unsigned sp_bpath_length(NArtBpath const bpath[]);
 static bool sp_bpath_closed(NArtBpath const bpath[]);
 
 /* Constructors */
 
 /**
- * The returned curve's state is as if sp_curve_reset has just been called on it.
- */
-SPCurve *
-sp_curve_new()
-{
-    return sp_curve_new_sized(SP_CURVE_LENSTEP);
-}
-
-/**
- * Like sp_curve_new, but overriding the default initial capacity.
- *
- * The returned curve's state is as if sp_curve_reset has just been called on it.
- *
+ * The returned curve's state is as if SPCurve::reset has just been called on it.
  * \param length Initial number of NArtBpath elements allocated for bpath (including NR_END
  *    element).
  */
-SPCurve *
-sp_curve_new_sized(gint length)
+SPCurve::SPCurve(gint length)
+  : refcount(1),
+    _bpath(NULL),
+    end(0),
+    length(length),
+    substart(0),
+    hascpt(false),
+    posSet(false),
+    moving(false),
+    closed(false)
 {
-    g_return_val_if_fail(length > 0, NULL);
-
-    SPCurve *curve = g_new(SPCurve, 1);
-
-    curve->refcount = 1;
-    curve->_bpath = g_new(NArtBpath, length);
-    curve->_bpath->code = NR_END;
-    curve->end = 0;
-    curve->length = length;
-    curve->substart = 0;
-    curve->hascpt = false;
-    curve->posSet = false;
-    curve->moving = false;
-    curve->closed = false;
+    if (length <= 0) {
+        g_error("SPCurve::SPCurve called with invalid length parameter");
+        throw;
+    }
 
-    return curve;
+    _bpath = g_new(NArtBpath, length);
+    _bpath->code = NR_END;
 }
 
-/**
- * Convert NArtBpath object to SPCurve object.
- *
- * \return new SPCurve, or NULL if the curve was not created for some reason.
- */
 SPCurve *
-sp_curve_new_from_bpath(NArtBpath *bpath)
-{
-    g_return_val_if_fail(bpath != NULL, NULL);
-
-    SPCurve *curve = sp_curve_new_from_foreign_bpath(bpath);
-    g_free(bpath);
-    return curve;
-}
-
-/**
- * Convert const NArtBpath array to SPCurve.
- *
- * \return new SPCurve, or NULL if the curve was not created for some reason.
- */
-SPCurve *sp_curve_new_from_foreign_bpath(NArtBpath const bpath[])
+SPCurve::new_from_foreign_bpath(NArtBpath const *bpath)
 {
     g_return_val_if_fail(bpath != NULL, NULL);
 
@@ -98,9 +68,8 @@ SPCurve *sp_curve_new_from_foreign_bpath(NArtBpath const bpath[])
     new_bpath = g_new(NArtBpath, len);
     memcpy(new_bpath, bpath, len * sizeof(NArtBpath));
 
-    SPCurve *curve = g_new(SPCurve, 1);
+    SPCurve *curve = new SPCurve();
 
-    curve->refcount = 1;
     curve->_bpath = new_bpath;
     curve->length = len;
     curve->end = curve->length - 1;
@@ -110,44 +79,67 @@ SPCurve *sp_curve_new_from_foreign_bpath(NArtBpath const bpath[])
             (curve->_bpath[i].code == NR_MOVETO_OPEN))
             break;
     curve->substart = i;
-    curve->hascpt = false;
-    curve->posSet = false;
-    curve->moving = false;
     curve->closed = sp_bpath_closed(new_bpath);
 
     return curve;
 }
 
-SPCurve *sp_curve_new_from_rect(NR::Maybe<NR::Rect> const &rect)
+/**
+ * Convert NArtBpath object to SPCurve object.
+ *
+ * \return new SPCurve, or NULL if the curve was not created for some reason.
+ */
+SPCurve *
+SPCurve::new_from_bpath(NArtBpath *bpath)
+{
+    g_return_val_if_fail(bpath != NULL, NULL);
+
+    SPCurve *curve = SPCurve::new_from_foreign_bpath(bpath);
+    g_free(bpath);
+    return curve;
+}
+
+SPCurve *
+SPCurve::new_from_rect(NR::Maybe<NR::Rect> const &rect)
 {
     g_return_val_if_fail(rect, NULL);
 
-    SPCurve *c = sp_curve_new();
+    SPCurve *c =  new SPCurve();
 
     NR::Point p = rect->corner(0);
-    sp_curve_moveto(c, p);
+    c->moveto(p);
 
     for (int i=3; i>=0; i--) {
-        sp_curve_lineto(c, rect->corner(i));
+        c->lineto(rect->corner(i));
     }
-    sp_curve_closepath_current(c);
+    c->closepath_current();
 
     return c;
 }
 
+SPCurve::~SPCurve()
+{
+    if (_bpath) {
+        g_free(_bpath);
+        _bpath = NULL;
+    }
+}
+
+/* Methods */
+
 /**
  * Increase refcount of curve.
  *
  * \todo should this be shared with other refcounting code?
  */
 SPCurve *
-sp_curve_ref(SPCurve *curve)
+SPCurve::ref()
 {
-    g_return_val_if_fail(curve != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
 
-    curve->refcount += 1;
+    refcount += 1;
 
-    return curve;
+    return this;
 }
 
 /**
@@ -156,17 +148,18 @@ sp_curve_ref(SPCurve *curve)
  * \todo should this be shared with other refcounting code?
  */
 SPCurve *
-sp_curve_unref(SPCurve *curve)
+SPCurve::unref()
 {
-    g_return_val_if_fail(curve != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
 
-    curve->refcount -= 1;
+    refcount -= 1;
 
-    if (curve->refcount < 1) {
-        if (curve->_bpath) {
-            g_free(curve->_bpath);
+    if (refcount < 1) {
+        if (_bpath) {
+            g_free(_bpath);
+            _bpath = NULL;
         }
-        g_free(curve);
+        delete this;
     }
 
     return NULL;
@@ -196,18 +189,18 @@ sp_curve_ensure_space(SPCurve *curve, gint space)
  * Create new curve from its own bpath array.
  */
 SPCurve *
-sp_curve_copy(SPCurve *curve)
+SPCurve::copy() const
 {
-    g_return_val_if_fail(curve != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
 
-    return sp_curve_new_from_foreign_bpath(curve->_bpath);
+    return SPCurve::new_from_foreign_bpath(_bpath);
 }
 
 /**
  * Return new curve that is the concatenation of all curves in list.
  */
 SPCurve *
-sp_curve_concat(GSList const *list)
+SPCurve::concat(GSList const *list)
 {
     g_return_val_if_fail(list != NULL, NULL);
 
@@ -218,7 +211,7 @@ sp_curve_concat(GSList const *list)
         length += c->end;
     }
 
-    SPCurve *new_curve = sp_curve_new_sized(length + 1);
+    SPCurve *new_curve = new SPCurve(length + 1);
 
     NArtBpath *bp = new_curve->_bpath;
 
@@ -247,20 +240,20 @@ sp_curve_concat(GSList const *list)
  * Returns a list of new curves corresponding to the subpaths in \a curve.
  */
 GSList *
-sp_curve_split(SPCurve const *curve)
+SPCurve::split() const
 {
-    g_return_val_if_fail(curve != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
 
     gint p = 0;
     GSList *l = NULL;
 
-    while (p < curve->end) {
+    while (p < end) {
         gint i = 1;
-        while ((curve->_bpath[p + i].code == NR_LINETO) ||
-               (curve->_bpath[p + i].code == NR_CURVETO))
+        while ((_bpath[p + i].code == NR_LINETO) ||
+               (_bpath[p + i].code == NR_CURVETO))
             i++;
-        SPCurve *new_curve = sp_curve_new_sized(i + 1);
-        memcpy(new_curve->_bpath, curve->_bpath + p, i * sizeof(NArtBpath));
+        SPCurve *new_curve = new SPCurve(i + 1);
+        memcpy(new_curve->_bpath, _bpath + p, i * sizeof(NArtBpath));
         new_curve->end = i;
         new_curve->_bpath[i].code = NR_END;
         new_curve->substart = 0;
@@ -307,208 +300,204 @@ tmpl_curve_transform(SPCurve *const curve, M const &m)
  * Transform all paths in curve using matrix.
  */
 void
-sp_curve_transform(SPCurve *const curve, NR::Matrix const &m)
+SPCurve::transform(NR::Matrix const &m)
 {
-    tmpl_curve_transform<NR::Matrix>(curve, m);
+    tmpl_curve_transform<NR::Matrix>(this, m);
 }
 
 /**
  * Transform all paths in curve using NR::translate.
  */
 void
-sp_curve_transform(SPCurve *const curve, NR::translate const &m)
+SPCurve::transform(NR::translate const &m)
 {
-    tmpl_curve_transform<NR::translate>(curve, m);
+    tmpl_curve_transform<NR::translate>(this, m);
 }
 
-
-/* Methods */
-
 /**
  * Set curve to empty curve.
  */
 void
-sp_curve_reset(SPCurve *curve)
+SPCurve::reset()
 {
-    g_return_if_fail(curve != NULL);
-
-    curve->_bpath->code = NR_END;
-    curve->end = 0;
-    curve->substart = 0;
-    curve->hascpt = false;
-    curve->posSet = false;
-    curve->moving = false;
-    curve->closed = false;
+    g_return_if_fail(this != NULL);
+
+    _bpath->code = NR_END;
+    end = 0;
+    substart = 0;
+    hascpt = false;
+    posSet = false;
+    moving = false;
+    closed = false;
 }
 
 /* Several consecutive movetos are ALLOWED */
 
 /**
- * Calls sp_curve_moveto() with point made of given coordinates.
+ * Calls SPCurve::moveto() with point made of given coordinates.
  */
 void
-sp_curve_moveto(SPCurve *curve, gdouble x, gdouble y)
+SPCurve::moveto(gdouble x, gdouble y)
 {
-    sp_curve_moveto(curve, NR::Point(x, y));
+    moveto(NR::Point(x, y));
 }
 
 /**
  * Perform a moveto to a point, thus starting a new subpath.
  */
 void
-sp_curve_moveto(SPCurve *curve, NR::Point const &p)
+SPCurve::moveto(NR::Point const &p)
 {
-    g_return_if_fail(curve != NULL);
-    g_return_if_fail(!curve->moving);
+    g_return_if_fail(this != NULL);
+    g_return_if_fail(!moving);
 
-    curve->substart = curve->end;
-    curve->hascpt = true;
-    curve->posSet = true;
-    curve->movePos = p;
+    substart = end;
+    hascpt = true;
+    posSet = true;
+    movePos = p;
 }
 
 /**
- * Calls sp_curve_lineto() with a point's coordinates.
+ * Calls SPCurve::lineto() with a point's coordinates.
  */
 void
-sp_curve_lineto(SPCurve *curve, NR::Point const &p)
+SPCurve::lineto(NR::Point const &p)
 {
-    sp_curve_lineto(curve, p[NR::X], p[NR::Y]);
+    lineto(p[NR::X], p[NR::Y]);
 }
 
 /**
  * Adds a line to the current subpath.
  */
 void
-sp_curve_lineto(SPCurve *curve, gdouble x, gdouble y)
+SPCurve::lineto(gdouble x, gdouble y)
 {
-    g_return_if_fail(curve != NULL);
-    g_return_if_fail(curve->hascpt);
+    g_return_if_fail(this != NULL);
+    g_return_if_fail(hascpt);
 
-    if (curve->moving) {
+    if (moving) {
         /* fix endpoint */
-        g_return_if_fail(!curve->posSet);
-        g_return_if_fail(curve->end > 1);
-        NArtBpath *bp = curve->_bpath + curve->end - 1;
+        g_return_if_fail(!posSet);
+        g_return_if_fail(end > 1);
+        NArtBpath *bp = _bpath + end - 1;
         g_return_if_fail(bp->code == NR_LINETO);
         bp->x3 = x;
         bp->y3 = y;
-        curve->moving = false;
+        moving = false;
         return;
     }
 
-    if (curve->posSet) {
+    if (posSet) {
         /* start a new segment */
-        sp_curve_ensure_space(curve, 2);
-        NArtBpath *bp = curve->_bpath + curve->end;
+        sp_curve_ensure_space(this, 2);
+        NArtBpath *bp = _bpath + end;
         bp->code = NR_MOVETO_OPEN;
-        bp->setC(3, curve->movePos);
+        bp->setC(3, movePos);
         bp++;
         bp->code = NR_LINETO;
         bp->x3 = x;
         bp->y3 = y;
         bp++;
         bp->code = NR_END;
-        curve->end += 2;
-        curve->posSet = false;
-        curve->closed = false;
+        end += 2;
+        posSet = false;
+        closed = false;
         return;
     }
 
     /* add line */
 
-    g_return_if_fail(curve->end > 1);
-    sp_curve_ensure_space(curve, 1);
-    NArtBpath *bp = curve->_bpath + curve->end;
+    g_return_if_fail(end > 1);
+    sp_curve_ensure_space(this, 1);
+    NArtBpath *bp = _bpath + end;
     bp->code = NR_LINETO;
     bp->x3 = x;
     bp->y3 = y;
     bp++;
     bp->code = NR_END;
-    curve->end++;
+    end++;
 }
 
 /// Unused
 void
-sp_curve_lineto_moving(SPCurve *curve, gdouble x, gdouble y)
+SPCurve::lineto_moving(gdouble x, gdouble y)
 {
-    g_return_if_fail(curve != NULL);
-    g_return_if_fail(curve->hascpt);
+    g_return_if_fail(this != NULL);
+    g_return_if_fail(hascpt);
 
-    if (curve->moving) {
+    if (moving) {
         /* change endpoint */
-        g_return_if_fail(!curve->posSet);
-        g_return_if_fail(curve->end > 1);
-        NArtBpath *bp = curve->_bpath + curve->end - 1;
+        g_return_if_fail(!posSet);
+        g_return_if_fail(end > 1);
+        NArtBpath *bp = _bpath + end - 1;
         g_return_if_fail(bp->code == NR_LINETO);
         bp->x3 = x;
         bp->y3 = y;
         return;
     }
 
-    if (curve->posSet) {
+    if (posSet) {
         /* start a new segment */
-        sp_curve_ensure_space(curve, 2);
-        NArtBpath *bp = curve->_bpath + curve->end;
+        sp_curve_ensure_space(this, 2);
+        NArtBpath *bp = _bpath + end;
         bp->code = NR_MOVETO_OPEN;
-        bp->setC(3, curve->movePos);
+        bp->setC(3, movePos);
         bp++;
         bp->code = NR_LINETO;
         bp->x3 = x;
         bp->y3 = y;
         bp++;
         bp->code = NR_END;
-        curve->end += 2;
-        curve->posSet = false;
-        curve->moving = true;
-        curve->closed = false;
+        end += 2;
+        posSet = false;
+        moving = true;
+        closed = false;
         return;
     }
 
     /* add line */
 
-    g_return_if_fail(curve->end > 1);
-    sp_curve_ensure_space(curve, 1);
-    NArtBpath *bp = curve->_bpath + curve->end;
+    g_return_if_fail(end > 1);
+    sp_curve_ensure_space(this, 1);
+    NArtBpath *bp = _bpath + end;
     bp->code = NR_LINETO;
     bp->x3 = x;
     bp->y3 = y;
     bp++;
     bp->code = NR_END;
-    curve->end++;
-    curve->moving = true;
+    end++;
+    moving = true;
 }
 
 /**
- * Calls sp_curve_curveto() with coordinates of three points.
+ * Calls SPCurve::curveto() with coordinates of three points.
  */
 void
-sp_curve_curveto(SPCurve *curve, NR::Point const &p0, NR::Point const &p1, NR::Point const &p2)
+SPCurve::curveto(NR::Point const &p0, NR::Point const &p1, NR::Point const &p2)
 {
     using NR::X;
     using NR::Y;
-    sp_curve_curveto(curve,
-                     p0[X], p0[Y],
-                     p1[X], p1[Y],
-                     p2[X], p2[Y]);
+    curveto( p0[X], p0[Y],
+             p1[X], p1[Y],
+             p2[X], p2[Y] );
 }
 
 /**
  * Adds a bezier segment to the current subpath.
  */
 void
-sp_curve_curveto(SPCurve *curve, gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2)
+SPCurve::curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2)
 {
-    g_return_if_fail(curve != NULL);
-    g_return_if_fail(curve->hascpt);
-    g_return_if_fail(!curve->moving);
+    g_return_if_fail(this != NULL);
+    g_return_if_fail(hascpt);
+    g_return_if_fail(!moving);
 
-    if (curve->posSet) {
+    if (posSet) {
         /* start a new segment */
-        sp_curve_ensure_space(curve, 2);
-        NArtBpath *bp = curve->_bpath + curve->end;
+        sp_curve_ensure_space(this, 2);
+        NArtBpath *bp = _bpath + end;
         bp->code = NR_MOVETO_OPEN;
-        bp->setC(3, curve->movePos);
+        bp->setC(3, movePos);
         bp++;
         bp->code = NR_CURVETO;
         bp->x1 = x0;
@@ -519,17 +508,17 @@ sp_curve_curveto(SPCurve *curve, gdouble x0, gdouble y0, gdouble x1, gdouble y1,
         bp->y3 = y2;
         bp++;
         bp->code = NR_END;
-        curve->end += 2;
-        curve->posSet = false;
-        curve->closed = false;
+        end += 2;
+        posSet = false;
+        closed = false;
         return;
     }
 
     /* add curve */
 
-    g_return_if_fail(curve->end > 1);
-    sp_curve_ensure_space(curve, 1);
-    NArtBpath *bp = curve->_bpath + curve->end;
+    g_return_if_fail(end > 1);
+    sp_curve_ensure_space(this, 1);
+    NArtBpath *bp = _bpath + end;
     bp->code = NR_CURVETO;
     bp->x1 = x0;
     bp->y1 = y0;
@@ -539,178 +528,178 @@ sp_curve_curveto(SPCurve *curve, gdouble x0, gdouble y0, gdouble x1, gdouble y1,
     bp->y3 = y2;
     bp++;
     bp->code = NR_END;
-    curve->end++;
+    end++;
 }
 
 /**
  * Close current subpath by possibly adding a line between start and end.
  */
 void
-sp_curve_closepath(SPCurve *curve)
+SPCurve::closepath()
 {
-    g_return_if_fail(curve != NULL);
-    g_return_if_fail(curve->hascpt);
-    g_return_if_fail(!curve->posSet);
-    g_return_if_fail(!curve->moving);
-    g_return_if_fail(!curve->closed);
+    g_return_if_fail(this != NULL);
+    g_return_if_fail(hascpt);
+    g_return_if_fail(!posSet);
+    g_return_if_fail(!moving);
+    g_return_if_fail(!closed);
     /* We need at least moveto, curveto, end. */
-    g_return_if_fail(curve->end - curve->substart > 1);
+    g_return_if_fail(end - substart > 1);
 
     {
-        NArtBpath *bs = curve->_bpath + curve->substart;
-        NArtBpath *be = curve->_bpath + curve->end - 1;
+        NArtBpath *bs = _bpath + substart;
+        NArtBpath *be = _bpath + end - 1;
 
         if (bs->c(3) != be->c(3)) {
-            sp_curve_lineto(curve, bs->c(3));
-            bs = curve->_bpath + curve->substart;
+            lineto(bs->c(3));
+            bs = _bpath + substart;
         }
 
         bs->code = NR_MOVETO;
     }
-    curve->closed = true;
+    closed = true;
 
-    for (NArtBpath const *bp = curve->_bpath; bp->code != NR_END; bp++) {
+    for (NArtBpath const *bp = _bpath; bp->code != NR_END; bp++) {
         /** \todo
          * effic: Maintain a count of NR_MOVETO_OPEN's (e.g. instead of
          * the closed boolean).
          */
         if (bp->code == NR_MOVETO_OPEN) {
-            curve->closed = false;
+            closed = false;
             break;
         }
     }
 
-    curve->hascpt = false;
+    hascpt = false;
 }
 
-/** Like sp_curve_closepath() but sets the end point of the current
+/** Like SPCurve::closepath() but sets the end point of the current
     command to the subpath start point instead of adding a new lineto.
 
     Used for freehand drawing when the user draws back to the start point.
 **/
 void
-sp_curve_closepath_current(SPCurve *curve)
+SPCurve::closepath_current()
 {
-    g_return_if_fail(curve != NULL);
-    g_return_if_fail(curve->hascpt);
-    g_return_if_fail(!curve->posSet);
-    g_return_if_fail(!curve->closed);
+    g_return_if_fail(this != NULL);
+    g_return_if_fail(hascpt);
+    g_return_if_fail(!posSet);
+    g_return_if_fail(!closed);
     /* We need at least moveto, curveto, end. */
-    g_return_if_fail(curve->end - curve->substart > 1);
+    g_return_if_fail(end - substart > 1);
 
     {
-        NArtBpath *bs = curve->_bpath + curve->substart;
-        NArtBpath *be = curve->_bpath + curve->end - 1;
+        NArtBpath *bs = _bpath + substart;
+        NArtBpath *be = _bpath + end - 1;
 
         be->x3 = bs->x3;
         be->y3 = bs->y3;
 
         bs->code = NR_MOVETO;
     }
-    curve->closed = true;
+    closed = true;
 
-    for (NArtBpath const *bp = curve->_bpath; bp->code != NR_END; bp++) {
+    for (NArtBpath const *bp = _bpath; bp->code != NR_END; bp++) {
         /** \todo
          * effic: Maintain a count of NR_MOVETO_OPEN's (e.g. instead of
          * the closed boolean).
          */
         if (bp->code == NR_MOVETO_OPEN) {
-            curve->closed = false;
+            closed = false;
             break;
         }
     }
 
-    curve->hascpt = false;
-    curve->moving = false;
+    hascpt = false;
+    moving = false;
 }
 
 /**
  * True if no paths are in curve.
  */
 bool
-sp_curve_empty(SPCurve *curve)
+SPCurve::is_empty() const
 {
-    g_return_val_if_fail(curve != NULL, TRUE);
+    g_return_val_if_fail(this != NULL, TRUE);
 
-    return (curve->_bpath->code == NR_END);
+    return (_bpath->code == NR_END);
 }
 
 /**
  * Return last subpath or NULL.
  */
 NArtBpath *
-sp_curve_last_bpath(SPCurve const *curve)
+SPCurve::last_bpath() const
 {
-    g_return_val_if_fail(curve != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
 
-    if (curve->end == 0) {
+    if (end == 0) {
         return NULL;
     }
 
-    return curve->_bpath + curve->end - 1;
+    return _bpath + end - 1;
 }
 
 /**
  * Return first subpath or NULL.
  */
 NArtBpath *
-sp_curve_first_bpath(SPCurve const *curve)
+SPCurve::first_bpath() const
 {
-    g_return_val_if_fail(curve != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
 
-    if (curve->end == 0) {
+    if (end == 0) {
         return NULL;
     }
 
-    return curve->_bpath;
+    return _bpath;
 }
 
 /**
  * Return first point of first subpath or (0,0).
  */
 NR::Point
-sp_curve_first_point(SPCurve const *const curve)
+SPCurve::first_point() const
 {
-    NArtBpath *const bpath = sp_curve_first_bpath(curve);
+    NArtBpath *const bpath = first_bpath();
     g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
     return bpath->c(3);
 }
 
 /**
- * Return the second point of first subpath or curve->movePos if curve too short.
+ * Return the second point of first subpath or movePos if curve too short.
  */
 NR::Point
-sp_curve_second_point(SPCurve const *const curve)
+SPCurve::second_point() const
 {
-    g_return_val_if_fail(curve != NULL, NR::Point(0, 0));
+    g_return_val_if_fail(this != NULL, NR::Point(0, 0));
 
-    if (curve->end < 1) {
-        return curve->movePos;
+    if (end < 1) {
+        return movePos;
     }
 
     NArtBpath *bpath = NULL;
-    if (curve->end < 2) {
-        bpath = curve->_bpath;
+    if (end < 2) {
+        bpath = _bpath;
     } else {
-        bpath = curve->_bpath + 1;
+        bpath = _bpath + 1;
     }
     g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
     return bpath->c(3);
 }
 
 /**
- * Return the second-last point of last subpath or curve->movePos if curve too short.
+ * Return the second-last point of last subpath or movePos if curve too short.
  */
 NR::Point
-sp_curve_penultimate_point(SPCurve const *const curve)
+SPCurve::penultimate_point() const
 {
-    g_return_val_if_fail(curve != NULL, NR::Point(0, 0));
+    g_return_val_if_fail(this != NULL, NR::Point(0, 0));
 
-    if (curve->end < 2) {
-        return curve->movePos;
+    if (end < 2) {
+        return movePos;
     }
 
-    NArtBpath *const bpath = curve->_bpath + curve->end - 2;
+    NArtBpath *const bpath = _bpath + end - 2;
     g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
     return bpath->c(3);
 }
@@ -719,9 +708,9 @@ sp_curve_penultimate_point(SPCurve const *const curve)
  * Return last point of last subpath or (0,0).
  */
 NR::Point
-sp_curve_last_point(SPCurve const *const curve)
+SPCurve::last_point() const
 {
-    NArtBpath *const bpath = sp_curve_last_bpath(curve);
+    NArtBpath *const bpath = last_bpath();
     g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
     return bpath->c(3);
 }
@@ -738,19 +727,19 @@ is_moveto(NRPathcode const c)
  * with all its markers drawn facing the other direction.
  **/
 SPCurve *
-sp_curve_reverse(SPCurve const *curve)
+SPCurve::reverse() const
 {
     /* We need at least moveto, curveto, end. */
-    g_return_val_if_fail(curve->end - curve->substart > 1, NULL);
+    g_return_val_if_fail(end - substart > 1, NULL);
 
-    NArtBpath const *be = curve->_bpath + curve->end - 1;
+    NArtBpath const *be = _bpath + end - 1;
 
-    g_assert(is_moveto(curve->_bpath[curve->substart].code));
-    g_assert(is_moveto(curve->_bpath[0].code));
+    g_assert(is_moveto(_bpath[substart].code));
+    g_assert(is_moveto(_bpath[0].code));
     g_assert((be+1)->code == NR_END);
 
-    SPCurve  *new_curve = sp_curve_new_sized(curve->length);
-    sp_curve_moveto(new_curve, be->c(3));
+    SPCurve  *new_curve = new SPCurve(length);
+    new_curve->moveto(be->c(3));
 
     for (NArtBpath const *bp = be; ; --bp) {
         switch (bp->code) {
@@ -759,18 +748,18 @@ sp_curve_reverse(SPCurve const *curve)
                 new_curve->_bpath[new_curve->substart].code = NR_MOVETO;
                 /* FALL-THROUGH */
             case NR_MOVETO_OPEN:
-                if (bp == curve->_bpath) {
+                if (bp == _bpath) {
                     return new_curve;
                 }
-                sp_curve_moveto(new_curve, (bp-1)->c(3));
+                new_curve->moveto((bp-1)->c(3));
                 break;
 
             case NR_LINETO:
-                sp_curve_lineto(new_curve, (bp-1)->c(3));
+                new_curve->lineto((bp-1)->c(3));
                 break;
 
             case NR_CURVETO:
-                sp_curve_curveto(new_curve, bp->c(2), bp->c(1), (bp-1)->c(3));
+                new_curve->curveto(bp->c(2), bp->c(1), (bp-1)->c(3));
                 break;
 
             default:
@@ -783,11 +772,10 @@ sp_curve_reverse(SPCurve const *curve)
  * Append \a curve2 to \a curve.
  */
 void
-sp_curve_append(SPCurve *curve,
-                SPCurve const *curve2,
+SPCurve::append(SPCurve const *curve2,
                 bool use_lineto)
 {
-    g_return_if_fail(curve != NULL);
+    g_return_if_fail(this != NULL);
     g_return_if_fail(curve2 != NULL);
 
     if (curve2->end < 1)
@@ -795,38 +783,38 @@ sp_curve_append(SPCurve *curve,
 
     NArtBpath const *bs = curve2->_bpath;
 
-    bool closed = curve->closed;
+    bool _closed = this->closed;
 
     for (NArtBpath const *bp = bs; bp->code != NR_END; bp++) {
         switch (bp->code) {
             case NR_MOVETO_OPEN:
-                if (use_lineto && curve->hascpt) {
-                    sp_curve_lineto(curve, bp->x3, bp->y3);
+                if (use_lineto && hascpt) {
+                    lineto(bp->x3, bp->y3);
                     use_lineto = FALSE;
                 } else {
-                    if (closed) sp_curve_closepath(curve);
-                    sp_curve_moveto(curve, bp->x3, bp->y3);
+                    if (_closed) closepath();
+                    moveto(bp->x3, bp->y3);
                 }
-                closed = false;
+                _closed = false;
                 break;
 
             case NR_MOVETO:
-                if (use_lineto && curve->hascpt) {
-                    sp_curve_lineto(curve, bp->x3, bp->y3);
+                if (use_lineto && hascpt) {
+                    lineto(bp->x3, bp->y3);
                     use_lineto = FALSE;
                 } else {
-                    if (closed) sp_curve_closepath(curve);
-                    sp_curve_moveto(curve, bp->x3, bp->y3);
+                    if (_closed) closepath();
+                    moveto(bp->x3, bp->y3);
                 }
-                closed = true;
+                _closed = true;
                 break;
 
             case NR_LINETO:
-                sp_curve_lineto(curve, bp->x3, bp->y3);
+                lineto(bp->x3, bp->y3);
                 break;
 
             case NR_CURVETO:
-                sp_curve_curveto(curve, bp->x1, bp->y1, bp->x2, bp->y2, bp->x3, bp->y3);
+                curveto(bp->x1, bp->y1, bp->x2, bp->y2, bp->x3, bp->y3);
                 break;
 
             case NR_END:
@@ -834,29 +822,29 @@ sp_curve_append(SPCurve *curve,
         }
     }
 
-    if (closed) {
-        sp_curve_closepath(curve);
+    if (_closed) {
+        closepath();
     }
 }
 
 /**
- * Append \a c1 to \a c0 with possible fusing of close endpoints.
+ * Append \a c1 to \a this with possible fusing of close endpoints.
  */
 SPCurve *
-sp_curve_append_continuous(SPCurve *c0, SPCurve const *c1, gdouble tolerance)
+SPCurve::append_continuous(SPCurve const *c1, gdouble tolerance)
 {
-    g_return_val_if_fail(c0 != NULL, NULL);
+    g_return_val_if_fail(this != NULL, NULL);
     g_return_val_if_fail(c1 != NULL, NULL);
-    g_return_val_if_fail(!c0->closed, NULL);
+    g_return_val_if_fail(!closed, NULL);
     g_return_val_if_fail(!c1->closed, NULL);
 
     if (c1->end < 1) {
-        return c0;
+        return this;
     }
 
-    NArtBpath *be = sp_curve_last_bpath(c0);
+    NArtBpath *be = last_bpath();
     if (be) {
-        NArtBpath const *bs = sp_curve_first_bpath(c1);
+        NArtBpath const *bs = c1->first_bpath();
         if ( bs
              && ( fabs( bs->x3 - be->x3 ) <= tolerance )
              && ( fabs( bs->y3 - be->y3 ) <= tolerance ) )
@@ -865,62 +853,62 @@ sp_curve_append_continuous(SPCurve *c0, SPCurve const *c1, gdouble tolerance)
              * fixme: Strictly we mess in case of multisegment mixed
              * open/close curves
              */
-            bool closed = false;
+            bool _closed = false;
             for (bs = bs + 1; bs->code != NR_END; bs++) {
                 switch (bs->code) {
                     case NR_MOVETO_OPEN:
-                        if (closed) sp_curve_closepath(c0);
-                        sp_curve_moveto(c0, bs->x3, bs->y3);
-                        closed = false;
+                        if (_closed) closepath();
+                        moveto(bs->x3, bs->y3);
+                        _closed = false;
                         break;
                     case NR_MOVETO:
-                        if (closed) sp_curve_closepath(c0);
-                        sp_curve_moveto(c0, bs->x3, bs->y3);
-                        closed = true;
+                        if (_closed) closepath();
+                        moveto(bs->x3, bs->y3);
+                        _closed = true;
                         break;
                     case NR_LINETO:
-                        sp_curve_lineto(c0, bs->x3, bs->y3);
+                        lineto(bs->x3, bs->y3);
                         break;
                     case NR_CURVETO:
-                        sp_curve_curveto(c0, bs->x1, bs->y1, bs->x2, bs->y2, bs->x3, bs->y3);
+                        curveto(bs->x1, bs->y1, bs->x2, bs->y2, bs->x3, bs->y3);
                         break;
                     case NR_END:
                         g_assert_not_reached();
                 }
             }
         } else {
-            sp_curve_append(c0, c1, TRUE);
+            append(c1, TRUE);
         }
     } else {
-        sp_curve_append(c0, c1, TRUE);
+        append(c1, TRUE);
     }
 
-    return c0;
+    return this;
 }
 
 /**
  * Remove last segment of curve.
  */
 void
-sp_curve_backspace(SPCurve *curve)
+SPCurve::backspace()
 {
-    g_return_if_fail(curve != NULL);
+    g_return_if_fail(this != NULL);
 
-    if (curve->end > 0) {
-        curve->end -= 1;
-        if (curve->end > 0) {
-            NArtBpath *bp = curve->_bpath + curve->end - 1;
+    if (end > 0) {
+        end -= 1;
+        if (end > 0) {
+            NArtBpath *bp = _bpath + end - 1;
             if ((bp->code == NR_MOVETO)     ||
                 (bp->code == NR_MOVETO_OPEN)  )
             {
-                curve->hascpt = true;
-                curve->posSet = true;
-                curve->closed = false;
-                curve->movePos = bp->c(3);
-                curve->end -= 1;
+                hascpt = true;
+                posSet = true;
+                closed = false;
+                movePos = bp->c(3);
+                end -= 1;
             }
         }
-        curve->_bpath[curve->end].code = NR_END;
+        _bpath[end].code = NR_END;
     }
 }
 
@@ -1062,23 +1050,23 @@ sp_curve_nonzero_distance_including_space(SPCurve const *const curve, double seg
 }
 
 void
-sp_curve_stretch_endpoints(SPCurve *curve, NR::Point const &new_p0, NR::Point const &new_p1)
+SPCurve::stretch_endpoints(NR::Point const &new_p0, NR::Point const &new_p1)
 {
-    if (sp_curve_empty(curve)) {
+    if (is_empty()) {
         return;
     }
-    g_assert(unsigned(SP_CURVE_LENGTH(curve)) + 1 == sp_bpath_length(curve->_bpath));
-    unsigned const nSegs = SP_CURVE_LENGTH(curve) - 1;
+    g_assert(unsigned(SP_CURVE_LENGTH(this)) + 1 == sp_bpath_length(_bpath));
+    unsigned const nSegs = SP_CURVE_LENGTH(this) - 1;
     g_assert(nSegs != 0);
     double *const seg2len = new double[nSegs];
-    double const tot_len = sp_curve_nonzero_distance_including_space(curve, seg2len);
-    NR::Point const offset0( new_p0 - sp_curve_first_point(curve) );
-    NR::Point const offset1( new_p1 - sp_curve_last_point(curve) );
-    curve->_bpath->setC(3, new_p0);
+    double const tot_len = sp_curve_nonzero_distance_including_space(this, seg2len);
+    NR::Point const offset0( new_p0 - first_point() );
+    NR::Point const offset1( new_p1 - last_point() );
+    _bpath->setC(3, new_p0);
     double begin_dist = 0.;
     for (unsigned si = 0; si < nSegs; ++si) {
         double const end_dist = begin_dist + seg2len[si];
-        NArtBpath &p = curve->_bpath[1 + si];
+        NArtBpath &p = _bpath[1 + si];
         switch (p.code) {
             case NR_LINETO:
             case NR_MOVETO:
@@ -1098,24 +1086,23 @@ sp_curve_stretch_endpoints(SPCurve *curve, NR::Point const &new_p0, NR::Point co
 
         begin_dist = end_dist;
     }
-    g_assert(L1(curve->_bpath[nSegs].c(3) - new_p1) < 1.);
+    g_assert(L1(_bpath[nSegs].c(3) - new_p1) < 1.);
     /* Explicit set for better numerical properties. */
-    curve->_bpath[nSegs].setC(3, new_p1);
+    _bpath[nSegs].setC(3, new_p1);
     delete [] seg2len;
 }
 
 void
-sp_curve_move_endpoints(SPCurve *curve, NR::Point const &new_p0,
-        NR::Point const &new_p1)
+SPCurve::move_endpoints(NR::Point const &new_p0, NR::Point const &new_p1)
 {
-    if (sp_curve_empty(curve)) {
+    if (is_empty()) {
         return;
     }
-    unsigned const nSegs = SP_CURVE_LENGTH(curve) - 1;
+    unsigned const nSegs = SP_CURVE_LENGTH(this) - 1;
     g_assert(nSegs != 0);
 
-    curve->_bpath->setC(3, new_p0);
-    curve->_bpath[nSegs].setC(3, new_p1);
+    _bpath->setC(3, new_p0);
+    _bpath[nSegs].setC(3, new_p1);
 }
 
 
index 847d09f46628df9b483374b7126018c284a1285a..9cbb115292d2bb6dbef1f8a76b9fcd6464d6a486 100644 (file)
@@ -10,6 +10,7 @@
  * Copyright (C) 2000 Lauris Kaplinski
  * Copyright (C) 2000-2001 Ximian, Inc.
  * Copyright (C) 2002 Lauris Kaplinski
+ * Copyright (C) 2008 Johan Engelen
  *
  * Released under GNU GPL
  */
 #include <glib/gslist.h>
 
 #include "libnr/nr-forward.h"
-#include "libnr/nr-point.h"
 #include "libnr/nr-rect.h"
 
+#define SP_CURVE_LENSTEP 32
+
 /// Wrapper around NArtBpath.
-struct SPCurve {
+class SPCurve {
+public:
+    /* Constructors */
+    SPCurve(gint length = SP_CURVE_LENSTEP);
+    static SPCurve * new_from_bpath(NArtBpath *bpath);
+    static SPCurve * new_from_foreign_bpath(NArtBpath const *bpath);
+    static SPCurve * new_from_rect(NR::Maybe<NR::Rect> const &rect);
+
+    virtual ~SPCurve();
+
     gint refcount;
     NArtBpath *_bpath;
     
@@ -59,62 +70,56 @@ struct SPCurve {
     
     /// True iff all subpaths are closed.
     bool closed : 1;
+
+    SPCurve * ref();
+    SPCurve * unref();
+
+    SPCurve * copy() const;
+
+    GSList * split() const;
+    void transform(NR::Matrix const &);
+    void transform(NR::translate const &);
+    void stretch_endpoints(NR::Point const &, NR::Point const &);
+    void move_endpoints(NR::Point const &, NR::Point const &);
+
+    void reset();
+
+    void moveto(NR::Point const &p);
+    void moveto(gdouble x, gdouble y);
+    void lineto(NR::Point const &p);
+    void lineto(gdouble x, gdouble y);
+    void lineto_moving(gdouble x, gdouble y);
+    void curveto(NR::Point const &p0, NR::Point const &p1, NR::Point const &p2);
+    void curveto(gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
+    void closepath();
+    void closepath_current();
+
+    SPCurve * append_continuous(SPCurve const *c1, gdouble tolerance);
+
+    bool is_empty() const;
+    NArtBpath * last_bpath() const;
+    NArtBpath * first_bpath() const;
+    NR::Point first_point() const;
+    NR::Point last_point() const;
+    NR::Point second_point() const;
+    NR::Point penultimate_point() const;
+
+    void append(SPCurve const *curve2, bool use_lineto);
+    SPCurve * reverse() const;
+    void backspace();
+
+    static SPCurve * concat(GSList const *list);
+
+private:
+    // Don't implement these:
+    SPCurve(const SPCurve&);
+    SPCurve& operator=(const SPCurve&);
 };
 
 #define SP_CURVE_LENGTH(c) (((SPCurve const *)(c))->end)
 #define SP_CURVE_BPATH(c) (((SPCurve const *)(c))->_bpath)
 #define SP_CURVE_SEGMENT(c,i) (((SPCurve const *)(c))->_bpath + (i))
 
-/* Constructors */
-
-SPCurve *sp_curve_new();
-SPCurve *sp_curve_new_sized(gint length);
-SPCurve *sp_curve_new_from_bpath(NArtBpath *bpath);
-SPCurve *sp_curve_new_from_foreign_bpath(NArtBpath const bpath[]);
-SPCurve *sp_curve_new_from_rect(NR::Maybe<NR::Rect> const &rect);
-
-SPCurve *sp_curve_ref(SPCurve *curve);
-SPCurve *sp_curve_unref(SPCurve *curve);
-
-SPCurve *sp_curve_copy(SPCurve *curve);
-SPCurve *sp_curve_concat(GSList const *list);
-GSList *sp_curve_split(SPCurve const *curve);
-void sp_curve_transform(SPCurve *curve, NR::Matrix const &);
-void sp_curve_transform(SPCurve *curve, NR::translate const &);
-void sp_curve_stretch_endpoints(SPCurve *curve, NR::Point const &, NR::Point const &);
-void sp_curve_move_endpoints(SPCurve *curve, NR::Point const &,
-        NR::Point const &);
-
-/* Methods */
-
-void sp_curve_reset(SPCurve *curve);
-
-void sp_curve_moveto(SPCurve *curve, NR::Point const &p);
-void sp_curve_moveto(SPCurve *curve, gdouble x, gdouble y);
-void sp_curve_lineto(SPCurve *curve, NR::Point const &p);
-void sp_curve_lineto(SPCurve *curve, gdouble x, gdouble y);
-void sp_curve_lineto_moving(SPCurve *curve, gdouble x, gdouble y);
-void sp_curve_curveto(SPCurve *curve, NR::Point const &p0, NR::Point const &p1, NR::Point const &p2);
-void sp_curve_curveto(SPCurve *curve, gdouble x0, gdouble y0, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
-void sp_curve_closepath(SPCurve *curve);
-void sp_curve_closepath_current(SPCurve *curve);
-
-SPCurve *sp_curve_append_continuous(SPCurve *c0, SPCurve const *c1, gdouble tolerance);
-
-#define sp_curve_is_empty sp_curve_empty
-bool sp_curve_empty(SPCurve *curve);
-NArtBpath *sp_curve_last_bpath(SPCurve const *curve);
-NArtBpath *sp_curve_first_bpath(SPCurve const *curve);
-NR::Point sp_curve_first_point(SPCurve const *curve);
-NR::Point sp_curve_last_point(SPCurve const *curve);
-NR::Point sp_curve_second_point(SPCurve const *curve);
-NR::Point sp_curve_penultimate_point(SPCurve const *curve);
-
-void sp_curve_append(SPCurve *curve, SPCurve const *curve2, bool use_lineto);
-SPCurve *sp_curve_reverse(SPCurve const *curve);
-void sp_curve_backspace(SPCurve *curve);
-
-
 #endif /* !SEEN_DISPLAY_CURVE_H */
 
 /*
index 5676b3ce6b11f8903fb1860aae62fd3f152db907..4df93a9a2d1856a5a7cf1ca8ab8f8f1e8f22660d 100644 (file)
@@ -142,7 +142,7 @@ nr_arena_shape_finalize(NRObject *object)
     if (shape->stroke_painter) sp_painter_free(shape->stroke_painter);
 
     if (shape->style) sp_style_unref(shape->style);
-    if (shape->curve) sp_curve_unref(shape->curve);
+    if (shape->curve) shape->curve->unref();
 
     ((NRObjectClass *) shape_parent_class)->finalize(object);
 }
@@ -333,7 +333,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
 
     if (!shape->curve || 
         !shape->style ||
-        sp_curve_is_empty(shape->curve) ||
+        shape->curve->is_empty() ||
         (( shape->_fill.paint.type() == NRArenaShape::Paint::NONE ) &&
          ( shape->_stroke.paint.type() == NRArenaShape::Paint::NONE && !outline) ))
     {
@@ -1188,13 +1188,13 @@ void nr_arena_shape_set_path(NRArenaShape *shape, SPCurve *curve,bool justTrans)
     nr_arena_item_request_render(NR_ARENA_ITEM(shape));
 
     if (shape->curve) {
-        sp_curve_unref(shape->curve);
+        shape->curve->unref();
         shape->curve = NULL;
     }
 
     if (curve) {
         shape->curve = curve;
-        sp_curve_ref(curve);
+        curve->ref();
     }
 
     nr_arena_item_request_update(NR_ARENA_ITEM(shape), NR_ARENA_ITEM_STATE_ALL, FALSE);
index 05045e96993652859384e96c0af7f25457f990fd..b48b34ed03009648a2b2f978c3b98a383582b636 100644 (file)
@@ -164,16 +164,16 @@ sp_draw_context_setup(SPEventContext *ec)
     dc->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL);
     sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->red_bpath), dc->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
     /* Create red curve */
-    dc->red_curve = sp_curve_new_sized(4);
+    dc->red_curve = new SPCurve(4);
 
     /* Create blue bpath */
     dc->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL);
     sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->blue_bpath), dc->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
     /* Create blue curve */
-    dc->blue_curve = sp_curve_new_sized(8);
+    dc->blue_curve = new SPCurve(8);
 
     /* Create green curve */
-    dc->green_curve = sp_curve_new_sized(64);
+    dc->green_curve = new SPCurve(64);
     /* No green anchor by default */
     dc->green_anchor = NULL;
     dc->green_closed = FALSE;
@@ -280,10 +280,10 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/)
         /* Curve list */
         /* We keep it in desktop coordinates to eliminate calculation errors */
         SPCurve *norm = sp_path_get_curve_for_edit (SP_PATH(item));
-        sp_curve_transform(norm, sp_item_i2d_affine(dc->white_item));
+        norm->transform(sp_item_i2d_affine(dc->white_item));
         g_return_if_fail( norm != NULL );
-        dc->white_curves = g_slist_reverse(sp_curve_split(norm));
-        sp_curve_unref(norm);
+        dc->white_curves = g_slist_reverse(norm->split());
+        norm->unref();
         /* Anchor list */
         for (GSList *l = dc->white_curves; l != NULL; l = l->next) {
             SPCurve *c;
@@ -292,8 +292,8 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/)
             if ( SP_CURVE_BPATH(c)->code == NR_MOVETO_OPEN ) {
                 NArtBpath *s, *e;
                 SPDrawAnchor *a;
-                s = sp_curve_first_bpath(c);
-                e = sp_curve_last_bpath(c);
+                s = c->first_bpath();
+                e = c->last_bpath();
                 a = sp_draw_anchor_new(dc, c, TRUE, NR::Point(s->x3, s->y3));
                 dc->white_anchors = g_slist_prepend(dc->white_anchors, a);
                 a = sp_draw_anchor_new(dc, c, FALSE, NR::Point(e->x3, e->y3));
@@ -378,8 +378,8 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, NR::Point& p, guin
 static SPCurve *
 reverse_then_unref(SPCurve *orig)
 {
-    SPCurve *ret = sp_curve_reverse(orig);
-    sp_curve_unref(orig);
+    SPCurve *ret = orig->reverse();
+    orig->unref();
     return ret;
 }
 
@@ -395,24 +395,24 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
     SPCurve *c = dc->green_curve;
 
     /* Green */
-    dc->green_curve = sp_curve_new_sized(64);
+    dc->green_curve = new SPCurve(64);
     while (dc->green_bpaths) {
         gtk_object_destroy(GTK_OBJECT(dc->green_bpaths->data));
         dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data);
     }
     /* Blue */
-    sp_curve_append_continuous(c, dc->blue_curve, 0.0625);
-    sp_curve_reset(dc->blue_curve);
+    c->append_continuous(dc->blue_curve, 0.0625);
+    dc->blue_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue_bpath), NULL);
     /* Red */
     if (dc->red_curve_is_valid) {
-        sp_curve_append_continuous(c, dc->red_curve, 0.0625);
+        c->append_continuous(dc->red_curve, 0.0625);
     }
-    sp_curve_reset(dc->red_curve);
+    dc->red_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL);
 
-    if (sp_curve_empty(c)) {
-        sp_curve_unref(c);
+    if (c->is_empty()) {
+        c->unref();
         return;
     }
 
@@ -420,10 +420,10 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
     if ( forceclosed || ( dc->green_anchor && dc->green_anchor->active ) ) {
         // We hit green anchor, closing Green-Blue-Red
         SP_EVENT_CONTEXT_DESKTOP(dc)->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed."));
-        sp_curve_closepath_current(c);
+        c->closepath_current();
         /* Closed path, just flush */
         spdc_flush_white(dc, c);
-        sp_curve_unref(c);
+        c->unref();
         return;
     }
 
@@ -438,9 +438,9 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
         if (dc->sa->start && !(dc->sa->curve->closed) ) {
             c = reverse_then_unref(c);
         }
-        sp_curve_append_continuous(dc->sa->curve, c, 0.0625);
-        sp_curve_unref(c);
-        sp_curve_closepath_current(dc->sa->curve);
+        dc->sa->curve->append_continuous(c, 0.0625);
+        c->unref();
+        dc->sa->curve->closepath_current();
         spdc_flush_white(dc, NULL);
         return;
     }
@@ -452,8 +452,8 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
         if (dc->sa->start) {
             s = reverse_then_unref(s);
         }
-        sp_curve_append_continuous(s, c, 0.0625);
-        sp_curve_unref(c);
+        s->append_continuous(c, 0.0625);
+        c->unref();
         c = s;
     } else /* Step D - test end */ if (dc->ea) {
         SPCurve *e = dc->ea->curve;
@@ -461,14 +461,14 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
         if (!dc->ea->start) {
             e = reverse_then_unref(e);
         }
-        sp_curve_append_continuous(c, e, 0.0625);
-        sp_curve_unref(e);
+        c->append_continuous(e, 0.0625);
+        e->unref();
     }
 
 
     spdc_flush_white(dc, c);
 
-    sp_curve_unref(c);
+    c->unref();
 }
 
 static char const *
@@ -494,21 +494,21 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
 
     if (dc->white_curves) {
         g_assert(dc->white_item);
-        c = sp_curve_concat(dc->white_curves);
+        c = SPCurve::concat(dc->white_curves);
         g_slist_free(dc->white_curves);
         dc->white_curves = NULL;
         if (gc) {
-            sp_curve_append(c, gc, FALSE);
+            c->append(gc, FALSE);
         }
     } else if (gc) {
         c = gc;
-        sp_curve_ref(c);
+        c->ref();
     } else {
         return;
     }
 
     /* Now we have to go back to item coordinates at last */
-    sp_curve_transform(c, ( dc->white_item
+    c->transform(( dc->white_item
                             ? sp_item_dt2i_affine(dc->white_item)
                             : sp_desktop_dt2root_affine(SP_EVENT_CONTEXT_DESKTOP(dc)) ));
 
@@ -516,7 +516,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
     SPDocument *doc = sp_desktop_document(desktop);
     Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
 
-    if ( c && !sp_curve_empty(c) ) {
+    if ( c && !c->is_empty() ) {
         /* We actually have something to write */
 
         bool has_lpe = false;
@@ -558,7 +558,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
         spdc_selection_modified(sp_desktop_selection(desktop), 0, dc);
     }
 
-    sp_curve_unref(c);
+    c->unref();
 
     /* Flush pending updates */
     sp_document_ensure_up_to_date(doc);
@@ -595,7 +595,7 @@ spdc_reset_white(SPDrawContext *dc)
         dc->white_item = NULL;
     }
     while (dc->white_curves) {
-        sp_curve_unref((SPCurve *) dc->white_curves->data);
+        reinterpret_cast<SPCurve *>(dc->white_curves->data)->unref();
         dc->white_curves = g_slist_remove(dc->white_curves, dc->white_curves->data);
     }
     while (dc->white_anchors) {
@@ -613,7 +613,7 @@ spdc_free_colors(SPDrawContext *dc)
         dc->red_bpath = NULL;
     }
     if (dc->red_curve) {
-        dc->red_curve = sp_curve_unref(dc->red_curve);
+        dc->red_curve = dc->red_curve->unref();
     }
     /* Blue */
     if (dc->blue_bpath) {
@@ -621,7 +621,7 @@ spdc_free_colors(SPDrawContext *dc)
         dc->blue_bpath = NULL;
     }
     if (dc->blue_curve) {
-        dc->blue_curve = sp_curve_unref(dc->blue_curve);
+        dc->blue_curve = dc->blue_curve->unref();
     }
     /* Green */
     while (dc->green_bpaths) {
@@ -629,7 +629,7 @@ spdc_free_colors(SPDrawContext *dc)
         dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data);
     }
     if (dc->green_curve) {
-        dc->green_curve = sp_curve_unref(dc->green_curve);
+        dc->green_curve = dc->green_curve->unref();
     }
     if (dc->green_anchor) {
         dc->green_anchor = sp_draw_anchor_destroy(dc->green_anchor);
@@ -640,7 +640,7 @@ spdc_free_colors(SPDrawContext *dc)
         dc->white_item = NULL;
     }
     while (dc->white_curves) {
-        sp_curve_unref((SPCurve *) dc->white_curves->data);
+        reinterpret_cast<SPCurve *>(dc->white_curves->data)->unref();
         dc->white_curves = g_slist_remove(dc->white_curves, dc->white_curves->data);
     }
     while (dc->white_anchors) {
index 5a1178040c032e97149988e6126dcf11f6b08aef..81814fc01cd1e154e3219768da72c1562699aade 100644 (file)
@@ -111,9 +111,9 @@ static void sp_dropper_context_setup(SPEventContext *ec)
         ((SPEventContextClass *) parent_class)->setup(ec);
     }
 
-    SPCurve *c = sp_curve_new_from_foreign_bpath(spdc_circle);
+    SPCurve *c = SPCurve::new_from_foreign_bpath(spdc_circle);
     dc->area = sp_canvas_bpath_new(sp_desktop_controls(ec->desktop), c);
-    sp_curve_unref(c);
+    c->unref();
     sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(dc->area), 0x00000000,(SPWindRule)0);
     sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->area), 0x0000007f, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
     sp_canvas_item_hide(dc->area);
index 666ea4d2da0132db2bb9ea3b55df7c03be703b0b..4de36d0d7f40f3a233c3ef3218438de3f003a51c 100644 (file)
@@ -223,7 +223,7 @@ sp_dyna_draw_context_dispose(GObject *object)
     }
 
     if (ddc->accumulated) {
-        ddc->accumulated = sp_curve_unref(ddc->accumulated);
+        ddc->accumulated = ddc->accumulated->unref();
     }
 
     while (ddc->segments) {
@@ -231,9 +231,9 @@ sp_dyna_draw_context_dispose(GObject *object)
         ddc->segments = g_slist_remove(ddc->segments, ddc->segments->data);
     }
 
-    if (ddc->currentcurve) ddc->currentcurve = sp_curve_unref(ddc->currentcurve);
-    if (ddc->cal1) ddc->cal1 = sp_curve_unref(ddc->cal1);
-    if (ddc->cal2) ddc->cal2 = sp_curve_unref(ddc->cal2);
+    if (ddc->currentcurve) ddc->currentcurve = ddc->currentcurve->unref();
+    if (ddc->cal1) ddc->cal1 = ddc->cal1->unref();
+    if (ddc->cal2) ddc->cal2 = ddc->cal2->unref();
 
     if (ddc->currentshape) {
         gtk_object_destroy(GTK_OBJECT(ddc->currentshape));
@@ -258,11 +258,11 @@ sp_dyna_draw_context_setup(SPEventContext *ec)
     if (((SPEventContextClass *) parent_class)->setup)
         ((SPEventContextClass *) parent_class)->setup(ec);
 
-    ddc->accumulated = sp_curve_new_sized(32);
-    ddc->currentcurve = sp_curve_new_sized(4);
+    ddc->accumulated = new SPCurve(32);
+    ddc->currentcurve = new SPCurve(4);
 
-    ddc->cal1 = sp_curve_new_sized(32);
-    ddc->cal2 = sp_curve_new_sized(32);
+    ddc->cal1 = new SPCurve(32);
+    ddc->cal2 = new SPCurve(32);
 
     ddc->currentshape = sp_canvas_item_new(sp_desktop_sketch(ec->desktop), SP_TYPE_CANVAS_BPATH, NULL);
     sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(ddc->currentshape), DDC_RED_RGBA, SP_WIND_RULE_EVENODD);
@@ -271,9 +271,9 @@ sp_dyna_draw_context_setup(SPEventContext *ec)
     g_signal_connect(G_OBJECT(ddc->currentshape), "event", G_CALLBACK(sp_desktop_root_handler), ec->desktop);
 
     {
-        SPCurve *c = sp_curve_new_from_foreign_bpath(hatch_area_circle);
+        SPCurve *c = SPCurve::new_from_foreign_bpath(hatch_area_circle);
         ddc->hatch_area = sp_canvas_bpath_new(sp_desktop_controls(ec->desktop), c);
-        sp_curve_unref(c);
+        c->unref();
         sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(ddc->hatch_area), 0x00000000,(SPWindRule)0);
         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(ddc->hatch_area), 0x0000007f, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
         sp_canvas_item_hide(ddc->hatch_area);
@@ -598,7 +598,7 @@ calligraphic_cancel(SPDynaDrawContext *dc)
                 dc->segments = g_slist_remove(dc->segments, dc->segments->data);
             }
             /* reset accumulated curve */
-            sp_curve_reset(dc->accumulated);
+            dc->accumulated->reset();
             clear_current(dc);
             if (dc->repr) {
                 dc->repr = NULL;
@@ -631,7 +631,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
                 sp_dyna_draw_reset(dc, button_dt);
                 sp_dyna_draw_extinput(dc, event);
                 sp_dyna_draw_apply(dc, button_dt);
-                sp_curve_reset(dc->accumulated);
+                dc->accumulated->reset();
                 if (dc->repr) {
                     dc->repr = NULL;
                 }
@@ -891,7 +891,7 @@ sp_dyna_draw_context_root_handler(SPEventContext *event_context,
             set_to_accumulated(dc, event->button.state & GDK_SHIFT_MASK); // performs document_done
 
             /* reset accumulated curve */
-            sp_curve_reset(dc->accumulated);
+            dc->accumulated->reset();
 
             clear_current(dc);
             if (dc->repr) {
@@ -1034,9 +1034,9 @@ clear_current(SPDynaDrawContext *dc)
     /* reset bpath */
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->currentshape), NULL);
     /* reset curve */
-    sp_curve_reset(dc->currentcurve);
-    sp_curve_reset(dc->cal1);
-    sp_curve_reset(dc->cal2);
+    dc->currentcurve->reset();
+    dc->cal1->reset();
+    dc->cal2->reset();
     /* reset points */
     dc->npoints = 0;
 }
@@ -1046,7 +1046,7 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize)
 {
     SPDesktop *desktop = SP_EVENT_CONTEXT(dc)->desktop;
 
-    if (!sp_curve_empty(dc->accumulated)) {
+    if (!dc->accumulated->is_empty()) {
         NArtBpath *abp;
         gchar *str;
 
@@ -1065,7 +1065,7 @@ set_to_accumulated(SPDynaDrawContext *dc, bool unionize)
             item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
             item->updateRepr();
         }
-        abp = nr_artpath_affine(sp_curve_first_bpath(dc->accumulated), sp_desktop_dt2root_affine(desktop));
+        abp = nr_artpath_affine(dc->accumulated->first_bpath(), sp_desktop_dt2root_affine(desktop));
         str = sp_svg_write_path(abp);
         g_assert( str != NULL );
         g_free(abp);
@@ -1118,16 +1118,16 @@ add_cap(SPCurve *curve,
     }
 
     if ( NR::L2(v_in) > DYNA_EPSILON || NR::L2(v_out) > DYNA_EPSILON ) {
-        sp_curve_curveto(curve, from + v_in, to + v_out, to);
+        curve->curveto(from + v_in, to + v_out, to);
     }
 }
 
 static void
 accumulate_calligraphic(SPDynaDrawContext *dc)
 {
-    if ( !sp_curve_empty(dc->cal1) && !sp_curve_empty(dc->cal2) ) {
-        sp_curve_reset(dc->accumulated); /*  Is this required ?? */
-        SPCurve *rev_cal2 = sp_curve_reverse(dc->cal2);
+    if ( !dc->cal1->is_empty() && !dc->cal2->is_empty() ) {
+        dc->accumulated->reset(); /*  Is this required ?? */
+        SPCurve *rev_cal2 = dc->cal2->reverse();
 
         g_assert(dc->cal1->end > 1);
         g_assert(rev_cal2->end > 1);
@@ -1138,20 +1138,20 @@ accumulate_calligraphic(SPDynaDrawContext *dc)
         g_assert(SP_CURVE_SEGMENT(dc->cal1, dc->cal1->end-1)->code == NR_CURVETO);
         g_assert(SP_CURVE_SEGMENT(rev_cal2, rev_cal2->end-1)->code == NR_CURVETO);
 
-        sp_curve_append(dc->accumulated, dc->cal1, FALSE);
+        dc->accumulated->append(dc->cal1, FALSE);
 
         add_cap(dc->accumulated, SP_CURVE_SEGMENT(dc->cal1, dc->cal1->end-1)->c(2), SP_CURVE_SEGMENT(dc->cal1, dc->cal1->end-1)->c(3), SP_CURVE_SEGMENT(rev_cal2, 0)->c(3), SP_CURVE_SEGMENT(rev_cal2, 1)->c(1), dc->cap_rounding);
 
-        sp_curve_append(dc->accumulated, rev_cal2, TRUE);
+        dc->accumulated->append(rev_cal2, TRUE);
 
         add_cap(dc->accumulated, SP_CURVE_SEGMENT(rev_cal2, rev_cal2->end-1)->c(2), SP_CURVE_SEGMENT(rev_cal2, rev_cal2->end-1)->c(3), SP_CURVE_SEGMENT(dc->cal1, 0)->c(3), SP_CURVE_SEGMENT(dc->cal1, 1)->c(1), dc->cap_rounding);
 
-        sp_curve_closepath(dc->accumulated);
+        dc->accumulated->closepath();
 
-        sp_curve_unref(rev_cal2);
+        rev_cal2->unref();
 
-        sp_curve_reset(dc->cal1);
-        sp_curve_reset(dc->cal2);
+        dc->cal1->reset();
+        dc->cal2->reset();
     }
 }
 
@@ -1186,11 +1186,11 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release)
         if ( dc->cal1->end == 0 || dc->cal2->end == 0 ) {
             /* dc->npoints > 0 */
             /* g_print("calligraphics(1|2) reset\n"); */
-            sp_curve_reset(dc->cal1);
-            sp_curve_reset(dc->cal2);
+            dc->cal1->reset();
+            dc->cal2->reset();
 
-            sp_curve_moveto(dc->cal1, dc->point1[0]);
-            sp_curve_moveto(dc->cal2, dc->point2[0]);
+            dc->cal1->moveto(dc->point1[0]);
+            dc->cal2->moveto(dc->point2[0]);
         }
 
         NR::Point b1[BEZIER_MAX_LENGTH];
@@ -1210,31 +1210,30 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release)
 #endif
             /* CanvasShape */
             if (! release) {
-                sp_curve_reset(dc->currentcurve);
-                sp_curve_moveto(dc->currentcurve, b1[0]);
+                dc->currentcurve->reset();
+                dc->currentcurve->moveto(b1[0]);
                 for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) {
-                    sp_curve_curveto(dc->currentcurve, bp1[1],
+                    dc->currentcurve->curveto(bp1[1],
                                      bp1[2], bp1[3]);
                 }
-                sp_curve_lineto(dc->currentcurve,
-                                b2[BEZIER_SIZE*(nb2-1) + 3]);
+                dc->currentcurve->lineto(b2[BEZIER_SIZE*(nb2-1) + 3]);
                 for (NR::Point *bp2 = b2 + BEZIER_SIZE * ( nb2 - 1 ); bp2 >= b2; bp2 -= BEZIER_SIZE) {
-                    sp_curve_curveto(dc->currentcurve, bp2[2], bp2[1], bp2[0]);
+                    dc->currentcurve->curveto(bp2[2], bp2[1], bp2[0]);
                 }
                 // FIXME: dc->segments is always NULL at this point??
                 if (!dc->segments) { // first segment
                     add_cap(dc->currentcurve, b2[1], b2[0], b1[0], b1[1], dc->cap_rounding);
                 }
-                sp_curve_closepath(dc->currentcurve);
+                dc->currentcurve->closepath();
                 sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->currentshape), dc->currentcurve);
             }
 
             /* Current calligraphic */
             for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) {
-                sp_curve_curveto(dc->cal1, bp1[1], bp1[2], bp1[3]);
+                dc->cal1->curveto(bp1[1], bp1[2], bp1[3]);
             }
             for (NR::Point *bp2 = b2; bp2 < b2 + BEZIER_SIZE * nb2; bp2 += BEZIER_SIZE) {
-                sp_curve_curveto(dc->cal2, bp2[1], bp2[2], bp2[3]);
+                dc->cal2->curveto(bp2[1], bp2[2], bp2[3]);
             }
         } else {
             /* fixme: ??? */
@@ -1244,10 +1243,10 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release)
             draw_temporary_box(dc);
 
             for (gint i = 1; i < dc->npoints; i++) {
-                sp_curve_lineto(dc->cal1, dc->point1[i]);
+                dc->cal1->lineto(dc->point1[i]);
             }
             for (gint i = 1; i < dc->npoints; i++) {
-                sp_curve_lineto(dc->cal2, dc->point2[i]);
+                dc->cal2->lineto(dc->point2[i]);
             }
         }
 
@@ -1256,14 +1255,14 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release)
         g_print("[%d]Yup\n", dc->npoints);
 #endif
         if (!release) {
-            g_assert(!sp_curve_empty(dc->currentcurve));
+            g_assert(!dc->currentcurve->is_empty());
 
             SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(SP_EVENT_CONTEXT(dc)->desktop),
                                                    SP_TYPE_CANVAS_BPATH,
                                                    NULL);
-            SPCurve *curve = sp_curve_copy(dc->currentcurve);
+            SPCurve *curve = dc->currentcurve->copy();
             sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve);
-            sp_curve_unref(curve);
+            curve->unref();
 
             guint32 fillColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic", true);
             //guint32 strokeColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic", false);
@@ -1291,20 +1290,20 @@ fit_and_split(SPDynaDrawContext *dc, gboolean release)
 static void
 draw_temporary_box(SPDynaDrawContext *dc)
 {
-    sp_curve_reset(dc->currentcurve);
+    dc->currentcurve->reset();
 
-    sp_curve_moveto(dc->currentcurve, dc->point1[dc->npoints-1]);
+    dc->currentcurve->moveto(dc->point1[dc->npoints-1]);
     for (gint i = dc->npoints-2; i >= 0; i--) {
-        sp_curve_lineto(dc->currentcurve, dc->point1[i]);
+        dc->currentcurve->lineto(dc->point1[i]);
     }
     for (gint i = 0; i < dc->npoints; i++) {
-        sp_curve_lineto(dc->currentcurve, dc->point2[i]);
+        dc->currentcurve->lineto(dc->point2[i]);
     }
     if (dc->npoints >= 2) {
         add_cap(dc->currentcurve, dc->point2[dc->npoints-2], dc->point2[dc->npoints-1], dc->point1[dc->npoints-1], dc->point1[dc->npoints-2], dc->cap_rounding);
     }
 
-    sp_curve_closepath(dc->currentcurve);
+    dc->currentcurve->closepath();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->currentshape), dc->currentcurve);
 }
 
index 3ee75eb850a4a20a9f984ebe275dcd4091baa990..295e75e8704b739e1458ef89fa092b5b02eb90bd 100644 (file)
@@ -190,7 +190,7 @@ sp_eraser_context_dispose(GObject *object)
     SPEraserContext *erc = SP_ERASER_CONTEXT(object);
 
     if (erc->accumulated) {
-        erc->accumulated = sp_curve_unref(erc->accumulated);
+        erc->accumulated = erc->accumulated->unref();
     }
 
     while (erc->segments) {
@@ -198,9 +198,9 @@ sp_eraser_context_dispose(GObject *object)
         erc->segments = g_slist_remove(erc->segments, erc->segments->data);
     }
 
-    if (erc->currentcurve) erc->currentcurve = sp_curve_unref(erc->currentcurve);
-    if (erc->cal1) erc->cal1 = sp_curve_unref(erc->cal1);
-    if (erc->cal2) erc->cal2 = sp_curve_unref(erc->cal2);
+    if (erc->currentcurve) erc->currentcurve = erc->currentcurve->unref();
+    if (erc->cal1) erc->cal1 = erc->cal1->unref();
+    if (erc->cal2) erc->cal2 = erc->cal2->unref();
 
     if (erc->currentshape) {
         gtk_object_destroy(GTK_OBJECT(erc->currentshape));
@@ -223,11 +223,11 @@ sp_eraser_context_setup(SPEventContext *ec)
     if (((SPEventContextClass *) parent_class)->setup)
         ((SPEventContextClass *) parent_class)->setup(ec);
 
-    erc->accumulated = sp_curve_new_sized(32);
-    erc->currentcurve = sp_curve_new_sized(4);
+    erc->accumulated = new SPCurve(32);
+    erc->currentcurve = new SPCurve(4);
 
-    erc->cal1 = sp_curve_new_sized(32);
-    erc->cal2 = sp_curve_new_sized(32);
+    erc->cal1 = new SPCurve(32);
+    erc->cal2 = new SPCurve(32);
 
     erc->currentshape = sp_canvas_item_new(sp_desktop_sketch(ec->desktop), SP_TYPE_CANVAS_BPATH, NULL);
     sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(erc->currentshape), ERC_RED_RGBA, SP_WIND_RULE_EVENODD);
@@ -546,7 +546,7 @@ eraser_cancel(SPEraserContext *dc)
                 dc->segments = g_slist_remove(dc->segments, dc->segments->data);
             }
             /* reset accumulated curve */
-            sp_curve_reset(dc->accumulated);
+            dc->accumulated->reset();
             clear_current(dc);
             if (dc->repr) {
                 dc->repr = NULL;
@@ -579,7 +579,7 @@ sp_eraser_context_root_handler(SPEventContext *event_context,
                 sp_eraser_reset(dc, button_dt);
                 sp_eraser_extinput(dc, event);
                 sp_eraser_apply(dc, button_dt);
-                sp_curve_reset(dc->accumulated);
+                dc->accumulated->reset();
                 if (dc->repr) {
                     dc->repr = NULL;
                 }
@@ -663,7 +663,7 @@ sp_eraser_context_root_handler(SPEventContext *event_context,
             set_to_accumulated(dc); // performs document_done
 
             /* reset accumulated curve */
-            sp_curve_reset(dc->accumulated);
+            dc->accumulated->reset();
 
             clear_current(dc);
             if (dc->repr) {
@@ -790,9 +790,9 @@ clear_current(SPEraserContext *dc)
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->currentshape), NULL);
 
     // reset curve
-    sp_curve_reset(dc->currentcurve);
-    sp_curve_reset(dc->cal1);
-    sp_curve_reset(dc->cal2);
+    dc->currentcurve->reset();
+    dc->cal1->reset();
+    dc->cal2->reset();
 
     // reset points
     dc->npoints = 0;
@@ -804,7 +804,7 @@ set_to_accumulated(SPEraserContext *dc)
     SPDesktop *desktop = SP_EVENT_CONTEXT(dc)->desktop;
     bool workDone = false;
 
-    if (!sp_curve_empty(dc->accumulated)) {
+    if (!dc->accumulated->is_empty()) {
         NArtBpath *abp;
         gchar *str;
 
@@ -823,7 +823,7 @@ set_to_accumulated(SPEraserContext *dc)
             item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer());
             item->updateRepr();
         }
-        abp = nr_artpath_affine(sp_curve_first_bpath(dc->accumulated), sp_desktop_dt2root_affine(desktop));
+        abp = nr_artpath_affine(dc->accumulated->first_bpath(), sp_desktop_dt2root_affine(desktop));
         str = sp_svg_write_path(abp);
         g_assert( str != NULL );
         g_free(abp);
@@ -955,16 +955,16 @@ add_cap(SPCurve *curve,
     }
 
     if ( NR::L2(v_in) > ERASER_EPSILON || NR::L2(v_out) > ERASER_EPSILON ) {
-        sp_curve_curveto(curve, from + v_in, to + v_out, to);
+        curve->curveto(from + v_in, to + v_out, to);
     }
 }
 
 static void
 accumulate_eraser(SPEraserContext *dc)
 {
-    if ( !sp_curve_empty(dc->cal1) && !sp_curve_empty(dc->cal2) ) {
-        sp_curve_reset(dc->accumulated); //  Is this required ??
-        SPCurve *rev_cal2 = sp_curve_reverse(dc->cal2);
+    if ( !dc->cal1->is_empty() && !dc->cal2->is_empty() ) {
+        dc->accumulated->reset(); /*  Is this required ?? */
+        SPCurve *rev_cal2 = dc->cal2->reverse();
 
         g_assert(dc->cal1->end > 1);
         g_assert(rev_cal2->end > 1);
@@ -975,20 +975,20 @@ accumulate_eraser(SPEraserContext *dc)
         g_assert(SP_CURVE_SEGMENT(dc->cal1, dc->cal1->end-1)->code == NR_CURVETO);
         g_assert(SP_CURVE_SEGMENT(rev_cal2, rev_cal2->end-1)->code == NR_CURVETO);
 
-        sp_curve_append(dc->accumulated, dc->cal1, FALSE);
+        dc->accumulated->append(dc->cal1, FALSE);
 
         add_cap(dc->accumulated, SP_CURVE_SEGMENT(dc->cal1, dc->cal1->end-1)->c(2), SP_CURVE_SEGMENT(dc->cal1, dc->cal1->end-1)->c(3), SP_CURVE_SEGMENT(rev_cal2, 0)->c(3), SP_CURVE_SEGMENT(rev_cal2, 1)->c(1), dc->cap_rounding);
 
-        sp_curve_append(dc->accumulated, rev_cal2, TRUE);
+        dc->accumulated->append(rev_cal2, TRUE);
 
         add_cap(dc->accumulated, SP_CURVE_SEGMENT(rev_cal2, rev_cal2->end-1)->c(2), SP_CURVE_SEGMENT(rev_cal2, rev_cal2->end-1)->c(3), SP_CURVE_SEGMENT(dc->cal1, 0)->c(3), SP_CURVE_SEGMENT(dc->cal1, 1)->c(1), dc->cap_rounding);
 
-        sp_curve_closepath(dc->accumulated);
+        dc->accumulated->closepath();
 
-        sp_curve_unref(rev_cal2);
+        rev_cal2->unref();
 
-        sp_curve_reset(dc->cal1);
-        sp_curve_reset(dc->cal2);
+        dc->cal1->reset();
+        dc->cal2->reset();
     }
 }
 
@@ -1023,11 +1023,11 @@ fit_and_split(SPEraserContext *dc, gboolean release)
         if ( dc->cal1->end == 0 || dc->cal2->end == 0 ) {
             /* dc->npoints > 0 */
             /* g_print("erasers(1|2) reset\n"); */
-            sp_curve_reset(dc->cal1);
-            sp_curve_reset(dc->cal2);
+            dc->cal1->reset();
+            dc->cal2->reset();
 
-            sp_curve_moveto(dc->cal1, dc->point1[0]);
-            sp_curve_moveto(dc->cal2, dc->point2[0]);
+            dc->cal1->moveto(dc->point1[0]);
+            dc->cal2->moveto(dc->point2[0]);
         }
 
         NR::Point b1[BEZIER_MAX_LENGTH];
@@ -1047,31 +1047,30 @@ fit_and_split(SPEraserContext *dc, gboolean release)
 #endif
             /* CanvasShape */
             if (! release) {
-                sp_curve_reset(dc->currentcurve);
-                sp_curve_moveto(dc->currentcurve, b1[0]);
+                dc->currentcurve->reset();
+                dc->currentcurve->moveto(b1[0]);
                 for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) {
-                    sp_curve_curveto(dc->currentcurve, bp1[1],
+                    dc->currentcurve->curveto(bp1[1],
                                      bp1[2], bp1[3]);
                 }
-                sp_curve_lineto(dc->currentcurve,
-                                b2[BEZIER_SIZE*(nb2-1) + 3]);
+                dc->currentcurve->lineto(b2[BEZIER_SIZE*(nb2-1) + 3]);
                 for (NR::Point *bp2 = b2 + BEZIER_SIZE * ( nb2 - 1 ); bp2 >= b2; bp2 -= BEZIER_SIZE) {
-                    sp_curve_curveto(dc->currentcurve, bp2[2], bp2[1], bp2[0]);
+                    dc->currentcurve->curveto(bp2[2], bp2[1], bp2[0]);
                 }
                 // FIXME: dc->segments is always NULL at this point??
                 if (!dc->segments) { // first segment
                     add_cap(dc->currentcurve, b2[1], b2[0], b1[0], b1[1], dc->cap_rounding);
                 }
-                sp_curve_closepath(dc->currentcurve);
+                dc->currentcurve->closepath();
                 sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->currentshape), dc->currentcurve);
             }
 
             /* Current eraser */
             for (NR::Point *bp1 = b1; bp1 < b1 + BEZIER_SIZE * nb1; bp1 += BEZIER_SIZE) {
-                sp_curve_curveto(dc->cal1, bp1[1], bp1[2], bp1[3]);
+                dc->cal1->curveto(bp1[1], bp1[2], bp1[3]);
             }
             for (NR::Point *bp2 = b2; bp2 < b2 + BEZIER_SIZE * nb2; bp2 += BEZIER_SIZE) {
-                sp_curve_curveto(dc->cal2, bp2[1], bp2[2], bp2[3]);
+                dc->cal2->curveto(bp2[1], bp2[2], bp2[3]);
             }
         } else {
             /* fixme: ??? */
@@ -1081,10 +1080,10 @@ fit_and_split(SPEraserContext *dc, gboolean release)
             draw_temporary_box(dc);
 
             for (gint i = 1; i < dc->npoints; i++) {
-                sp_curve_lineto(dc->cal1, dc->point1[i]);
+                dc->cal1->lineto(dc->point1[i]);
             }
             for (gint i = 1; i < dc->npoints; i++) {
-                sp_curve_lineto(dc->cal2, dc->point2[i]);
+                dc->cal2->lineto(dc->point2[i]);
             }
         }
 
@@ -1094,14 +1093,14 @@ fit_and_split(SPEraserContext *dc, gboolean release)
 #endif
         if (!release) {
             gint eraserMode = (prefs_get_int_attribute("tools.eraser", "mode", 0) != 0) ? 1 : 0;
-            g_assert(!sp_curve_empty(dc->currentcurve));
+            g_assert(!dc->currentcurve->is_empty());
 
             SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(SP_EVENT_CONTEXT(dc)->desktop),
                                                    SP_TYPE_CANVAS_BPATH,
                                                    NULL);
-            SPCurve *curve = sp_curve_copy(dc->currentcurve);
+            SPCurve *curve = dc->currentcurve->copy();
             sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve);
-            sp_curve_unref(curve);
+            curve->unref();
 
             guint32 fillColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.eraser", true);
             //guint32 strokeColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.eraser", false);
@@ -1134,20 +1133,20 @@ fit_and_split(SPEraserContext *dc, gboolean release)
 static void
 draw_temporary_box(SPEraserContext *dc)
 {
-    sp_curve_reset(dc->currentcurve);
+    dc->currentcurve->reset();
 
-    sp_curve_moveto(dc->currentcurve, dc->point1[dc->npoints-1]);
+    dc->currentcurve->moveto(dc->point1[dc->npoints-1]);
     for (gint i = dc->npoints-2; i >= 0; i--) {
-        sp_curve_lineto(dc->currentcurve, dc->point1[i]);
+        dc->currentcurve->lineto(dc->point1[i]);
     }
     for (gint i = 0; i < dc->npoints; i++) {
-        sp_curve_lineto(dc->currentcurve, dc->point2[i]);
+        dc->currentcurve->lineto(dc->point2[i]);
     }
     if (dc->npoints >= 2) {
         add_cap(dc->currentcurve, dc->point2[dc->npoints-2], dc->point2[dc->npoints-1], dc->point1[dc->npoints-1], dc->point1[dc->npoints-2], dc->cap_rounding);
     }
 
-    sp_curve_closepath(dc->currentcurve);
+    dc->currentcurve->closepath();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->currentshape), dc->currentcurve);
 }
 
index 3123faebbc3904d81bf7f000eae057e6566b2ac3..dd2bcb42c0224472df28171f04801d35ebcf13b7 100644 (file)
@@ -2060,7 +2060,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts,
         couts.printf("</draw:path>\n\n");
 
 
-        sp_curve_unref(curve);
+        curve->unref();
         }
 
     return true;
index dbfb5267646bc6938556ad31a2f5c34232f0b4c3..0f04c6a1aa0bce1deb9fcd51090babf3b0d1262d 100644 (file)
@@ -294,7 +294,7 @@ void PovOutput::doCurves(SPDocument *doc)
 
         SPShape *shape = SP_SHAPE(reprobj);
         SPCurve *curve = shape->curve;
-        if (sp_curve_empty(curve))
+        if (curve->is_empty())
             continue;
             
         nrShapes++;
index 9ff953c47ba6ee0bf97b3cb44a117b9eca1aac77..5fa20c81c41a8591a5c95085e00b0f6002448f6c 100755 (executable)
@@ -552,7 +552,7 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_
         bpath.path = (NArtBpath*)span.font->ArtBPath(_glyphs[glyph_index].glyph);
         if (bpath.path) {
             NArtBpath *abp = nr_artpath_affine(bpath.path, glyph_matrix);
-            SPCurve *c = sp_curve_new_from_bpath(abp);
+            SPCurve *c = SPCurve::new_from_bpath(abp);
             if (c) cc = g_slist_prepend(cc, c);
         }
     }
@@ -560,14 +560,14 @@ SPCurve *Layout::convertToCurves(iterator const &from_glyph, iterator const &to_
 
     SPCurve *curve;
     if ( cc ) {
-        curve = sp_curve_concat(cc);
+        curve = SPCurve::concat(cc);
     } else {
-        curve = sp_curve_new();
+        curve = new SPCurve();
     }
 
     while (cc) {
         /* fixme: This is dangerous, as we are mixing art_alloc and g_new */
-        sp_curve_unref((SPCurve *) cc->data);
+        reinterpret_cast<SPCurve *>(cc->data)->unref();
         cc = g_slist_remove(cc, cc->data);
     }
 
index 8708d091c6e718b53027aaf75a05a032dd2a0efe..7bbeef7d2bf73a4c264e0b89cf9b23084d409d13 100644 (file)
@@ -22,13 +22,13 @@ typedef struct {
 void bezctx_ink_moveto(bezctx *bc, double x, double y, int /*is_open*/)
 {
     bezctx_ink *bi = (bezctx_ink *) bc;
-    sp_curve_moveto(bi->curve, x, y);
+    bi->curve->moveto(x, y);
 }
 
 void bezctx_ink_lineto(bezctx *bc, double x, double y)
 {
     bezctx_ink *bi = (bezctx_ink *) bc;
-    sp_curve_lineto(bi->curve, x, y);
+    bi->curve->lineto(x, y);
 }
 
 void bezctx_ink_quadto(bezctx *bc, double xm, double ym, double x3, double y3)
@@ -39,7 +39,7 @@ void bezctx_ink_quadto(bezctx *bc, double xm, double ym, double x3, double y3)
     double x1, y1;
     double x2, y2;
 
-    NR::Point last = sp_curve_last_point(bi->curve);
+    NR::Point last = bi->curve->last_point();
     x0 = last[NR::X];
     y0 = last[NR::Y];
     x1 = xm + (1./3) * (x0 - xm);
@@ -47,14 +47,14 @@ void bezctx_ink_quadto(bezctx *bc, double xm, double ym, double x3, double y3)
     x2 = xm + (1./3) * (x3 - xm);
     y2 = ym + (1./3) * (y3 - ym);
 
-    sp_curve_curveto(bi->curve, x1, y1, x2, y2, x3, y3);
+    bi->curve->curveto(x1, y1, x2, y2, x3, y3);
 }
 
 void bezctx_ink_curveto(bezctx *bc, double x1, double y1, double x2, double y2,
                    double x3, double y3)
 {
     bezctx_ink *bi = (bezctx_ink *) bc;
-    sp_curve_curveto(bi->curve, x1, y1, x2, y2, x3, y3);
+    bi->curve->curveto(x1, y1, x2, y2, x3, y3);
 }
 
 bezctx *
@@ -94,8 +94,8 @@ LPESpiro::setup_nodepath(Inkscape::NodePath::Path *np)
 void
 LPESpiro::doEffect(SPCurve * curve)
 {
-    SPCurve *csrc = sp_curve_copy(curve);
-    sp_curve_reset(curve);
+    SPCurve *csrc = curve->copy();
+    curve->reset();
     bezctx *bc = new_bezctx_ink(curve);
     int len = SP_CURVE_LENGTH(csrc);
     spiro_cp *path = g_new (spiro_cp, len + 1);
index 429cf82d1a78d672eb04d346208001d92b5f4eff..9e7be732e4ed95a50368672bba68564d3ec09ca7 100644 (file)
@@ -327,7 +327,7 @@ PathParam::linked_modified(SPObject *linked_obj, guint /*flags*/)
         _pathvector = SVGD_to_2GeomPath(defvalue);
     } else {
         _pathvector = BPath_to_2GeomPath(SP_CURVE_BPATH(curve));
-        sp_curve_unref(curve);
+        curve->unref();
     }
 
     must_recalculate_pwd2 = true;
index 82d0ab670b589bfd4abf5dc262a146c46dc8a641..c3523e3c5a6d88d6ba0cbf3435cfd005dfea705c 100644 (file)
@@ -218,8 +218,8 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
             if (SP_IS_PATH(item)) {
             // This should be put somewhere else under the name of "generate helperpath" or something. Because basically this is copied of code from nodepath...
                 SPCurve *curve_new = sp_path_get_curve_for_edit(SP_PATH(item));
-                SPCurve *flash_curve = sp_curve_copy(curve_new);
-                sp_curve_transform(flash_curve, sp_item_i2d_affine(item) );
+                SPCurve *flash_curve = curve_new->copy();
+                flash_curve->transform(sp_item_i2d_affine(item) );
                 SPCanvasItem * canvasitem = sp_canvas_bpath_new(sp_desktop_tempgroup(desktop), flash_curve);
             // would be nice if its color could be XORed or something, now it is invisible for red stroked objects...
             // unless we also flash the nodes...
@@ -227,7 +227,7 @@ sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve
                 sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(canvasitem), color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
                 sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(canvasitem), 0, SP_WIND_RULE_NONZERO);
                 sp_canvas_item_show(canvasitem);
-                sp_curve_unref(flash_curve);
+                flash_curve->unref();
                 guint timeout = prefs_get_int_attribute("tools.nodes", "pathflash_timeout", 500);
                 nc->flash_tempitem = desktop->add_temporary_canvasitem (canvasitem, timeout);
             }
index 6b1c540574fe79251b327cc7d4f2104d674fd628..8e2cd8e82892bee1c6c2e8ad7e1802ccfadeb38e 100644 (file)
@@ -180,17 +180,17 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object,
     if (curve == NULL)
         return NULL;
 
-    NArtBpath *bpath = sp_curve_first_bpath(curve);
+    NArtBpath *bpath = curve->first_bpath();
     gint length = curve->end;
     if (length == 0) {
-        sp_curve_unref(curve);
+        curve->unref();
         return NULL; // prevent crash for one-node paths
     }
 
     //Create new nodepath
     Inkscape::NodePath::Path *np = g_new(Inkscape::NodePath::Path, 1);
     if (!np) {
-        sp_curve_unref(curve);
+        curve->unref();
         return NULL;
     }
 
@@ -206,7 +206,7 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object,
     np->helper_path = NULL;
     np->helperpath_rgba = prefs_get_int_attribute("tools.nodes", "highlight_color", 0xff0000ff);
     np->helperpath_width = 1.0;
-    np->curve = sp_curve_copy(curve);
+    np->curve = curve->copy();
     np->show_helperpath = prefs_get_int_attribute ("tools.nodes", "show_helperpath",  0) == 1;
     np->straight_path = false;
     if (IS_LIVEPATHEFFECT(object) && item) {
@@ -258,21 +258,21 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object,
     np->subpaths = g_list_reverse(np->subpaths);
 
     g_free(typestr);
-    sp_curve_unref(curve);
+    curve->unref();
 
     // create the livarot representation from the same item
     sp_nodepath_ensure_livarot_path(np);
 
     // Draw helper curve
     if (np->show_helperpath) {
-        SPCurve *helper_curve = sp_curve_copy(np->curve);
-        sp_curve_transform(helper_curve, np->i2d );
+        SPCurve *helper_curve = np->curve->copy();
+        helper_curve->transform(np->i2d );
         np->helper_path = sp_canvas_bpath_new(sp_desktop_controls(desktop), helper_curve);
         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(np->helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
         sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(np->helper_path), 0, SP_WIND_RULE_NONZERO);
         sp_canvas_item_move_to_z(np->helper_path, 0);
         sp_canvas_item_show(np->helper_path);
-        sp_curve_unref(helper_curve);
+        helper_curve->unref();
     }
 
     return np;
@@ -307,7 +307,7 @@ void sp_nodepath_destroy(Inkscape::NodePath::Path *np) {
         gtk_object_destroy(temp);
     }
     if (np->curve) {
-        sp_curve_unref(np->curve);
+        np->curve->unref();
         np->curve = NULL;
     }
 
@@ -336,7 +336,7 @@ void sp_nodepath_ensure_livarot_path(Inkscape::NodePath::Path *np)
         if (np->livarot_path)
             np->livarot_path->ConvertWithBackData(0.01);
 
-        sp_curve_unref(curve);
+        curve->unref();
     }
 }
 
@@ -533,16 +533,16 @@ static void update_object(Inkscape::NodePath::Path *np)
 {
     g_assert(np);
 
-    sp_curve_unref(np->curve);
+    np->curve->unref();
     np->curve = create_curve(np);
 
     sp_nodepath_set_curve(np, np->curve);
 
     if (np->show_helperpath) {
-        SPCurve * helper_curve = sp_curve_copy(np->curve);
-        sp_curve_transform(helper_curve, np->i2d );
+        SPCurve * helper_curve = np->curve->copy();
+        helper_curve->transform(np->i2d );
         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve);
-        sp_curve_unref(helper_curve);
+        helper_curve->unref();
     }
 }
 
@@ -555,7 +555,7 @@ static void update_repr_internal(Inkscape::NodePath::Path *np)
 
     Inkscape::XML::Node *repr = np->object->repr;
 
-    sp_curve_unref(np->curve);
+    np->curve->unref();
     np->curve = create_curve(np);
 
     gchar *typestr = create_typestr(np);
@@ -576,10 +576,10 @@ static void update_repr_internal(Inkscape::NodePath::Path *np)
     g_free(typestr);
 
     if (np->show_helperpath) {
-        SPCurve * helper_curve = sp_curve_copy(np->curve);
-        sp_curve_transform(helper_curve, np->i2d );
+        SPCurve * helper_curve = np->curve->copy();
+        helper_curve->transform(np->i2d );
         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve);
-        sp_curve_unref(helper_curve);
+        helper_curve->unref();
     }
  }
 
@@ -652,7 +652,7 @@ static void stamp_repr(Inkscape::NodePath::Path *np)
     Inkscape::GC::release(new_repr);
     g_free(svgpath);
     g_free(typestr);
-    sp_curve_unref(curve);
+    curve->unref();
 }
 
 /**
@@ -660,22 +660,20 @@ static void stamp_repr(Inkscape::NodePath::Path *np)
  */
 static SPCurve *create_curve(Inkscape::NodePath::Path *np)
 {
-    SPCurve *curve = sp_curve_new();
+    SPCurve *curve = new SPCurve();
 
     for (GList *spl = np->subpaths; spl != NULL; spl = spl->next) {
        Inkscape::NodePath::SubPath *sp = (Inkscape::NodePath::SubPath *) spl->data;
-        sp_curve_moveto(curve,
-                        sp->first->pos * np->d2i);
+        curve->moveto(sp->first->pos * np->d2i);
        Inkscape::NodePath::Node *n = sp->first->n.other;
         while (n) {
             NR::Point const end_pt = n->pos * np->d2i;
             switch (n->code) {
                 case NR_LINETO:
-                    sp_curve_lineto(curve, end_pt);
+                    curve->lineto(end_pt);
                     break;
                 case NR_CURVETO:
-                    sp_curve_curveto(curve,
-                                     n->p.other->n.pos * np->d2i,
+                    curve->curveto(n->p.other->n.pos * np->d2i,
                                      n->p.pos * np->d2i,
                                      end_pt);
                     break;
@@ -690,7 +688,7 @@ static SPCurve *create_curve(Inkscape::NodePath::Path *np)
             }
         }
         if (sp->closed) {
-            sp_curve_closepath(curve);
+            curve->closepath();
         }
     }
 
@@ -4673,12 +4671,12 @@ SPCurve* sp_nodepath_object_get_curve(SPObject *object, const gchar *key) {
     SPCurve *curve = NULL;
     if (SP_IS_PATH(object)) {
         SPCurve *curve_new = sp_path_get_curve_for_edit(SP_PATH(object));
-        curve = sp_curve_copy(curve_new);
+        curve = curve_new->copy();
     } else if ( IS_LIVEPATHEFFECT(object) && key) {
         const gchar *svgd = object->repr->attribute(key);
         if (svgd) {
             NArtBpath *bpath = sp_svg_read_path(svgd);
-            SPCurve *curve_new = sp_curve_new_from_bpath(bpath);
+            SPCurve *curve_new = SPCurve::new_from_bpath(bpath);
             if (curve_new) {
                 curve = curve_new; // don't do curve_copy because curve_new is already only created for us!
             } else {
@@ -4715,8 +4713,8 @@ void sp_nodepath_show_helperpath(Inkscape::NodePath::Path *np, bool show) {
     np->show_helperpath = show;
 
     if (show) {
-        SPCurve *helper_curve = sp_curve_copy(np->curve);
-        sp_curve_transform(helper_curve, np->i2d );
+        SPCurve *helper_curve = np->curve->copy();
+        helper_curve->transform(np->i2d );
         if (!np->helper_path) {
             np->helper_path = sp_canvas_bpath_new(sp_desktop_controls(np->desktop), helper_curve);
             sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(np->helper_path), np->helperpath_rgba, np->helperpath_width, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
@@ -4726,7 +4724,7 @@ void sp_nodepath_show_helperpath(Inkscape::NodePath::Path *np, bool show) {
         } else {
             sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(np->helper_path), helper_curve);
         }
-        sp_curve_unref(helper_curve);
+        helper_curve->unref();
     } else {
         if (np->helper_path) {
             GtkObject *temp = np->helper_path;
index 915b9eb0bc4dbbf52e71c40f57cee9e43f1e8439..ea0266d98b347e6e9b0c16b4565b2dfd82339d78 100644 (file)
@@ -304,7 +304,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
                             _bpaths_to_snap_to->push_back(bpath);
                             // Because we set doTransformation to true in bpath_for_curve, we
                             // will get a dupe of the path, which must be freed at some point
-                            sp_curve_unref(curve);
+                            curve->unref();
                         }
                     }
                 }
@@ -359,7 +359,7 @@ void Inkscape::ObjectSnapper::_snapPaths(SnappedConstraints &sc,
                 _bpaths_to_snap_to->push_back(bpath);
                 // Because we set doTransformation to true in bpath_for_curve, we
                 // will get a dupe of the path, which must be freed at some point
-                sp_curve_unref(curve);
+                curve->unref();
             }
         }   
         // Convert all bpaths to Paths, because here we really must have Paths
@@ -688,7 +688,7 @@ NArtBpath* Inkscape::ObjectSnapper::_getBorderBPath() const
 {
     NArtBpath *border_bpath = NULL;
     NR::Rect const border_rect = NR::Rect(NR::Point(0,0), NR::Point(sp_document_width(_named_view->document),sp_document_height(_named_view->document)));
-    SPCurve const *border_curve = sp_curve_new_from_rect(border_rect);
+    SPCurve const *border_curve = SPCurve::new_from_rect(border_rect);
     if (border_curve) {
         border_bpath = SP_CURVE_BPATH(border_curve); 
     }
index 4325918c3d0b55b39907db59615a3dcddba49edc..b6567a012dc4847f48bcd4f0f037911aeef033b9 100644 (file)
@@ -112,12 +112,12 @@ sp_selected_path_combine(void)
             // FIXME: merge styles of combined objects instead of using the first one's style
             style = g_strdup(SP_OBJECT_REPR(first)->attribute("style"));
             path_effect = g_strdup(SP_OBJECT_REPR(first)->attribute("inkscape:path-effect"));
-            //sp_curve_transform(c, item->transform);
+            //c->transform(item->transform);
             curve = c;
         } else {
-            sp_curve_transform(c, item->getRelativeTransform(SP_OBJECT(first)));
-            sp_curve_append(curve, c, false);
-            sp_curve_unref(c);
+            c->transform(item->getRelativeTransform(SP_OBJECT(first)));
+            curve->append(c, false);
+            c->unref();
         }
 
         // unless this is the topmost object,
@@ -150,7 +150,7 @@ sp_selected_path_combine(void)
 
         // set path data corresponding to new curve
         gchar *dstring = sp_svg_write_path(SP_CURVE_BPATH(curve));
-        sp_curve_unref(curve);
+        curve->unref();
         repr->setAttribute("d", dstring);
         if (path_effect)
             repr->setAttribute("inkscape:original-d", dstring);
@@ -223,17 +223,17 @@ sp_selected_path_break_apart(void)
 
         NArtBpath *abp = nr_artpath_affine(SP_CURVE_BPATH(curve), (SP_ITEM(path))->transform);
 
-        sp_curve_unref(curve);
+        curve->unref();
 
         // it's going to resurrect as one of the pieces, so we delete without advertisement
         SP_OBJECT(item)->deleteObject(false);
 
-        curve = sp_curve_new_from_bpath(abp);
+        curve = SPCurve::new_from_bpath(abp);
         g_assert(curve != NULL);
 
-        GSList *list = sp_curve_split(curve);
+        GSList *list = curve->split();
 
-        sp_curve_unref(curve);
+        curve->unref();
 
         GSList *reprs = NULL;
         for (GSList *l = list; l != NULL; l = l->next) {
@@ -437,7 +437,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
     // otherwise we end up with zomby markup in the SVG file
     if(curve->end <= 0)
     {
-        sp_curve_unref(curve);
+        curve->unref();
         return NULL;
     }
 
@@ -469,7 +469,7 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
     gchar *def_str = sp_svg_write_path(SP_CURVE_BPATH(curve));
     repr->setAttribute("d", def_str);
     g_free(def_str);
-    sp_curve_unref(curve);
+    curve->unref();
     return repr;
 }
 
@@ -503,7 +503,7 @@ sp_selected_path_reverse()
         did = true;
         SPPath *path = SP_PATH(i->data);
 
-        SPCurve *rcurve = sp_curve_reverse(sp_path_get_curve_reference(path));
+        SPCurve *rcurve = sp_path_get_curve_reference(path)->reverse();
 
         gchar *str = sp_svg_write_path(SP_CURVE_BPATH(rcurve));
         if ( sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(path)) ) {
@@ -513,7 +513,7 @@ sp_selected_path_reverse()
         }
         g_free(str);
 
-        sp_curve_unref(rcurve);
+        rcurve->unref();
     }
 
     desktop->clearWaitingCursor();
index 2a6c84bc7ba02260a285b4573e3b7f77132b5825..270b8148db2bab823e9037c6a53106a21c91c125 100644 (file)
@@ -790,9 +790,9 @@ pen_redraw_all (SPPenContext *const pc)
     if (pc->green_anchor)
         SP_CTRL(pc->green_anchor->ctrl)->moveto(pc->green_anchor->dp);
 
-    sp_curve_reset(pc->red_curve);
-    sp_curve_moveto(pc->red_curve, pc->p[0]);
-    sp_curve_curveto(pc->red_curve, pc->p[1], pc->p[2], pc->p[3]);
+    pc->red_curve->reset();
+    pc->red_curve->moveto(pc->p[0]);
+    pc->red_curve->curveto(pc->p[1], pc->p[2], pc->p[3]);
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
 
     // handles
@@ -806,7 +806,7 @@ pen_redraw_all (SPPenContext *const pc)
         sp_canvas_item_hide (pc->cl1);
     }
 
-    NArtBpath *const bpath = sp_curve_last_bpath(pc->green_curve);
+    NArtBpath *const bpath = pc->green_curve->last_bpath();
     if (bpath) {
         if (bpath->code == NR_CURVETO && NR::Point(bpath->x2, bpath->y2) != pc->p[0]) {
             SP_CTRL(pc->c0)->moveto(NR::Point(bpath->x2, bpath->y2));
@@ -827,7 +827,7 @@ pen_lastpoint_move (SPPenContext *const pc, gdouble x, gdouble y)
         return;
 
     // green
-    NArtBpath *const bpath = sp_curve_last_bpath(pc->green_curve);
+    NArtBpath *const bpath = pc->green_curve->last_bpath();
     if (bpath) {
         if (bpath->code == NR_CURVETO) {
             bpath->x2 += x;
@@ -861,7 +861,7 @@ pen_lastpoint_tocurve (SPPenContext *const pc)
         return;
 
     // red
-    NArtBpath *const bpath = sp_curve_last_bpath(pc->green_curve);
+    NArtBpath *const bpath = pc->green_curve->last_bpath();
     if (bpath && bpath->code == NR_CURVETO) {
         pc->p[1] = pc->p[0] + (NR::Point(bpath->x3, bpath->y3) - NR::Point(bpath->x2, bpath->y2));
     } else {
@@ -999,8 +999,8 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
         case GDK_BackSpace:
         case GDK_Delete:
         case GDK_KP_Delete:
-            if (sp_curve_is_empty(pc->green_curve)) {
-                if (!sp_curve_is_empty(pc->red_curve)) {
+            if (pc->green_curve->is_empty()) {
+                if (!pc->red_curve->is_empty()) {
                     pen_cancel (pc);
                     ret = TRUE;
                 } else {
@@ -1008,7 +1008,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
                 }
             } else {
                 /* Reset red curve */
-                sp_curve_reset(pc->red_curve);
+                pc->red_curve->reset();
                 /* Destroy topmost green bpath */
                 if (pc->green_bpaths) {
                     if (pc->green_bpaths->data)
@@ -1032,7 +1032,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
                                      ? p[e - 1].c(3)
                                      : pc->p[3] ));
                 pc->npoints = 2;
-                sp_curve_backspace(pc->green_curve);
+                pc->green_curve->backspace();
                 sp_canvas_item_hide(pc->c0);
                 sp_canvas_item_hide(pc->c1);
                 sp_canvas_item_hide(pc->cl0);
@@ -1052,17 +1052,17 @@ static void
 spdc_reset_colors(SPPenContext *pc)
 {
     /* Red */
-    sp_curve_reset(pc->red_curve);
+    pc->red_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
     /* Blue */
-    sp_curve_reset(pc->blue_curve);
+    pc->blue_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->blue_bpath), NULL);
     /* Green */
     while (pc->green_bpaths) {
         gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
         pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
     }
-    sp_curve_reset(pc->green_curve);
+    pc->green_curve->reset();
     if (pc->green_anchor) {
         pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
     }
@@ -1119,16 +1119,16 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, NR::Point const p, bool st
     pc->p[3] = p;
     pc->p[4] = p;
     pc->npoints = 5;
-    sp_curve_reset(pc->red_curve);
-    sp_curve_moveto(pc->red_curve, pc->p[0]);
+    pc->red_curve->reset();
+    pc->red_curve->moveto(pc->p[0]);
     bool is_curve;
     if ( (pc->onlycurves)
          || ( pc->p[1] != pc->p[0] ) )
     {
-        sp_curve_curveto(pc->red_curve, pc->p[1], p, p);
+        pc->red_curve->curveto(pc->p[1], p, p);
         is_curve = true;
     } else {
-        sp_curve_lineto(pc->red_curve, p);
+        pc->red_curve->lineto(p);
         is_curve = false;
     }
 
@@ -1172,9 +1172,9 @@ spdc_pen_set_ctrl(SPPenContext *const pc, NR::Point const p, guint const state)
             NR::Point delta = p - pc->p[3];
             pc->p[2] = pc->p[3] - delta;
             is_symm = true;
-            sp_curve_reset(pc->red_curve);
-            sp_curve_moveto(pc->red_curve, pc->p[0]);
-            sp_curve_curveto(pc->red_curve, pc->p[1], pc->p[2], pc->p[3]);
+            pc->red_curve->reset();
+            pc->red_curve->moveto(pc->p[0]);
+            pc->red_curve->curveto(pc->p[1], pc->p[2], pc->p[3]);
             sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
         }
         SP_CTRL(pc->c0)->moveto(pc->p[2]);
@@ -1200,12 +1200,12 @@ spdc_pen_set_ctrl(SPPenContext *const pc, NR::Point const p, guint const state)
 static void
 spdc_pen_finish_segment(SPPenContext *const pc, NR::Point const /*p*/, guint const /*state*/)
 {
-    if (!sp_curve_empty(pc->red_curve)) {
-        sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625);
-        SPCurve *curve = sp_curve_copy(pc->red_curve);
+    if (!pc->red_curve->is_empty()) {
+        pc->green_curve->append_continuous(pc->red_curve, 0.0625);
+        SPCurve *curve = pc->red_curve->copy();
         /// \todo fixme:
         SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), curve);
-        sp_curve_unref(curve);
+        curve->unref();
         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
 
         pc->green_bpaths = g_slist_prepend(pc->green_bpaths, cshape);
@@ -1214,7 +1214,7 @@ spdc_pen_finish_segment(SPPenContext *const pc, NR::Point const /*p*/, guint con
         pc->p[1] = pc->p[4];
         pc->npoints = 2;
 
-        sp_curve_reset(pc->red_curve);
+        pc->red_curve->reset();
     }
 }
 
@@ -1227,7 +1227,7 @@ spdc_pen_finish(SPPenContext *const pc, gboolean const closed)
     pc->_message_context->clear();
     desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished"));
 
-    sp_curve_reset(pc->red_curve);
+    pc->red_curve->reset();
     spdc_concat_colors_and_flush(pc, closed);
     pc->sa = NULL;
     pc->ea = NULL;
index 3d397b1800e580b5cc86f38ae2e3c4815eb53862..0ba44dc3359ce9849077d54c1c4e6840aa601ebf 100644 (file)
@@ -445,13 +445,13 @@ pencil_cancel (SPPencilContext *const pc)
 
     pc->state = SP_PENCIL_CONTEXT_IDLE;
 
-    sp_curve_reset(pc->red_curve);
+    pc->red_curve->reset();
     sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
     while (pc->green_bpaths) {
         gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
         pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
     }
-    sp_curve_reset(pc->green_curve);
+    pc->green_curve->reset();
     if (pc->green_anchor) {
         pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
     }
@@ -543,7 +543,7 @@ spdc_set_endpoint(SPPencilContext *const pc, NR::Point const p)
     }
     g_return_if_fail( pc->npoints > 0 );
 
-    sp_curve_reset(pc->red_curve);
+    pc->red_curve->reset();
     if ( ( p == pc->p[0] )
          || !in_svg_plane(p) )
     {
@@ -552,8 +552,8 @@ spdc_set_endpoint(SPPencilContext *const pc, NR::Point const p)
         pc->p[1] = p;
         pc->npoints = 2;
 
-        sp_curve_moveto(pc->red_curve, pc->p[0]);
-        sp_curve_lineto(pc->red_curve, pc->p[1]);
+        pc->red_curve->moveto(pc->p[0]);
+        pc->red_curve->lineto(pc->p[1]);
         pc->red_curve_is_valid = true;
 
         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
@@ -574,7 +574,7 @@ spdc_finish_endpoint(SPPencilContext *const pc)
          || ( SP_CURVE_SEGMENT(pc->red_curve, 0)->c(3) ==
               SP_CURVE_SEGMENT(pc->red_curve, 1)->c(3)   ) )
     {
-        sp_curve_reset(pc->red_curve);
+        pc->red_curve->reset();
         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
     } else {
         /* Write curves to object. */
@@ -623,19 +623,19 @@ fit_and_split(SPPencilContext *pc)
          && unsigned(pc->npoints) < G_N_ELEMENTS(pc->p) )
     {
         /* Fit and draw and reset state */
-        sp_curve_reset(pc->red_curve);
-        sp_curve_moveto(pc->red_curve, b[0]);
-        sp_curve_curveto(pc->red_curve, b[1], b[2], b[3]);
+        pc->red_curve->reset();
+        pc->red_curve->moveto(b[0]);
+        pc->red_curve->curveto(b[1], b[2], b[3]);
         sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
         pc->red_curve_is_valid = true;
     } else {
         /* Fit and draw and copy last point */
 
-        g_assert(!sp_curve_empty(pc->red_curve));
+        g_assert(!pc->red_curve->is_empty());
 
         /* Set up direction of next curve. */
         {
-            NArtBpath const &last_seg = *sp_curve_last_bpath(pc->red_curve);
+            NArtBpath const &last_seg = *pc->red_curve->last_bpath();
             pc->p[0] = last_seg.c(3);
             pc->npoints = 1;
             g_assert( last_seg.code == NR_CURVETO );
@@ -646,12 +646,12 @@ fit_and_split(SPPencilContext *pc)
                                 : NR::unit_vector(req_vec) );
         }
 
-        sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625);
-        SPCurve *curve = sp_curve_copy(pc->red_curve);
+        pc->green_curve->append_continuous(pc->red_curve, 0.0625);
+        SPCurve *curve = pc->red_curve->copy();
 
         /// \todo fixme:
         SPCanvasItem *cshape = sp_canvas_bpath_new(sp_desktop_sketch(pc->desktop), curve);
-        sp_curve_unref(curve);
+        curve->unref();
         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cshape), pc->green_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
 
         pc->green_bpaths = g_slist_prepend(pc->green_bpaths, cshape);
index 24087b10caaa9cd5f5ebed24e9359350cc9ff730..4b7b1c48f2bcef08418aa811bcffb29e453197a8 100644 (file)
@@ -28,7 +28,7 @@ Inkscape::Rubberband::Rubberband()
 {
     _points.clear();
     _mode = RUBBERBAND_MODE_RECT;
-    _touchpath_curve = sp_curve_new_sized(2000);
+    _touchpath_curve = new SPCurve(2000);
 }
 
 void Inkscape::Rubberband::delete_canvas_items()
@@ -49,13 +49,13 @@ void Inkscape::Rubberband::delete_canvas_items()
 void Inkscape::Rubberband::start(SPDesktop *d, NR::Point const &p)
 {
     _points.clear();
-    sp_curve_reset(_touchpath_curve);
+    _touchpath_curve->reset();
     delete_canvas_items();
     _desktop = d;
     _start = p;
     _started = true;
     _points.push_back(_desktop->d2w(p));
-    sp_curve_moveto(_touchpath_curve, p);
+    _touchpath_curve->moveto(p);
 
     sp_canvas_force_full_redraw_after_interruptions(_desktop->canvas, 5);
 }
@@ -66,7 +66,7 @@ void Inkscape::Rubberband::stop()
     _mode = RUBBERBAND_MODE_RECT; // restore the default
 
     _points.clear();
-    sp_curve_reset(_touchpath_curve);
+    _touchpath_curve->reset();
 
     delete_canvas_items();
 
@@ -81,7 +81,7 @@ void Inkscape::Rubberband::move(NR::Point const &p)
 
     _end = p;
     _desktop->scroll_to_point(&p);
-    sp_curve_lineto (_touchpath_curve, p);
+    _touchpath_curve->lineto(p);
 
     NR::Point next = _desktop->d2w(p);
     // we want the points to be at most 0.5 screen pixels apart,
index 0870692938f770455344c3089afd37548cb82b6c..04591aaba3cbcbd565b62a7e01c1e17d1bc144a1 100644 (file)
@@ -178,10 +178,10 @@ SPConnEndPair::getEndpoints(NR::Point endPts[]) const {
         else
         {
             if (h == 0) {
-                endPts[h] = sp_curve_first_point(curve);
+                endPts[h] = curve->first_point();
             }
             else {
-                endPts[h] = sp_curve_last_point(curve);
+                endPts[h] = curve->last_point();
             }
         }
     }
@@ -302,12 +302,12 @@ SPConnEndPair::reroutePath(void)
     Avoid::PolyLine route = _connRef->route();
     _connRef->calcRouteDist();
 
-    sp_curve_reset(curve);
-    sp_curve_moveto(curve, endPt[0]);
+    curve->reset();
+    curve->moveto(endPt[0]);
 
     for (int i = 1; i < route.pn; ++i) {
         NR::Point p(route.ps[i].x, route.ps[i].y);
-        sp_curve_lineto(curve, p);
+        curve->lineto(p);
     }
 }
 
index 99b908e69cd70cf5a2d8e2cd34cb48d3f214ab41..f610a87907aedb0ad5ea5c92508abe59dcca61f7 100644 (file)
@@ -69,8 +69,8 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
         NR::Matrix h2i2anc[2];
         NR::Rect h2bbox_icoordsys[2];
         NR::Point last_seg_endPt[2] = {
-            sp_curve_second_point(path->curve),
-            sp_curve_penultimate_point(path->curve)
+            path->curve->second_point(),
+            path->curve->penultimate_point()
         };
         for (unsigned h = 0; h < 2; ++h) {
             NR::Maybe<NR::Rect> bbox = h2attItem[h]->getBounds(NR::identity());
@@ -102,13 +102,13 @@ sp_conn_end_move_compensate(NR::Matrix const */*mp*/, SPItem */*moved_item*/,
         NR::Point other_endpt;
         NR::Point last_seg_pt;
         if (h2attItem[0] != NULL) {
-            other_endpt = sp_curve_last_point(path->curve);
-            last_seg_pt = sp_curve_second_point(path->curve);
+            other_endpt = path->curve->last_point();
+            last_seg_pt = path->curve->second_point();
             ind = 0;
         }
         else {
-            other_endpt = sp_curve_first_point(path->curve);
-            last_seg_pt = sp_curve_penultimate_point(path->curve);
+            other_endpt = path->curve->first_point();
+            last_seg_pt = path->curve->penultimate_point();
             ind = 1;
         }
         NR::Point h2endPt_icoordsys[2];
@@ -225,11 +225,11 @@ static void
 change_endpts(SPCurve *const curve, NR::Point const h2endPt[2])
 {
 #if 0
-    sp_curve_reset(curve);
-    sp_curve_moveto(curve, h2endPt[0]);
-    sp_curve_lineto(curve, h2endPt[1]);
+    curve->reset();
+    curve->moveto(h2endPt[0]);
+    curve->lineto(h2endPt[1]);
 #else
-    sp_curve_move_endpoints(curve, h2endPt[0], h2endPt[1]);
+    curve->move_endpoints(h2endPt[0], h2endPt[1]);
 #endif
 }
 
index 9b982d75848883d01f467d4e1b7f9e30b9569b0a..e25be12af91eb9fcf517918433bdf31693a7c212 100644 (file)
@@ -167,7 +167,7 @@ sp_genericellipse_update_patheffect(SPLPEItem *lpeitem, bool write)
     if (write) {
         Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
         if ( shape->curve != NULL ) {
-            NArtBpath *abp = sp_curve_first_bpath(shape->curve);
+            NArtBpath *abp = shape->curve->first_bpath();
             if (abp) {
                 gchar *str = sp_svg_write_path(abp);
                 repr->setAttribute("d", str);
@@ -273,12 +273,12 @@ static void sp_genericellipse_set_shape(SPShape *shape)
     }
 
     bpath[i].code = NR_END;
-    SPCurve *c = sp_curve_new_from_bpath(nr_artpath_affine(bpath, aff));
+    SPCurve *c = SPCurve::new_from_bpath(nr_artpath_affine(bpath, aff));
     g_assert(c != NULL);
 
     sp_lpe_item_perform_path_effect(SP_LPE_ITEM (ellipse), c);
     sp_shape_set_curve_insync((SPShape *) ellipse, c, TRUE);
-    sp_curve_unref(c);
+    c->unref();
 }
 
 static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p)
index 6e8c014f1f74def060b112b7c96aa43bc322595c..b989b52fb1b4a5ed3f02d1a302371e38379b33eb 100644 (file)
@@ -543,7 +543,7 @@ static void         GetDest(SPObject* child,Shape **computed,NR::Matrix itr_mat)
                delete uncross;
                delete n_shp;
                delete temp;
-               sp_curve_unref(curve);
+               curve->unref();
        } else {
 //             printf("no curve\n");
        }
index 95e104b7652774de37739cd4266a38ea20e179d1..6ba348fbec094b2620b46ec747d3158778b2ec4e 100644 (file)
@@ -618,7 +618,7 @@ sp_image_release (SPObject *object)
 #endif // ENABLE_LCMS
 
     if (image->curve) {
-               image->curve = sp_curve_unref (image->curve);
+               image->curve = image->curve->unref();
        }
 
        if (((SPObjectClass *) parent_class)->release)
@@ -1454,7 +1454,7 @@ sp_image_set_curve(SPImage *image)
     //create a curve at the image's boundary for snapping
     if ((image->height.computed < 1e-18) || (image->width.computed < 1e-18) || (image->clip_ref->getObject())) {
         if (image->curve) {
-            image->curve = sp_curve_unref(image->curve);
+            image->curve = image->curve->unref();
         }
         return;
     }
@@ -1462,17 +1462,17 @@ sp_image_set_curve(SPImage *image)
     NRRect rect;
        sp_image_bbox(image, &rect, NR::identity(), 0);
        NR::Maybe<NR::Rect> rect2 = rect.upgrade();
-       SPCurve *c = sp_curve_new_from_rect(rect2);
+       SPCurve *c = SPCurve::new_from_rect(rect2);
         
     if (image->curve) {
-        image->curve = sp_curve_unref(image->curve);
+        image->curve = image->curve->unref();
     }
     
     if (c) {
-        image->curve = sp_curve_ref(c);
+        image->curve = c->ref();
     }
     
-    sp_curve_unref(c);    
+    c->unref();    
 }
 
 /**
@@ -1482,7 +1482,7 @@ SPCurve *
 sp_image_get_curve (SPImage *image)
 {
        if (image->curve) {
-               return sp_curve_copy(image->curve);
+               return image->curve->copy();
        }
        return NULL;
 }
index 9be7cf928a0f9307b5a30379b23d16f573cf3f08..5fed6a62ea1aff7e5c019ae675a5c40f7a4583c4 100644 (file)
@@ -218,12 +218,12 @@ sp_line_set_shape (SPShape *shape)
 {
        SPLine *line = SP_LINE (shape);
 
-       SPCurve *c = sp_curve_new ();
+       SPCurve *c = new SPCurve ();
 
-       sp_curve_moveto (c, line->x1.computed, line->y1.computed);
-       sp_curve_lineto (c, line->x2.computed, line->y2.computed);
+       c->moveto(line->x1.computed, line->y1.computed);
+       c->lineto(line->x2.computed, line->y2.computed);
 
        sp_shape_set_curve_insync (shape, c, TRUE); // *_insync does not call update, avoiding infinite recursion when set_shape is called by update
 
-       sp_curve_unref (c);
+       c->unref();
 }
index 44384dee9706246bb39dcb73f0be347913d9dc3c..d866df068b3021262ad51390d5a06c12e08cb7fa 100644 (file)
@@ -354,10 +354,10 @@ sp_offset_set(SPObject *object, unsigned key, gchar const *value)
                 offset->original = strdup (value);
 
                 bpath = sp_svg_read_path (offset->original);
-                curve = sp_curve_new_from_bpath (bpath);       // curve se chargera de detruire bpath
+                curve = SPCurve::new_from_bpath (bpath);       // curve se chargera de detruire bpath
                 g_assert (curve != NULL);
                 offset->originalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
-                sp_curve_unref (curve);
+                curve->unref();
 
                 offset->knotSet = false;
                 if ( offset->isUpdating == false ) object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -533,10 +533,10 @@ sp_offset_set_shape(SPShape *shape)
         const char *res_d = SP_OBJECT(shape)->repr->attribute("inkscape:original");
         if ( res_d ) {
             NArtBpath *bpath = sp_svg_read_path (res_d);
-            SPCurve *c = sp_curve_new_from_bpath (bpath);
+            SPCurve *c = SPCurve::new_from_bpath (bpath);
             g_assert(c != NULL);
             sp_shape_set_curve_insync ((SPShape *) offset, c, TRUE);
-            sp_curve_unref (c);
+            c->unref();
         }
         return;
     }
@@ -782,10 +782,10 @@ sp_offset_set_shape(SPShape *shape)
         delete orig;
 
         NArtBpath *bpath = sp_svg_read_path (res_d);
-        SPCurve *c = sp_curve_new_from_bpath (bpath);
+        SPCurve *c = SPCurve::new_from_bpath (bpath);
         g_assert(c != NULL);
         sp_shape_set_curve_insync ((SPShape *) offset, c, TRUE);
-        sp_curve_unref (c);
+        c->unref();
 
         free (res_d);
     }
@@ -1036,7 +1036,7 @@ sp_offset_top_point (SPOffset * offset, NR::Point *px)
     Path *finalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
     if (finalPath == NULL)
     {
-        sp_curve_unref (curve);
+        curve->unref();
         return;
     }
 
@@ -1053,7 +1053,7 @@ sp_offset_top_point (SPOffset * offset, NR::Point *px)
 
     delete theShape;
     delete finalPath;
-    sp_curve_unref (curve);
+    curve->unref();
 }
 
 // the listening functions
@@ -1178,7 +1178,7 @@ refresh_offset_source(SPOffset* offset)
            return;
     }
     orig = bpath_to_liv_path (SP_CURVE_BPATH(curve));
-    sp_curve_unref (curve);
+    curve->unref();
 
 
     // Finish up.
index 99670882abab2b86ba788d8e9aab1bae8954dc3e..b25397a31b99b1fbc2685292ab3f432e9d97c261 100644 (file)
@@ -232,7 +232,7 @@ sp_path_release(SPObject *object)
     path->connEndPair.release();
 
     if (path->original_curve) {
-        path->original_curve = sp_curve_unref (path->original_curve);
+        path->original_curve = path->original_curve->unref();
     }
 
     if (((SPObjectClass *) parent_class)->release) {
@@ -253,10 +253,10 @@ sp_path_set(SPObject *object, unsigned int key, gchar const *value)
         case SP_ATTR_INKSCAPE_ORIGINAL_D:
                 if (value) {
                     NArtBpath *bpath = sp_svg_read_path(value);
-                    SPCurve *curve = sp_curve_new_from_bpath(bpath);
+                    SPCurve *curve = SPCurve::new_from_bpath(bpath);
                     if (curve) {
                         sp_path_set_original_curve(path, curve, TRUE, true);
-                        sp_curve_unref(curve);
+                        curve->unref();
                     }
                 } else {
                     sp_path_set_original_curve(path, NULL, TRUE, true);
@@ -267,10 +267,10 @@ sp_path_set(SPObject *object, unsigned int key, gchar const *value)
             if (!sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(path))) {
                 if (value) {
                     NArtBpath *bpath = sp_svg_read_path(value);
-                    SPCurve *curve = sp_curve_new_from_bpath(bpath);
+                    SPCurve *curve = SPCurve::new_from_bpath(bpath);
                     if (curve) {
                         sp_shape_set_curve((SPShape *) path, curve, TRUE);
-                        sp_curve_unref(curve);
+                        curve->unref();
                     }
                 } else {
                     sp_shape_set_curve((SPShape *) path, NULL, TRUE);
@@ -313,7 +313,7 @@ sp_path_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
     }
 
     if ( shape->curve != NULL ) {
-        NArtBpath *abp = sp_curve_first_bpath(shape->curve);
+        NArtBpath *abp = shape->curve->first_bpath();
         if (abp) {
             gchar *str = sp_svg_write_path(abp);
             repr->setAttribute("d", str);
@@ -327,7 +327,7 @@ sp_path_write(SPObject *object, Inkscape::XML::Node *repr, guint flags)
 
     SPPath *path = (SPPath *) object;
     if ( path->original_curve != NULL ) {
-        NArtBpath *abp = sp_curve_first_bpath(path->original_curve);
+        NArtBpath *abp = path->original_curve->first_bpath();
         if (abp) {
             gchar *str = sp_svg_write_path(abp);
             repr->setAttribute("inkscape:original-d", str);
@@ -380,15 +380,15 @@ sp_path_set_transform(SPItem *item, NR::Matrix const &xform)
     // Transform the original-d path or the (ordinary) path
     bool original_path = (bool)path->original_curve;
     SPCurve *srccurve = original_path ? path->original_curve : shape->curve;
-    SPCurve *dstcurve = sp_curve_copy(srccurve);
+    SPCurve *dstcurve = srccurve->copy();
     if (dstcurve) {
-        sp_curve_transform(dstcurve, xform);
+        dstcurve->transform(xform);
         if (original_path) {
             sp_path_set_original_curve(path, dstcurve, TRUE, true);
         } else {
             sp_shape_set_curve(shape, dstcurve, TRUE);
         }
-        sp_curve_unref(dstcurve);
+        dstcurve->unref();
     }
 
     // Adjust stroke
@@ -415,16 +415,16 @@ sp_path_update_patheffect(SPLPEItem *lpeitem, bool write)
     SPShape *shape = (SPShape *) lpeitem;
     SPPath *path = (SPPath *) lpeitem;
     if (path->original_curve) {
-        SPCurve *curve = sp_curve_copy (path->original_curve);
+        SPCurve *curve = path->original_curve->copy();
         sp_lpe_item_perform_path_effect(SP_LPE_ITEM(shape), curve);
         sp_shape_set_curve(shape, curve, TRUE);
-        sp_curve_unref(curve);
+        curve->unref();
 
         if (write) {
             // could also do SP_OBJECT(shape)->updateRepr();  but only the d attribute needs updating.
             Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
             if ( shape->curve != NULL ) {
-                NArtBpath *abp = sp_curve_first_bpath(shape->curve);
+                NArtBpath *abp = shape->curve->first_bpath();
                 if (abp) {
                     gchar *str = sp_svg_write_path(abp);
                     repr->setAttribute("d", str);
@@ -454,13 +454,13 @@ void
 sp_path_set_original_curve (SPPath *path, SPCurve *curve, unsigned int owner, bool write)
 {
     if (path->original_curve) {
-        path->original_curve = sp_curve_unref (path->original_curve);
+        path->original_curve = path->original_curve->unref();
     }
     if (curve) {
         if (owner) {
-            path->original_curve = sp_curve_ref (curve);
+            path->original_curve = curve->ref();
         } else {
-            path->original_curve = sp_curve_copy (curve);
+            path->original_curve = curve->copy();
         }
     }
     sp_path_update_patheffect(path, write);
@@ -474,7 +474,7 @@ SPCurve *
 sp_path_get_original_curve (SPPath *path)
 {
     if (path->original_curve) {
-        return sp_curve_copy (path->original_curve);
+        return path->original_curve->copy();
     }
     return NULL;
 }
index 1fb43c03673de3f895c7723518a23bae8f3cd1a2..23225d714539579f3e6793fda7c307204a15805d 100644 (file)
@@ -126,7 +126,7 @@ static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::No
     }
 
     /* We can safely write points here, because all subclasses require it too (Lauris) */
-    NArtBpath *abp = sp_curve_first_bpath(shape->curve);
+    NArtBpath *abp = shape->curve->first_bpath();
     gchar *str = sp_svg_write_polygon(abp);
     repr->setAttribute("points", str);
     g_free(str);
@@ -171,7 +171,7 @@ static void sp_polygon_set(SPObject *object, unsigned int key, const gchar *valu
                  * http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing. */
                 break;
             }
-            SPCurve *curve = sp_curve_new();
+            SPCurve *curve = new SPCurve();
             gboolean hascpt = FALSE;
 
             gchar const *cptr = value;
@@ -198,9 +198,9 @@ static void sp_polygon_set(SPObject *object, unsigned int key, const gchar *valu
                 }
 
                 if (hascpt) {
-                    sp_curve_lineto(curve, x, y);
+                    curve->lineto(x, y);
                 } else {
-                    sp_curve_moveto(curve, x, y);
+                    curve->moveto(x, y);
                     hascpt = TRUE;
                 }
             }
@@ -214,12 +214,12 @@ static void sp_polygon_set(SPObject *object, unsigned int key, const gchar *valu
                  * doesn't seem to like simply moveto followed by closepath.  The following works,
                  * but won't round-trip properly: I believe it will write as two points rather than
                  * one. */
-                sp_curve_lineto(curve, curve->movePos);
+                curve->lineto(curve->movePos);
             } else if (hascpt) {
-                sp_curve_closepath(curve);
+                curve->closepath();
             }
             sp_shape_set_curve(SP_SHAPE(polygon), curve, TRUE);
-            sp_curve_unref(curve);
+            curve->unref();
             break;
         }
         default:
index d974f61e3a080504e31c6b17b08519ce5d8c7bdd..4a39afd1be3fa4ccbdb37702e90511206573e995 100644 (file)
@@ -105,7 +105,7 @@ sp_polyline_set (SPObject *object, unsigned int key, const gchar *value)
                gboolean hascpt;
 
                if (!value) break;
-               curve = sp_curve_new ();
+               curve = new SPCurve ();
                hascpt = FALSE;
 
                cptr = value;
@@ -132,15 +132,15 @@ sp_polyline_set (SPObject *object, unsigned int key, const gchar *value)
                        if (eptr == cptr) break;
                        cptr = eptr;
                        if (hascpt) {
-                               sp_curve_lineto (curve, x, y);
+                               curve->lineto(x, y);
                        } else {
-                               sp_curve_moveto (curve, x, y);
+                               curve->moveto(x, y);
                                hascpt = TRUE;
                        }
                }
                
                sp_shape_set_curve (SP_SHAPE (polyline), curve, TRUE);
-               sp_curve_unref (curve);
+               curve->unref();
                break;
        }
        default:
index 2e9befa3204fa803af13bd590386ab24bb3a9b9c..b02f52f1e311514739fee4bc42bcffbd07bd7ca9 100644 (file)
@@ -239,7 +239,7 @@ sp_rect_set_shape(SPShape *shape)
         return;
     }
 
-    SPCurve *c = sp_curve_new();
+    SPCurve *c = new SPCurve();
 
     double const x = rect->x.computed;
     double const y = rect->y.computed;
@@ -268,26 +268,26 @@ sp_rect_set_shape(SPShape *shape)
      * arc fairly well.
      */
     if ((rx > 1e-18) && (ry > 1e-18)) {
-        sp_curve_moveto(c, x + rx, y);
-        if (rx < w2) sp_curve_lineto(c, x + w - rx, y);
-        sp_curve_curveto(c, x + w - rx * (1 - C1), y,     x + w, y + ry * (1 - C1),       x + w, y + ry);
-        if (ry < h2) sp_curve_lineto(c, x + w, y + h - ry);
-        sp_curve_curveto(c, x + w, y + h - ry * (1 - C1),     x + w - rx * (1 - C1), y + h,       x + w - rx, y + h);
-        if (rx < w2) sp_curve_lineto(c, x + rx, y + h);
-        sp_curve_curveto(c, x + rx * (1 - C1), y + h,     x, y + h - ry * (1 - C1),       x, y + h - ry);
-        if (ry < h2) sp_curve_lineto(c, x, y + ry);
-        sp_curve_curveto(c, x, y + ry * (1 - C1),     x + rx * (1 - C1), y,       x + rx, y);
+        c->moveto(x + rx, y);
+        if (rx < w2) c->lineto(x + w - rx, y);
+        c->curveto(x + w - rx * (1 - C1), y,     x + w, y + ry * (1 - C1),       x + w, y + ry);
+        if (ry < h2) c->lineto(x + w, y + h - ry);
+        c->curveto(x + w, y + h - ry * (1 - C1),     x + w - rx * (1 - C1), y + h,       x + w - rx, y + h);
+        if (rx < w2) c->lineto(x + rx, y + h);
+        c->curveto(x + rx * (1 - C1), y + h,     x, y + h - ry * (1 - C1),       x, y + h - ry);
+        if (ry < h2) c->lineto(x, y + ry);
+        c->curveto(x, y + ry * (1 - C1),     x + rx * (1 - C1), y,       x + rx, y);
     } else {
-        sp_curve_moveto(c, x + 0.0, y + 0.0);
-        sp_curve_lineto(c, x + w, y + 0.0);
-        sp_curve_lineto(c, x + w, y + h);
-        sp_curve_lineto(c, x + 0.0, y + h);
-        sp_curve_lineto(c, x + 0.0, y + 0.0);
+        c->moveto(x + 0.0, y + 0.0);
+        c->lineto(x + w, y + 0.0);
+        c->lineto(x + w, y + h);
+        c->lineto(x + 0.0, y + h);
+        c->lineto(x + 0.0, y + 0.0);
     }
 
-    sp_curve_closepath_current(c);
+    c->closepath_current();
     sp_shape_set_curve_insync(SP_SHAPE(rect), c, TRUE);
-    sp_curve_unref(c);
+    c->unref();
 }
 
 /* fixme: Think (Lauris) */
index e452457939e61e623bf7870e54a46d423367587d..99ebdbe23b6a2dfcdd6d545fe31c8a92168078de 100644 (file)
@@ -199,7 +199,7 @@ sp_shape_release (SPObject *object)
          }
        }
        if (shape->curve) {
-               shape->curve = sp_curve_unref (shape->curve);
+               shape->curve = shape->curve->unref();
        }
     
        if (((SPObjectClass *) parent_class)->release) {
@@ -991,13 +991,13 @@ void
 sp_shape_set_curve (SPShape *shape, SPCurve *curve, unsigned int owner)
 {
        if (shape->curve) {
-               shape->curve = sp_curve_unref (shape->curve);
+               shape->curve = shape->curve->unref();
        }
        if (curve) {
                if (owner) {
-                       shape->curve = sp_curve_ref (curve);
+                       shape->curve = curve->ref();
                } else {
-                       shape->curve = sp_curve_copy (curve);
+                       shape->curve = curve->copy();
                }
        }
         SP_OBJECT(shape)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
@@ -1010,7 +1010,7 @@ SPCurve *
 sp_shape_get_curve (SPShape *shape)
 {
        if (shape->curve) {
-               return sp_curve_copy (shape->curve);
+               return shape->curve->copy();
        }
        return NULL;
 }
@@ -1022,13 +1022,13 @@ void
 sp_shape_set_curve_insync (SPShape *shape, SPCurve *curve, unsigned int owner)
 {
        if (shape->curve) {
-               shape->curve = sp_curve_unref (shape->curve);
+               shape->curve = shape->curve->unref();
        }
        if (curve) {
                if (owner) {
-                       shape->curve = sp_curve_ref (curve);
+                       shape->curve = curve->ref();
                } else {
-                       shape->curve = sp_curve_copy (curve);
+                       shape->curve = curve->copy();
                }
        }
 }
index 45dc6d2e3de9a93c4098b13602b65e75f2ad2728..d543aa00f234d6ac1935212988af5689f023dcf1 100644 (file)
@@ -308,7 +308,7 @@ sp_spiral_update_patheffect(SPLPEItem *lpeitem, bool write)
     if (write) {
         Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
         if ( shape->curve != NULL ) {
-            NArtBpath *abp = sp_curve_first_bpath(shape->curve);
+            NArtBpath *abp = shape->curve->first_bpath();
             if (abp) {
                 gchar *str = sp_svg_write_path(abp);
                 repr->setAttribute("d", str);
@@ -411,8 +411,7 @@ sp_spiral_fit_and_draw (SPSpiral const *spiral,
 #endif
        if (depth != -1) {
                for (i = 0; i < 4*depth; i += 4) {
-                       sp_curve_curveto (c,
-                                         bezier[i + 1],
+                       c->curveto(bezier[i + 1],
                                          bezier[i + 2],
                                          bezier[i + 3]);
                }
@@ -421,7 +420,7 @@ sp_spiral_fit_and_draw (SPSpiral const *spiral,
                g_print ("cant_fit_cubic: t=%g\n", *t);
 #endif
                for (i = 1; i < SAMPLE_SIZE; i++)
-                       sp_curve_lineto (c, darray[i]);
+                       c->lineto(darray[i]);
        }
        *t = next_t;
        g_assert (is_unit_vector (hat2));
@@ -437,7 +436,7 @@ sp_spiral_set_shape (SPShape *shape)
 
        SP_OBJECT (spiral)->requestModified(SP_OBJECT_MODIFIED_FLAG);
 
-       SPCurve *c = sp_curve_new ();
+       SPCurve *c = new SPCurve ();
        
 #ifdef SPIRAL_VERBOSE
        g_print ("cx=%g, cy=%g, exp=%g, revo=%g, rad=%g, arg=%g, t0=%g\n",
@@ -451,7 +450,7 @@ sp_spiral_set_shape (SPShape *shape)
 #endif
 
        /* Initial moveto. */
-       sp_curve_moveto(c, sp_spiral_get_xy(spiral, spiral->t0));
+       c->moveto(sp_spiral_get_xy(spiral, spiral->t0));
 
        double const tstep = SAMPLE_STEP / spiral->revo;
        double const dstep = tstep / (SAMPLE_SIZE - 1);
@@ -469,7 +468,7 @@ sp_spiral_set_shape (SPShape *shape)
 
     sp_lpe_item_perform_path_effect(SP_LPE_ITEM (spiral), c);
     sp_shape_set_curve_insync ((SPShape *) spiral, c, TRUE);
-    sp_curve_unref (c);
+    c->unref();
 }
 
 /**
index 2aeb0cfc0c65b1198ebb458397fd2a7bd9530c7e..4c5f9623b0f525e917c33375a0a146c076f30fd6 100644 (file)
@@ -285,7 +285,7 @@ sp_star_update_patheffect(SPLPEItem *lpeitem, bool write)
     if (write) {
         Inkscape::XML::Node *repr = SP_OBJECT_REPR(shape);
         if ( shape->curve != NULL ) {
-            NArtBpath *abp = sp_curve_first_bpath(shape->curve);
+            NArtBpath *abp = shape->curve->first_bpath();
             if (abp) {
                 gchar *str = sp_svg_write_path(abp);
                 repr->setAttribute("d", str);
@@ -434,7 +434,7 @@ sp_star_set_shape (SPShape *shape)
 {
        SPStar *star = SP_STAR (shape);
 
-       SPCurve *c = sp_curve_new ();
+       SPCurve *c = new SPCurve ();
        
        gint sides = star->sides;
        bool not_rounded = (fabs (star->rounded) < 1e-4);
@@ -443,13 +443,12 @@ sp_star_set_shape (SPShape *shape)
        // other places that call that function (e.g. the knotholder) need the exact point
 
        // draw 1st segment
-       sp_curve_moveto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
+       c->moveto(sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
        if (star->flatsided == false) {
                if (not_rounded) {
-                       sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT2, 0, true));
+                       c->lineto(sp_star_get_xy (star, SP_STAR_POINT_KNOT2, 0, true));
                } else {
-                       sp_curve_curveto (c,
-                               sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, NEXT),
+                       c->curveto(sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, NEXT),
                                sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, 0, PREV),
                                sp_star_get_xy (star, SP_STAR_POINT_KNOT2, 0, true));
                }
@@ -458,16 +457,14 @@ sp_star_set_shape (SPShape *shape)
        // draw all middle segments
        for (gint i = 1; i < sides; i++) {
                if (not_rounded) {
-                       sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
+                       c->lineto(sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
                } else {
                        if (star->flatsided == false) {
-                               sp_curve_curveto (c,
-                                               sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, i - 1, NEXT),
+                               c->curveto(sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, i - 1, NEXT),
                                                sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i, PREV),
                                                sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
                        } else {
-                               sp_curve_curveto (c,
-                                               sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i - 1, NEXT),
+                               c->curveto(sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i - 1, NEXT),
                                                sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i, PREV),
                                                sp_star_get_xy (star, SP_STAR_POINT_KNOT1, i, true));
                        }
@@ -475,10 +472,9 @@ sp_star_set_shape (SPShape *shape)
                if (star->flatsided == false) {
 
                        if (not_rounded) {
-                       sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT2, i, true));
+                       c->lineto(sp_star_get_xy (star, SP_STAR_POINT_KNOT2, i, true));
                        } else {
-                               sp_curve_curveto (c,
-                                       sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i, NEXT),
+                               c->curveto(sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, i, NEXT),
                                        sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, i, PREV),
                                        sp_star_get_xy (star, SP_STAR_POINT_KNOT2, i, true));
                        }
@@ -487,25 +483,23 @@ sp_star_set_shape (SPShape *shape)
        
        // draw last segment
                if (not_rounded) {
-                       sp_curve_lineto (c, sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
+                       c->lineto(sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
                } else {
                        if (star->flatsided == false) {
-                       sp_curve_curveto (c,
-                               sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, sides - 1, NEXT),
+                       c->curveto(sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT2, sides - 1, NEXT),
                                sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, PREV),
                                sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
                        } else {
-                       sp_curve_curveto (c,
-                               sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, sides - 1, NEXT),
+                       c->curveto(sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, sides - 1, NEXT),
                                sp_star_get_curvepoint (star, SP_STAR_POINT_KNOT1, 0, PREV),
                                sp_star_get_xy (star, SP_STAR_POINT_KNOT1, 0, true));
                        }
                }
 
-    sp_curve_closepath (c);
+    c->closepath();
     sp_lpe_item_perform_path_effect(SP_LPE_ITEM (star), c);
     sp_shape_set_curve_insync (SP_SHAPE (star), c, TRUE);
-    sp_curve_unref (c);
+    c->unref();
 }
 
 void
index 1474a43a9fefe477543f494769b8c786b60c3983..a1cb045e59f33a5adff6962380ec78fe19553a12 100644 (file)
@@ -232,7 +232,7 @@ void SPUsePath::refresh_source()
     }
     originalPath = new Path;
     originalPath->LoadArtBPath(SP_CURVE_BPATH(curve), NR::Matrix(item->transform), true);
-    sp_curve_unref(curve);
+    curve->unref();
 }
 
 
index 01331d2f8a6e3c5a4e260600b9fb527de0720b6a..a6bd60cd69743f3b68b155e4d99e1523d6b08d9c 100644 (file)
@@ -639,7 +639,7 @@ sp_selected_path_outline()
             gchar const *val = sp_repr_css_property(css, "stroke", NULL);
 
             if (val == NULL || strcmp(val, "none") == 0) {
-                sp_curve_unref(curve);
+                curve->unref();
                 continue;
             }
         }
@@ -716,7 +716,7 @@ sp_selected_path_outline()
         Path *orig = Path_for_item(item, false);
         if (orig == NULL) {
             g_free(style);
-            sp_curve_unref(curve);
+            curve->unref();
             continue;
         }
 
@@ -877,7 +877,7 @@ sp_selected_path_outline()
 
             Inkscape::GC::release(repr);
 
-            sp_curve_unref(curve);
+            curve->unref();
             selection->remove(item);
             SP_OBJECT(item)->deleteObject(false);
 
@@ -1052,7 +1052,7 @@ sp_selected_path_create_offset_object(int expand, bool updating)
     if (orig == NULL)
     {
         g_free(style);
-        sp_curve_unref(curve);
+        curve->unref();
         return;
     }
 
@@ -1089,7 +1089,7 @@ sp_selected_path_create_offset_object(int expand, bool updating)
         delete theRes;
     }
 
-    sp_curve_unref(curve);
+    curve->unref();
 
     if (res->descr_cmd.size() <= 1)
     {
@@ -1274,7 +1274,7 @@ sp_selected_path_do_offset(bool expand, double prefOffset)
         Path *orig = Path_for_item(item, false);
         if (orig == NULL) {
             g_free(style);
-            sp_curve_unref(curve);
+            curve->unref();
             continue;
         }
 
@@ -1362,7 +1362,7 @@ sp_selected_path_do_offset(bool expand, double prefOffset)
 
         did = true;
 
-        sp_curve_unref(curve);
+        curve->unref();
         // remember the position of the item
         gint pos = SP_OBJECT_REPR(item)->position();
         // remember parent
@@ -1482,11 +1482,11 @@ sp_selected_path_simplify_item(SPDesktop *desktop,
     Path *orig = Path_for_item(item, false);
     if (orig == NULL) {
         g_free(style);
-        sp_curve_unref(curve);
+        curve->unref();
         return false;
     }
 
-    sp_curve_unref(curve);
+    curve->unref();
     // remember the position of the item
     gint pos = SP_OBJECT_REPR(item)->position();
     // remember parent
@@ -1733,7 +1733,7 @@ Path_for_item(SPItem *item, bool doTransformation, bool transformFull)
         g_free(bpath); // see comment in bpath_for_curve
     }
     
-    sp_curve_unref(curve);
+    curve->unref();
     
     return dest;
 }
index 663aca60e7881464dce14ef77071bb8d33bee112..d60282d715c004122a05a9b843017c5b65a51aaf 100644 (file)
@@ -239,9 +239,9 @@ sp_tweak_context_setup(SPEventContext *ec)
         ((SPEventContextClass *) parent_class)->setup(ec);
 
     {
-        SPCurve *c = sp_curve_new_from_foreign_bpath(hatch_area_circle);
+        SPCurve *c = SPCurve::new_from_foreign_bpath(hatch_area_circle);
         tc->dilate_area = sp_canvas_bpath_new(sp_desktop_controls(ec->desktop), c);
-        sp_curve_unref(c);
+        c->unref();
         sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(tc->dilate_area), 0x00000000,(SPWindRule)0);
         sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(tc->dilate_area), 0xff9900ff, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
         sp_canvas_item_hide(tc->dilate_area);
index 60982e0360b3a8d42378f0537ba8151060c65a99..1fb179660fe4187188e66c802f8195ae706a0466 100644 (file)
@@ -1565,8 +1565,8 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
             // While drawing with the pen/pencil tool, zoom towards the end of the unfinished path
             if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
                 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
-                if (sp_curve_last_bpath(rc)) {
-                    NR::Point const zoom_to (sp_curve_last_point(rc));
+                if (rc->last_bpath()) {
+                    NR::Point const zoom_to (rc->last_point());
                     dt->zoom_relative_keep_point(zoom_to, mul*zoom_inc);
                     break;
                 }
@@ -1583,8 +1583,8 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
             // While drawing with the pen/pencil tool, zoom away from the end of the unfinished path
             if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
                 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
-                if (sp_curve_last_bpath(rc)) {
-                    NR::Point const zoom_to (sp_curve_last_point(rc));
+                if (rc->last_bpath()) {
+                    NR::Point const zoom_to (rc->last_point());
                     dt->zoom_relative_keep_point(zoom_to, 1 / (mul*zoom_inc));
                     break;
                 }