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
itransform (Number x, Number y) typedict.Matrix
itransform (Point p)  
transform (Rectangle r)  
 
Makes an internal copy of this matrix, which is inverted and then used to transform the point
(x, y)
to the corresponding point,
(sx*x + shx*y + tx, sy*y + shy*x + ty)
which are the coordinates of the Point returned by itransform. If this matrix has no inverse NULL is returned. When itransform is called with a Point as the argument the transformation is applied to the point
(p.x, p.y)
and the result is returned as the coordinates of a new Point. Two different transformations are applied when itransform is called with a Rectangle as the argument. The corner of that rectangle is transformed as described above, the equivalent of idtransform is applied to
(r.width, r.height)
and the two results are combined in a new Rectangle which is the value returned by itransform.

The values of sx, shx, tx, sy, shy, and ty used in the transformation are the obtained from the inverted matrix. We often refer to this as a transformation from "device space" to "user space", despite the fact that the original point may not have anything to do with a physical device, like your screen.
 
 Example:   The program,
import yoix.*.*;

JWindow f = {
    Color background = Color.red;

    Point location = {
        double x = 72;
        double y = 72;
    };

    paint(Rectangle rect) {
        Point ul;
        Point lr;

        graphics {              // "named block"
            gsave();
            ul = itransform(2, 2);
            lr = transform(size.width,  size.height);
            lr.x = lr.x - 2;
            lr.y = lr.y - 2;
            lr = itransform(lr);
            moveto(ul.x, ul.y);
            lineto(ul.x, lr.y);
            lineto(lr.x, lr.y);
            lineto(lr.x, ul.y);
            closepath();
            setrgbcolor(0, 0, 1);
            fill();
            grestore();
        }
    }
};

f.visible = TRUE;
uses itransform and transform to help fill a blue rectangle that lies exactly 2 pixels from the edge of a window that has a red background.
 
 Return:   Point
 
 See Also:   concat, concatmatrix, currentmatrix, dividematrix, dtransform, Graphics, identmatrix, idtransform, initmatrix, invertmatrix, maptopixel, rotate, scale, setmatrix, shear, transform, translate

 

Yoix is a registered trademark of AT&T Inc.