ビットマップを分割するときにこのエラーが発生する理由を教えてください。コード:
public static List<Bitmap> ScambleImage(Bitmap image, int rows, int cols){
List<Bitmap> scambledImage = new ArrayList<Bitmap>();
int chunkWidth = image.getWidth(); //cols
int chunkHeight = image.getHeight(); //rows
int finalSize = chunkWidth/rows;
Bitmap bMapScaled = Bitmap.createScaledBitmap(image, chunkWidth, chunkHeight, true);
int yCoord = 0;//The y coordinate of the first pixel in source
for(int x = 0; x < rows; x++){
int xCoord = 0;//The x coordinate of the first pixel in source
for(int y = 0; y < cols; y++){
scambledImage.add(Bitmap.createBitmap(bMapScaled, xCoord, yCoord, finalSize, finalSize));
xCoord = finalSize + xCoord;
}
yCoord = finalSize + yCoord;//The y coordinate of the first pixel in source
}
return scambledImage;
}
行 = 6、および列 = 6; 画像サイズ = 648 x 484
これは例外ですが、修正方法がわかりません:
java.lang.IllegalArgumentException: y + height must be <= bitmap.height()
ありがとう!