-1
픽셀 데이터를 2D 배열로로드하려고합니다. 이미 헤더를로드 했으므로 iData 배열은 1 차원 배열로 이미지 데이터를 바이트 단위로 보유하지만 2 차원 배열로 원합니다. adjWidth는 00 바이트 패딩을 포함한 너비입니다.비트 맵에서 이미지 데이터를 읽고 2D 배열에 저장하는 방법은 무엇입니까?
// get image byteData
byte[] iData = new byte[this.size - 54];
try {
fin.read(iData);
} catch (IOException ex) {
System.err.printf("ERROR: File %s is unreadable!\n", filename);
Logger.getLogger(Bitmap.class.getName()).log(Level.SEVERE, null, ex);
}
// send pixels to the buffer array
// pixels are organized from bottom row to top
this.buffer = new byte[this.height][adjWidth];
for(int i = this.height - 1; i > 0; i--) {
for(int j = adjWidth - 1; j > 0; j--) {
this.buffer[i][j] = iData[adjWidth*i + j];
System.out.print(this.buffer[i][j] + " ");
}
System.out.println();
}
그러나 내가로드중인 파일의 16 진수 편집기와 비교할 때 내 출력이 올바르지 않습니다. 정확히 내가 뭘 잘못하고 있니?