| arcn |
(Number x, Number y, Number r, Number a1, Number a2 [, Number sx, Number sy]) |
typedict.Path |
| |
Adds an arc to this path, just like
arc,
but the angles are interpreted in a way that makes the arc go in the
opposite direction.
The arc has its center at
(x, y),
radius
r,
and extends from angle
a1
to angle
a2,
which are interpreted as degrees and measured in the direction that takes
the positive x-axis into the negative y-axis when the angle is positive.
All numbers are transformed using the
CTM
associated with this path when
arcn
is called, which means subsequent changes to
CTM
do not affect this arc.
If there is a current point
arcn
draws a line segment from that point to the first endpoint,
(r*cos(a1), r*sin(a1))
and then draws an arc from that point to the second endpoint,
(r*cos(a2), r*sin(a2))
which becomes the new current point.
The arc is circular in user space unless the optional scaling arguments
sx
and
sy
say otherwise.
Omitting
sx
and
sy
or supplying them with values of
1.0
are equivalent.
| |
| Example: |
The program
import yoix.*.*;
JFrame f = {
Color background = Color.white;
paint(Rectangle r) {
graphics { // "named block"
gsave();
translate(size.width/2, size.height/2);
scale(2, -2);
newpath();
arcn(0, 0, 50, 45, 135);
arc(0, 0, 25, 135, 45);
gsave(); // saves path
setgray(.5);
fill();
grestore(); // restores path
setrgbcolor(1, 0, 0);
stroke();
grestore();
}
}
};
f.visible = TRUE;
creates a path using
arcn
and
arc
that we first fill with a shade of gray and then outline in red.
Notice how we saved the path before filling it and omitted a
closepath
after describing the last arc.
This example and the one in the
arc
reference page are almost identical, but they produce different results
that you should be able to explain.
| | |
| Return: |
Path
| | |
| See Also: |
arc,
closepath,
currentpath,
currentpoint,
curveto,
flattenpath,
Graphics,
lineto,
moveto,
newpath,
pathbbox,
pathforall,
quadto,
rcurveto,
rlineto,
rmoveto,
rquadto
|
|
Yoix is a registered trademark of AT&T Inc.
|
|