| grestore |
([String tag]) |
typedict.Graphics |
| |
|
Restores the last graphics state saved by
gsave
and returns the number of saved states remaining after the restore.
The optional
tag
argument is a string that selects the most recent graphics state saved by
gsave
with that
tag
as the one to restore.
grestore
does nothing if there were no saved states or if state associated with
tag
could not be found.
Even though
gsave
and
grestore
affect the entire graphics state, they are reasonably efficient and
are often used to preserve one value, like the current path.
For example, path rendering built-ins often clear the current path,
so surrounding a
fill
or
stroke
call by
gsave
and
grestore
is an easy way to preserve the path.
| |
| Example: |
The program,
import yoix.*.*;
JFrame f = {
Color background = Color.white;
paint(Rectangle r) {
graphics { // "named block"
gsave();
rectclip(r);
translate(72, 72);
moveto(0, 0);
rlineto(144, 0);
rlineto(0, 72);
closepath();
gsave();
setcmykcolor(0, 0, 1);
fill();
grestore();
setrgbcolor(1, 0, 0);
stroke();
grestore();
}
}
};
f.visible = TRUE;
defines a paint function in a frame that fills a yellow triangle
and then draws the outline of that triangle in red.
| | |
| Return: |
int
| | |
| See Also: |
grestoreall,
gsave,
initclip,
initgraphics,
setcmykcolor,
setdash,
setfont,
setgradient,
setgray,
sethsbcolor,
setlinecap,
setlinejoin,
setlinewidth,
setmiterlimit,
setpath,
setrgbcolor,
settexture
|
|
Yoix is a registered trademark of AT&T Inc.
|