- BufferedImage.
:
1: :
public static Color determineColor(BufferedImage img, int x, int y, int w, int h) {
int cx = x + (int)(w / 2);
int cy = y + (int)(h / 2);
return new Color(img.getRGB(cx, cy), true);
}
determineColor BufferedImage .
2: :
BufferedImage sourceImg = ...;
BufferedImage destimg = ...;
Graphics g = destImg.createGraphics();
int blockSize = 8;
for (int i = 0; i < sourceImg.getWidth(); i += blockSize) {
for (int j = 0; j < sourceImg.getHeight(); j += blockSize) {
Color c = determineColor(sourceImg, i, j, blockSize, blockSize);
g.setColor(c);
g.fillRect(i, j, blockSize, blockSize);
}
}
g.dispose();
, , - , . . , .
:
http://coobird.net/img/grad64.png http://coobird.net/img/grad64p.png