Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_curve_closepath_current ( SPCurve curve  ) 

Like sp_curve_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.

Todo:
effic: Maintain a count of NR_MOVETO_OPEN's (e.g. instead of the closed boolean).

Definition at line 581 of file curve.cpp.

References SPCurve::_bpath, SPCurve::closed, NArtBpath::code, SPCurve::end, SPCurve::hascpt, SPCurve::moving, NR_END, NR_MOVETO, NR_MOVETO_OPEN, SPCurve::posSet, SPCurve::substart, NArtBpath::x3, and NArtBpath::y3.

{
    g_return_if_fail(curve != NULL);
    g_return_if_fail(curve->hascpt);
    g_return_if_fail(!curve->posSet);
    g_return_if_fail(!curve->closed);
    /* We need at least moveto, curveto, end. */
    g_return_if_fail(curve->end - curve->substart > 1);

    {
        NArtBpath *bs = curve->_bpath + curve->substart;
        NArtBpath *be = curve->_bpath + curve->end - 1;

        be->x3 = bs->x3;
        be->y3 = bs->y3;

        bs->code = NR_MOVETO;
    }
    curve->closed = true;

    for (NArtBpath const *bp = curve->_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;
            break;
        }
    }

    curve->hascpt = false;
    curve->moving = false;
}


Generated by  Doxygen 1.6.0   Back to index