Logo Search packages:      
Sourcecode: inkscape version File versions

GSList* sp_curve_split ( SPCurve const *  curve  ) 

Returns a list of new curves corresponding to the subpaths in curve.

Definition at line 298 of file curve.cpp.

References SPCurve::bpath, SPCurve::closed, SPCurve::end, SPCurve::hascpt, sp_curve_new_sized(), and SPCurve::substart.

{
    g_return_val_if_fail(curve != NULL, NULL);

    gint p = 0;
    GSList *l = NULL;

    while (p < curve->end) {
        gint i = 1;
        while ((curve->bpath[p + i].code == NR_LINETO) ||
               (curve->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));
        new_curve->end = i;
        new_curve->bpath[i].code = NR_END;
        new_curve->substart = 0;
        new_curve->closed = (new_curve->bpath->code == NR_MOVETO);
        new_curve->hascpt = (new_curve->bpath->code == NR_MOVETO_OPEN);
        l = g_slist_append(l, new_curve);
        /* effic: Use g_slist_prepend instead.  Either work backwards from the end of curve,
           or work forwards as at present but do g_slist_reverse before returning. */
        p += i;
    }

    return l;
}


Generated by  Doxygen 1.6.0   Back to index