Logo Search packages:      
Sourcecode: inkscape version File versions

void sp_curve_append ( SPCurve curve,
SPCurve const *  curve2,
bool  use_lineto 
)

Append curve2 to curve.

Definition at line 775 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_closepath(), sp_curve_curveto(), sp_curve_lineto(), and sp_curve_moveto().

Referenced by sp_curve_append_continuous().

{
    g_return_if_fail(curve != NULL);
    g_return_if_fail(curve2 != NULL);

    if (curve2->end < 1)
        return;

    NArtBpath const *bs = curve2->_bpath;

    bool closed = curve->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);
                    use_lineto = FALSE;
                } else {
                    if (closed) sp_curve_closepath(curve);
                    sp_curve_moveto(curve, bp->x3, bp->y3);
                }
                closed = false;
                break;

            case NR_MOVETO:
                if (use_lineto && curve->hascpt) {
                    sp_curve_lineto(curve, bp->x3, bp->y3);
                    use_lineto = FALSE;
                } else {
                    if (closed) sp_curve_closepath(curve);
                    sp_curve_moveto(curve, bp->x3, bp->y3);
                }
                closed = true;
                break;

            case NR_LINETO:
                sp_curve_lineto(curve, bp->x3, bp->y3);
                break;

            case NR_CURVETO:
                sp_curve_curveto(curve, bp->x1, bp->y1, bp->x2, bp->y2, bp->x3, bp->y3);
                break;

            case NR_END:
                g_assert_not_reached();
        }
    }

    if (closed) {
        sp_curve_closepath(curve);
    }
}


Generated by  Doxygen 1.6.0   Back to index