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
drawLine (Object obj, Number x0, Number y0, Number x1, Number y1) yoix.graphics
 
Draws a line 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), from point (x0,y0) to point (x1,y1). The line is drawn in the foreground color selected by the Graphics object associated with obj.
 
 Example:   The program,
import yoix.*.*;

JFrame frame = {
    Array layout = {
        new JCanvas {
            Color background = Color.black;

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

            paint(clip) {
                drawLine(
                    this,
                    72.0/4, 72.0/4,
                    size.width - 72.0/4, size.height - 72.0/4
                );
            }
        },
    };
};

frame.visible = TRUE;
sleep(5);
exit(0);
defines a paint function in a canvas that draws a red line that starts near the upper left corner and ends close to the lower right corner of the canvas.
 
 See Also:   clearRect, copyArea, drawArc, drawImage, 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.