change a way to store image pixels as same as Java's PixelGrabber does