| transform |
(Matrix mtx) |
typedict.Image |
| |
|
Applies the transformation
mtx
to this image and returns this image to the caller.
The final result is scaled to fit
size
if that field has been explicitly set,
otherwise
transform
determines the width and height of the resulting image.
transform
tries hard to produce useful results, which for the most part can be
understood by assuming the origin of this image is located at its
center and then realizing that the entire image will visible unless
mtx
introduces translations.
| |
| Example: |
The program,
import yoix.*.*;
Image img = {
String source = "http://www.yoix.org/imgs/ATTlogo.gif";
int type = TYPE_RGB_ALPHA;
paint() {
Matrix mtx;
graphics { // "named block"
gsave();
sethsbcolor(.8, .5, .7);
moveto(9, 9);
rlineto(36, 0);
rlineto(0, 18);
closepath();
fill(.5);
grestore();
}
this.transform(mtx.rotate(30));
}
};
JFrame f = {
Color background = Color.yellow;
Insets border = {
int left = 72/8;
int top = 72/8;
int right = 72/8;
int bottom = 72/8;
};
paint(Rectangle rect) {
graphics {
gsave();
rectclip(rect);
drawImage(this, img, 72, 72);
grestore();
}
}
};
f.visible = TRUE;
paints a partially transparent purple triangle in an image,
which is then rotated 30 degrees and drawn near the upper left corner
of a frame that has a yellow background.
Setting the type of the image to
TYPE_RGB_ALPHA
means the image's background does not show up;
you should experiment with other values, like
TYPE_RGB
or
TYPE_GRAY.
| | |
| Return: |
Image
| | |
| See Also: |
convert,
convolve,
getpixel,
replace,
rescale,
setpixel
|
|
Yoix is a registered trademark of AT&T Inc.
|