• Topic Archived
You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.

User Info: Kyoto

Kyoto
11 years ago#1
public static int[][] resize(int[][] source, int[][] reference) {
source = resize(source, reference.length, reference[0].length);
return source;
}
/**
* Resize the array image to the new width and height
* @param source
* @param newWidth
* @param newHeight
* @return
*/
public static int[][] resize(int[][] source, int newWidth, int newHeight) {
double DWidth = (double) newWidth;
double DHeight = (double) newHeight;
int [][] desu = new int [newWidth][newHeight];
for (int y = 0; y < newHeight; y++){
for (int x = 0; x < newWidth; x++){
desu[x][y] = source [(int)(x * (double)(source.length/DWidth))] [(int)(y * (double)(source[0].length/DHeight))];

}
}
return desu;
}
  • Topic Archived