| transform |
(Number x, Number y) |
typedict.Matrix |
| transform |
(Point p) |
|
| transform |
(Rectangle r) |
|
| |
Uses this matrix 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
transform.
When
transform
is called with a
Point
as the argument the transformation is applied to
(p.x, p.y)
and the result is returned as the coordinates of a new
Point.
Two different transformations are applied when
transform
is called with a
Rectangle
as the argument.
The corner of that rectangle is transformed as described above,
the equivalent of
dtransform
is applied to
(r.width, r.height)
and the two results are combined in a new
Rectangle
which is the value returned by
transform.
The values of
sx,
shx,
tx,
sy,
shy,
and
ty
used in the transformation are the obtained directly from this matrix.
We often refer to this as a transformation from "user space" to
"device space", despite the fact that the transformed point may
not have anything to do with a physical device, like your screen.
| |
| Example: |
Here is a simple program,
import yoix.stdio.*;
Point pt = VM.screen.defaultmatrix.transform(72, 72);
printf("horizontal resolution: %.1f\n", pt.x);
printf(" vertical resolution: %.1f\n", pt.y);
that figures out the resolution of your screen by transforming
a point from the default user space describe by
VM.screen.defaultmatrix
to device space.
| | |
| Return: |
Point
or
Rectangle
| | |
| See Also: |
concat,
concatmatrix,
currentmatrix,
dividematrix,
dtransform,
Graphics,
identmatrix,
idtransform,
initmatrix,
invertmatrix,
itransform,
maptopixel,
rotate,
scale,
setmatrix,
shear,
translate
|
|
Yoix is a registered trademark of AT&T Inc.
|