uses inefficient workaround since java's getpixels(int ... [] method doesn't work)