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

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
show (String str [, double alpha]) typedict.Graphics
 
Draws the characters in str on drawable starting at the current point, which is adjusted as the characters in str are printed. Character outlines come from font and are painted using foreground and the optional alpha argument, which should be a number between 0.0 and 1.0, as the alpha value. Omitting alpha or supplying a value of 1.0 are equivalent. show aborts with a nocurrentpoint error if path is empty.

show may or may not process the characters in str individually (the details are font and implementation dependent), but it will always be the simplest and fastest way to paint str on drawable. The first character in str is placed at the current point, which is adjusted horizontally by the width of that character before the second character is printed. The process stops after the last character in str is printed.
 
 Example:   The program,
import yoix.*.*;

JFrame f = {
    Graphics graphics = {
        String font = "Lucida-bold-24";
        Color  foreground = Color.red;
    };

    paint(Rectangle r) {
        String text = "hello, world";

        graphics {        // "named block"
            gsave();
            rectclip(r);
            translate(drawable.size.width/2, drawable.size.height/2);
            rotate(-30);
            moveto(-stringwidth(text)/2, 0);
            show(text);
            grestore();
        }
    }
};

f.visible = TRUE;
defines a paint function in a frame that draws a string of characters near the center of the frame using show.
 
 Return:   none
 
 See Also:   ashow, awidthshow, charpath, imagepath, kshow, showimage, stringadvance, stringbounds, stringwidth, widthshow

 

Yoix is a registered trademark of AT&T Intellectual Property.