package subPicture;

import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.WritableRaster;

public class SubPictureCall {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		BufferedImage image = null;
		boolean hasAlpha = image.getColorModel().hasAlpha();	// test if alpha channel exists
		
		WritableRaster raster = image.getRaster();
		DataBuffer dataBuffer = raster.getDataBuffer();
		
		// create an object for the pixel data:
		int[] pixel;
		if(hasAlpha)				// needed to avoid exceptions
			pixel = new int[4];
		else
			pixel = new int[3];
		
		int w = raster.getWidth();
		int h = raster.getHeight();
		
		// access pixel data:
		for (int y = 0; y < h; y++) {
			for (int x = 0; x < w; x++) {
				// add pixel data here ...
				raster.getPixel(x, y, pixel);
				add(pixel);
				//Out.p("> add pixel "+x+"/"+y+" ...");
			}
		}
		
		
	}

}
