BufferedImage bi = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = bi.createGraphics();
int [] pixels = new int[width*height];
PixelGrabber pg = new PixelGrabber(bi, 0, 0, width, height, pixels, 0, width);
g2.setPaint(Color.red);
g2.draw(new Line2D.Double(0,0,10,10));
try { pg.grabPixels(); } 
catch (InterruptedException e) { System.err.println("interrupted waiting for pixels!"); } 
for(int i=0;i<24*24;i++) System.out.println(pixels[i]);为什么输出的每个值都是一样的,难道g2.draw不对bi的像素值进行操作吗?那这样有何意义呢?我们又看不到画出来的图形,bi的内容也没变。
有办法让画图形之后,对应的bi内容发生对应的变化来记载该图形的像素吗?