| imagepath |
(Image image [, Matrix mtx]) |
typedict.Graphics |
| |
Appends the outline of the
image
to the current path.
The result depends on the
image
and the optional
mtx
argument, which is an arbitrary transformation that would be applied to the
image
if it were painted by
showimage,
but in most cases it is the smallest rectangle that covers
image.
imagepath
aborts with a
nocurrentpoint
error if
path
is empty.
| |
| Example: |
The program,
import yoix.*.*;
Image img = {
String source = "http://www.yoix.org/imgs/ATTlogo.gif";
Array metrics = {-0.5, -.5, 0.0, 0.0};
int type = TYPE_GRAY;
};
JFrame f = {
Color background = Color.black;
paint(Rectangle r) {
graphics {
gsave();
rectclip(r);
recterase(r);
translate(144, 144);
rotate(15);
setrgbcolor(1, 0, 0);
linewidth = 2;
moveto(0, 0);
rlineto(300, 0);
moveto(0, 0);
rlineto(0, 300);
stroke();
moveto(0, 0);
gsave();
showimage(img, .8);
grestore();
imagepath(img);
stroke();
grestore();
}
}
};
f.visible = TRUE;
converts the image to a grayscale version and then uses
showimage
and
imagepath
to draw and outline the image.
Much of what happens is controlled by the
metrics
array defined in
img.
The two non-zero numbers in
metrics
are x and y side bearings that determine where the image's upper
left corner goes relative to the current point.
Both values are multiplied by the image's width and height to get the actual
numbers that are used.
| | |
| Return: |
none
| | |
| See Also: |
ashow,
awidthshow,
charpath,
kshow,
show,
showimage,
stringadvance,
stringbounds,
stringwidth,
widthshow
|
|
Yoix is a registered trademark of AT&T Inc.
|