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
clearRect (Object obj, Number x, Number y, Number w, Number h) yoix.graphics
 
Clears a rectangle in obj, which must be an Image or a drawable component (i.e., a Swing or AWT component, like a JCanvas, JFrame, or Canvas, that supports a paint function), that is w units wide, h units high, and has its upper left corner at the point (x,y) by filling it with obj's background color. It is important to remember that an image always has fixed background color, but that the background color of a drawable component like a JCanvas that has not been explicitly set is inherited from the containers that are used to display the canvas.
 
 Example:   The program,
import yoix.*.*;

JCanvas c = {
    Color background = Color.black;

    Graphics graphics = {
        Color foreground = Color.blue;
    };

    paint(clip) {
        fillOval(this, 72.0/2, 72.0/2, 72*3, 72*4);
        clearRect(this, 72, 72, 72, 72);
    }
};

JFrame frame = {
    Array layout = {c};
};

frame.visible = TRUE;
sleep(3);
c.background = Color.red;
sleep(5);
exit(0);
defines a paint function in a canvas that draws a blue ellipse with a 1 inch erased square. The canvas is displayed in a frame for 3 seconds and then automatically repainted using a red background and displayed for another 5 seconds.
 
 See Also:   copyArea, drawArc, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, pointInPolygon, pointInRect, rectContainsRect, rectIntersectionRect, rectIntersectsRect, rectUnionRect, stringBounds, stringWidth

 

Yoix is a registered trademark of AT&T Inc.