private void greenScreenDraw(
Picture source,
Picture dest,
//Place the upper-left corner
// of the source image at the
// following location in the
// destination image.
int destX,
int destY){
int width = source.getWidth();
int height = source.getHeight();
Pixel pixel = null;
Color color = null;
for(int row = 0;row < height;row++){
for(int col = 0;col < width;col++){
color = source.getPixel(
col,row).getColor();
if(!(color.equals(Color.GREEN))){
pixel = dest.getPixel(
destX + col,destY + row);
pixel.setColor(color);
}//end if
}//end inner loop
}//end outer loop
}//end greenScreenDraw
|