Staggering:
The technique used here is similar to the technique used in a lot of the
previous assignments. You should be able to do this simple transformation on
your own. Below is a section of code to help you.
public void doStagger(){
int nh = h + (h/10)*4;
int xi = w/10;
int yi = h/10;
try{
int pixel[] = new int[w*h];
int hold[] = new int[w*nh];
PixelGrabber pg = new PixelGrabber(c, 0, 0, w, h, pixel, 0, w);
if(pg.grabPixels() &&((pg.status() & ImageObserver.ALLBITS) != 0)){
for(int x=0; x9*xi) hold[x+y*w] = pixel[x+y*w];
else if(x<2*xi || x>8*xi) hold[x+y*w+yi*w] = pixel[x+y*w];
else if(x<3*xi || x>7*xi) hold[x+y*w+2*yi*w] =pixel[x+y*w];
else if(x<4*xi || x>6*xi) hold[x+y*w+3*yi*w]= pixel[x+y*w];
else hold[x+y*w+4*yi*w]= pixel[x+y*w];
}
}
s=createImage(new MemoryImageSource(w, nh, hold, 0, w));
}
}catch(InterruptedException e) { }
}