AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
curveto (Number x1, Number y1, Number x2, Number y2, Number x3, Number y3) typedict.Path
 
Adds a Bezier cubic curve to this path that extends from the current point, if there is one, to (x3, y3), which becomes the new current point, and uses (x1, y1) and (x2, y2) as control points. The points are all transformed using the CTM associated with this path when curveto is called, which means subsequent changes to CTM do not affect this curve. If this path is empty curveto will abort with a nocurrentpoint error.
 
 Example:   The program,
import yoix.stdio.*;

Path p;

moveto(x, y) = printf(" moveto(%.1f, %.1f);\n", x, y);

curveto(x1, y1, x2, y2, x3, y3) {
    printf(" curveto(");
    printf("%.1f, %.1f, ", x1, y1);
    printf("%.1f, %.1f, ", x2, y2);
    printf("%.1f, %.1f", x3, y3);
    printf(")\n");
}

p.moveto(100, 100);
p.curveto(200, 200, 400, 300, 500, 300);

printf("Output before CTM change:\n");
p.pathforall(moveto, NULL, NULL, curveto, NULL);
p.CTM.scale(2, 2);
printf("\nOutput after CTM change:\n");
p.pathforall(moveto, NULL, NULL, curveto, NULL);
prints something like
Output before CTM change:
 moveto(100.0, 100.0);
 curveto(200.0, 200.0, 400.0, 300.0, 500.0, 300.0)

Output after CTM change:
 moveto(50.0, 50.0);
 curveto(100.0, 100.0, 200.0, 150.0, 250.0, 150.0);
on standard output. Notice how the coordinates changed after we scaled the CTM associated with the path.
 
 Return:   Path
 
 See Also:   arc, arcn, closepath, currentpath, currentpoint, flattenpath, Graphics, lineto, moveto, newpath, pathbbox, pathforall, quadto, rcurveto, rlineto, rmoveto, rquadto

 

Yoix is a registered trademark of AT&T Inc.