| dtransform |
(Number dx, Number dy) |
typedict.Matrix |
| dtransform |
(Dimension d) |
|
| |
Uses this matrix to transform the displacement
(dx, dy)
to the corresponding displacement,
(sx*dx + shx*dy, sy*dy + shy*dx)
which are stored in the width and height fields of the
Dimension
returned by
dtransform.
When
dtransform
is called with one argument the transformation is applied to the displacement
(d.width, d.height)
and the result is returned in the width and height fields of a new
Dimension.
The values of
sx,
shx,
sy,
and
shy
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 displacement
may not have anything to do with a physical device,
like your screen.
| |
| Example: |
Although not normally recommended, here is a small program,
import yoix.*.*;
Dimension res = VM.screen.defaultmatrix.dtransform(72, 72);
JFrame f = {
Graphics graphics = {
Matrix CTM = new Matrix;
};
paint(Rectangle rect) {
graphics.rectfill(50, 150, 2*res.width, 50);
}
};
f.visible = TRUE;
that works in pixels, because
graphics.CTM
is the identity matrix, but can also draw in inches because it
knows your screen's resolution.
The rectangle will always be 2 inches wide, but its height and position
are device dependent.
| | |
| Return: |
Dimension
| | |
| See Also: |
concat,
concatmatrix,
currentmatrix,
dividematrix,
Graphics,
identmatrix,
idtransform,
initmatrix,
invertmatrix,
itransform,
maptopixel,
rotate,
scale,
setmatrix,
shear,
transform,
translate
|
|
Yoix is a registered trademark of AT&T Inc.
|