// e.g. cReduceWidth * this.cTargetWidth <= image.getWidth
// This is important in the for loop below to keep from out of bounds
// array access.
int cReduceWidth = image.getWidth() / this.cTargetWidth;
int cReduceHeight = image.getHeight() / this.cTargetHeight;
RgbImage rgb = (RgbImage) image;
int[] rnIn = rgb.getData();
RgbImage result = new RgbImage(
this.cTargetWidth,
this.cTargetHeight);
int[] rnOut = result.getData();
for (int i=0; i<this.cTargetHeight; i++) {
for (int j=0; j<this.cTargetWidth; j++) {
rnOut[i*this.cTargetWidth + j] =
rnIn[(i*image.getWidth()*cReduceHeight) + (j*cReduceWidth)];
}