| setpixel |
(int column, int row, Color color) |
typedict.Image |
| |
Sets the
Color
of the pixel located at
column
and
row
in this image to
color,
and returns the previous color or
NULL
if either
column
or
row
are out of bounds.
| |
| Example: |
The program,
import yoix.*.*;
Image img_att = {
String source = "http://www.yoix.org/imgs/ATTlogo.gif";
Array metrics = {0, 0, 1.1, 1};
paint() {
int n;
for (n = 0; setpixel(n, 0, Color.red) != null; n += 2) ;
for (n = 0; setpixel(n, rows - 1, Color.red) != null; n += 2) ;
}
};
JFrame f = {
Color background = Color.lightGray;
paint(Rectangle r) {
graphics {
rectclip(r);
moveto(72, 72);
showimage(img_att);
showimage(img_att);
initclip();
}
}
};
f.visible = TRUE;
uses
setpixel
to change the color of every other pixel along the top
and bottom rows to red.
We draw the image several times in a frame using showimage, which is defined in
Graphics,
to illustrate how the
metrics
array in the image affects the results.
| | |
| Return: |
Color
| | |
| See Also: |
convert,
convolve,
getpixel,
replace,
rescale,
transform
|
|
Yoix is a registered trademark of AT&T Inc.
|