public static int[] scale(int scaledWidth, int scaledHeight, int scanlength, int sourceWidth, int sourceHeight, int[] rgbData) { int scaledRgbData[] = new int[scaledWidth * scaledHeight]; for (int y = 0; y < scaledHeight; y++) { int c1 = y * scaledWidth; int c2 = (y * sourceHeight / scaledHeight) * scanlength; for (int x = 0; x < scaledWidth; x++) { scaledRgbData[c1 + x] = rgbData[c2 + x * sourceWidth / scaledWidth];
public static void scale(int scaleFactor, int width, int height, int[] rgbData, int[] scaledRgbData) { int yStart = ((height - height * 100 / scaleFactor ) / 2) * width; int xStart = (width - width * 100 / scaleFactor ) / 2; for (int y = 0; y < height; y++) { int c1 = y * width; int c2 = yStart + (y * 100  / scaleFactor) * width; for (int x = 0; x < width; x++) { scaledRgbData[c1 + x] = rgbData[ c2 + xStart + x * 100/scaleFactor ];
	public static int[] scale(int scaledWidth, int scaledHeight, int scanlength, int sourceWidth, int sourceHeight, int[] rgbData) {		int scaledRgbData[] = new int[scaledWidth * scaledHeight];		for (int y = 0; y < scaledHeight; y++) {			int c1 = y * scaledWidth;			int c2 = (y * sourceHeight / scaledHeight) * scanlength;			for (int x = 0; x < scaledWidth; x++) {				scaledRgbData[c1 + x] = rgbData[c2 + x * sourceWidth / scaledWidth];			}		}		return scaledRgbData;	}