AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
rectUnionRect (Rectangle rect1, Rectangle rect2) yoix.graphics
rectUnionRect (Rectangle rect1, Number x, Number y, Number width, Number height)  
 
Returns a rectangle that represents the union of rect1 and rect2. 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 = {
    Color background = Color.black;

    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 = rectUnionRect(rect1, rect2);

        graphics {
            gsave();
            setrgbcolor(Color.red);
            rectfill(rect1);
            setrgbcolor(Color.blue);
            rectfill(rect2);
            if (rect3 != NULL) {
                setrgbcolor(Color.white);
                rectstroke(rect3);
            }
            grestore();
        }
    }
};

frame.visible = TRUE;
fills two rectangles and then draws the outline of the rectangle that represents their union. The rectangles are drawn at fixed positions relative to the upper left and lower right corners of the frame, so you can change the union 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, rectIntersectionRect, rectIntersectsRect, stringBounds, stringWidth

 

Yoix is a registered trademark of AT&T Inc.