Returns a
Path
that is a copy of this path at the time of invocation.
A
NULL
is returned
if this path is empty.
Transformations that modify the
CTM
have affect on the active path itself, but they do not affect the
coordinates of the path returned by
currentpath.
| |
| Example: |
The program,
import yoix.stdio.*;
Path p;
Path copy1 = NULL;
Path copy2 = NULL;
moveto(x, y) = printf(" moveto(%.1f, %.1f);\n", x, y);
lineto(x, y) = printf(" lineto(%.1f, %.1f);\n", x, y);
closepath() = printf(" closepath();\n");
p.moveto(50, 50);
p.lineto(50, 100);
printf("\nPath before CTM change:\n");
p.pathforall(moveto, lineto, NULL, NULL, closepath);
copy1 = p.currentpath();
p.CTM.scale(.5, .5);
p.lineto(120, 60);
printf("\nPath after CTM change (and lineto):\n");
p.pathforall(moveto, lineto, NULL, NULL, closepath);
copy2 = p.currentpath();
p.scalepath(4, 4);
p.lineto(16, 32);
printf("\nPath after scalepath change (and lineto):\n");
p.pathforall(moveto, lineto, NULL, NULL, closepath);
copy3 = p.currentpath();
printf("\nCopy of path before CTM change:\n");
copy1.pathforall(moveto, lineto, NULL, NULL, closepath);
printf("\nCopy of path after CTM change (and lineto):\n");
copy2.pathforall(moveto, lineto, NULL, NULL, closepath);
printf("\nCopy of path after scalepath change (and lineto):\n");
copy3.pathforall(moveto, lineto, NULL, NULL, closepath);
prints something like
Path before CTM change:
moveto(50.0, 50.0);
lineto(50.0, 100.0);
Path after CTM change (and lineto):
moveto(100.0, 100.0);
lineto(100.0, 200.0);
lineto(120.0, 60.0);
Path after scalepath change (and lineto):
moveto(400.0, 400.0);
lineto(400.0, 800.0);
lineto(480.0, 240.0);
lineto(16.0, 32.0);
Copy of path before CTM change:
moveto(50.0, 50.0);
lineto(50.0, 100.0);
Copy of path after CTM change (and lineto):
moveto(50.0, 50.0);
lineto(50.0, 100.0);
lineto(60.0, 30.0);
Copy of path after scalepath change (and lineto):
moveto(200.0, 200.0);
lineto(200.0, 400.0);
lineto(240.0, 120.0);
lineto(8.0, 16.0);
on standard output.
Notice how the path coordinates changed after we scaled the
CTM
associated with the path, but the output of
currentpath
retained the original frame of reference.
However, built-ins such as
scalepath
do affect both.
| | |
| Return: |
Point
| | |
| See Also: |
arc,
arcn,
closepath,
currentpoint,
curveto,
flattenpath,
Graphics,
lineto,
moveto,
newpath,
pathbbox,
pathforall,
quadto,
rcurveto,
rlineto,
rmoveto,
rquadto
|
|