| setgradient |
(Color c0, Number x0, Number y0, Color c1, Number x1, Number y1 [, int cycle]) |
typedict.Graphics |
| |
Sets
foreground
to a value (an
Array
that contains the arguments)
that arranges to paint on
drawable
with colors that change smoothly from
c0
at the point
(x0, y0)
to
c1
and point
(x1, y1).
When the optional
cycle
argument is non-zero colors cycle naturally beyond the ends of the
line segment that connects
(x0, y0)
to
(x1, y1).
| |
| Example: |
The program,
import yoix.*.*;
JFrame f = {
Color background = Color.black;
Graphics graphics = {
double linewidth = 24;
double linecap = CAP_ROUND;
};
mousePressed(MouseEvent e) {
graphics { // "named block"
if (e.modifiers & BUTTON2_MASK)
erasedrawable();
moveto(e.coordinates.x, e.coordinates.y);
}
}
mouseDragged(MouseEvent e) {
double x = e.coordinates.x;
double y = e.coordinates.y;
graphics { // "named block"
setgradient(Color.red, 72, 72, Color.green, 300, 300);
lineto(x, y);
stroke();
moveto(x, y);
}
}
};
f.visible = TRUE;
defines
MouseEvent
handlers in a frame that stroke thick lines that track the cursor and
are drawn using a gradient that changes from red at the point
(72, 72)
to green at
(100, 100)
as the foreground.
See what happens when you add a
cycle
argument to the
setgradient
call.
| | |
| Return: |
none
| | |
| See Also: |
grestore,
grestoreall,
gsave,
initclip,
initgraphics,
setcmykcolor,
setdash,
setfont,
setgray,
sethsbcolor,
setlinecap,
setlinejoin,
setlinewidth,
setmiterlimit,
setpath,
setrgbcolor,
settexture
|
|
Yoix is a registered trademark of AT&T Inc.
|