Wysłane przez lukasz w
- Wielkość pliku: 1,1MB
import java.awt.Color;
import java.awt.image.*;
public class sample
{
public BufferedImage draw()
{
int WIDTH = 800;
int HEIGHT = 600;
int IMG_TYPE = java.awt.image.BufferedImage.TYPE_INT_ARGB;
BufferedImage image = new BufferedImage(WIDTH, HEIGHT, IMG_TYPE);
ColorModel model = image.getColorModel();
WritableRaster raster = image.getRaster();
Color fcolor;
for(int i = 0; i < WIDTH; i++)
for(int j = 0; j < HEIGHT; j++) {
fcolor = new Color((0xffff & (i*j)) << 8 );
raster.setDataElements(i, j,
model.getDataElements(fcolor.getRGB(), null));
}
return image;
}
}
