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
showimage (Image image [, Matrix mtx] [, double alpha]) typedict.Graphics
 
Draws image on drawable at the current point, which is then adjusted based on the metrics defined in image. A transformation specified by the optional mtx argument can be applied as the image as it is painted on drawable using 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. showimage aborts with a nocurrentpoint error if path is empty.
 
 Example:   The program,
import yoix.*.*;

Image img = {
    String source = "http://www.yoix.org/imgs/ATTlogo.gif";
    Array metrics = {.5, -1.0, 1.0, .25};
};

JFrame f = {
    Color background = Color.black;

    paint(Rectangle r) {
        graphics {        // "named block"
            gsave();
            rectclip(r);
            recterase(r);
            translate(72, 72);
            rotate(15);
            setrgbcolor(1, 0, 0);
            linewidth = 2;
            moveto(72, 72);
            rlineto(300, 0);
            moveto(72, 72);
            rlineto(0, 300);
            stroke();
            moveto(72, 72);
            showimage(img, .5);
            showimage(img, .7);
            showimage(img, .9);
            grestore();
        }
    }
};

f.visible = TRUE;
uses showimage to draw an image several times in a simple rotated coordinate system using different alpha values. Much of what happens is controlled by the metrics array defined in img (see Image for more details). In this example the first two numbers in metrics are x and y side bearings that determine where the image's upper left corner goes relative to the current point. The last two numbers in metrics are x and y widths that are added to the current point after the image is drawn. The four metrics values are multiplied by the image's width and height to get the actual numbers that are used.
 
 Return:   none
 
 See Also:   ashow, awidthshow, charpath, imagepath, kshow, show, stringadvance, stringbounds, stringwidth, widthshow

 

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