The following piece of code produces a one-dimensional array of pixels (stored in src_1d) from the image contained in src.
PixelGrabber pg1 = new PixelGrabber(src,0,0,i_w,i_h,src_1d,0,i_w);
try {
pg1.grabPixels();
} catch (InterruptedException e) {
System.err.println("InterruptedException!");
return;
}
if (pg1.status() & ImageObserver.ABORT) return;
src_1d will contain the pixel values required provided that the
operation executes smoothly.
The method grabPixels()
initiates the pixel acquisition process.