Edited: Thanks for the previous answers and help! I’ve decided to edit this question into what I need exactly, sorry for not being as specific earlier.
Basically the title is all the information, this is currently what I’m working with:
int channels = 4;
int length = width * height;
int[] data = new int[length * channels];
int[][] channelPixels = new int[4][length];
for (int c = 0; c < channels; c++) {
for (int i = 0; i < length; i++) {
channelPixels[c][i] = readByte();
}
}
Unfortunately, the colors don’t seem to match up to the originals.
Is there something I’m doing wrong here?
This code flips rectangular buffer and changes RGBA byte order to BGRA (or vice versa) like this:
Rough analog with c/java-like pseudocode: