Makes an internal copy of this matrix, which is inverted
and then used 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
idtransform.
If this matrix has no inverse
NULL
is returned.
When
idtransform
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 from the inverted matrix.
We often refer to this as a transformation from "device space" to
"user space", despite the fact that the original displacement
may not have anything to do with a physical device, like your screen.
| |
| Example: |
The program,
import yoix.*.*;
Dimension pixels = VM.screen.defaultmatrix.idtransform(120, 60);
Image img = {
Dimension size = pixels;
Color background = Color.blue;
paint() {
double cx = size.width/2;
double cy = size.height/2;
graphics { // "named block"
initgraphics();
antialiasing = TRUE;
translate(cx, cy);
arc(0, 0, 1, 0, 360, .8*cx, .8*cy);
setrgbcolor(1, 0, 0);
fill();
}
}
};
JFrame f = {
paint(Rectangle rect) {
graphics.moveto(36, 36);
graphics.showimage(img);
}
};
f.visible = TRUE;
uses
idtransform
to help create an image that is exactly 120 pixels wide and 60 pixels high,
paints a red ellipse in that image, and then uses showimage, which is defined in
Graphics,
to display it near the upper left corner of a frame.
| | |
| Return: |
Dimension
| | |
| See Also: |
concat,
concatmatrix,
currentmatrix,
dividematrix,
dtransform,
Graphics,
identmatrix,
initmatrix,
invertmatrix,
itransform,
maptopixel,
rotate,
scale,
setmatrix,
shear,
transform,
translate
|
|