| infill |
(Point p) |
typedict.Graphics |
| infill |
(Number x, Number y) |
|
| |
Returns non-zero if
p
or the point
(x, y)
lies inside the current
path,
as determined by the non-zero winding rule, and non-zero otherwise.
| |
| Example: |
The program,
import yoix.*.*;
JFrame f = {
paint() {
graphics { // "named block"
if (currentpoint() == NULL) {
translate(72, 144);
rotate(-45);
scale(.5, .5);
shear(0, .5);
moveto(72, 72);
rlineto(72*2, 0);
rlineto(0, 72*3);
rlineto(-72*2, 0);
closepath();
}
gsave();
fill();
grestore();
}
}
mousePressed(MouseEvent e) {
printf("hit=%d\n", graphics.infill(e.coordinates));
}
};
f.visible = TRUE;
defines a paint function in a frame that builds a simple path in a
transformed coordinate system, fills it, and then uses
infill
in to decide if a button was pressed when the cursor was inside the path.
Notice that we used
e.coordinates
rather than
e.location
in the event handler.
Both values are defined and can be identical, but
e.location
always represents the location of the event in the Yoix default
coordinate system, while
e.coordinates
are the user space coordinates of the event in the frame,
which depend on the values stored in
CTM
when the event arrives.
| | |
| Return: |
int
| | |
| See Also: |
clip,
clippath,
drawablebbox,
eoclip,
eoerase,
eofill,
erase,
erasedrawable,
fill,
ineofill,
instroke,
rectbutton,
rectclip,
rectcopy,
recterase,
rectfill,
rectmove,
rectstroke,
stroke,
strokepath
|
|
Yoix is a registered trademark of AT&T Inc.
|