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 258 of file curve.cpp.

References SPCurve::_bpath, SPCurve::closed, NArtBpath::code, SPCurve::end, SPCurve::hascpt, NR_CURVETO, NR_END, NR_LINETO, NR_MOVETO, NR_MOVETO_OPEN, 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_prepend(l, new_curve);
        p += i;
    }

    return l;
}


Generated by  Doxygen 1.6.0   Back to index