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
translatepath (Number dx, Number dy) typedict.Path
 
Translates this path by the displacement
(dx, dy)
where dx and dy are distances in user space that are transformed into device space to obtain the horizontal and vertical displacements that are applied to every point in this path. We can talk about horizontal and vertical translation because the coordinates of the points in a path are always assumed to be stored in device space, which closely matches the device-dependent coordinate system that Java assigns to your screen.
 
 Example:   The program,
import yoix.*.*;

Path p1;
Path p2;

p1 {        // "named block"
    moveto(0, 0);
    rlineto(72, 0);
    rlineto(0, 36);
    closepath();
    rmoveto(72, 36);
}

p2 {        // "named block"
    moveto(0, 0);
    rlineto(72, -36);
}

JFrame f = {
    Color background = Color.white;

    paint(Rectangle r) {
        graphics {        // "named block"
            moveto(72, 72);
            appendpath(p1);
            appendpath(p2);
            appendpath(p1);
            translatepath(72, 144);
            gsave();
            setrgbcolor(0, 0, 1);
            fill();
            grestore();
            setrgbcolor(1, 0, 0);
            stroke();
        }
    }
};

f.visible = TRUE;
defines a paint function in a frame that fills and strokes a path that is built from two separate paths using appendpath and translatepath.
 
 Return:   Path
 
 See Also:   appendpath, Graphics, rotatepath, scalepath, shearpath, transformpath

 

Yoix is a registered trademark of AT&T Inc.