I'm doing some image work. One image class wants a pixel buffer in the form of an int array, another image class wants a pixel buffer in the form of a byte array. Is there a way to cast between to the two? I don't want to manually iterate through each pixel, converting, it will be very slow. Example below, thanks:
int width = img.getWidth();
int height = img.getHeight();
// Pixels are stored in aarrggbb format in a single integer.
int argb = new int[width * height];
// Now this other image class wants the pixel buffer as a byte array.
byte argb2 = new byte[width * height * 4];
ImgOther img2 = new ImgOther(argb2);
// But is there any way to do something like:
byte argb2 = (byte)argb;
ImgOther img3 = new ImgOther(argb3);