| rectIntersectionRect |
(Rectangle rect1, Rectangle rect2) |
yoix.graphics |
| rectIntersectionRect |
(Rectangle rect1, Number x, Number y, Number width, Number height) |
|
| |
Returns a rectangle that represents the intersection of
rect1
and
rect2
or
NULL
if they don't intersect.
The second rectangle can also be supplied by giving its
width,
height,
and coordinates of its upper left corner
(x,y).
| |
| Example: |
The program,
import yoix.*.*;
JFrame frame = {
Rectangle rect1;
Rectangle rect2;
Rectangle rect3;
paint() {
rect1.x = 36;
rect1.y = 72;
rect1.width = 4.0*72.0;
rect1.height = 2.0*71.0;
rect2.x = root.size.width - 5.0*72.0;
rect2.y = root.size.height - 3.5*72.0;
rect2.width = 4.0*72.0;
rect2.height = 2.0*72.0;
rect3 = rectIntersectionRect(rect1, rect2);
graphics {
gsave();
setrgbcolor(Color.red);
rectstroke(rect1);
setrgbcolor(Color.blue);
rectstroke(rect2);
if (rect3 != NULL) {
setrgbcolor(Color.magenta);
rectfill(rect3);
}
grestore();
}
}
};
frame.visible = TRUE;
draws the outline of two rectangles and fills the rectangle that
represents their intersection.
The rectangles are drawn at fixed positions relative to the upper
left and lower right corners of the frame, so you can change the
intersection by resizing the frame.
| | |
| See Also: |
clearRect,
copyArea,
drawArc,
drawImage,
drawLine,
drawOval,
drawPolygon,
drawPolyline,
drawRect,
drawRoundRect,
drawString,
fillArc,
fillOval,
fillPolygon,
fillRect,
fillRoundRect,
pointInPolygon,
pointInRect,
rectContainsRect,
rectIntersectsRect,
rectUnionRect,
stringBounds,
stringWidth
|
|
Yoix is a registered trademark of AT&T Inc.
|