Write a method to do green or red chromakey

What will be an ideal response?

```
public void chromakeyGreen ( Pi c tur e newBg)
{
Pixel currPi xel = null;
Pixel newPixel = null;
// loop through the columns
for ( int x=0; x {
for ( int y=0; y f
// get the current pixel
currPixel = this . g e tPixel (x , y ) ;
/* i f the c o l o r at the cur r ent p i x e l i s mos t ly green
* ( green v a lue i s g r e a t e r than b l u e and red combined ) ,
* then use the new background c o l o r
*/
int combindedColor =
currPixel.getRed( ) + currPixel . getBlue ( ) ;
i f ( combindedColor < c u r rPi xel . getGreen ( ) )
{
newPixel = newBg . g e tPixel (x , y ) ;
currPixel . s e tColor ( newPixel . ge tColor ( ) ) ;
}
}
}
}
```

Computer Science & Information Technology

You might also like to view...

The CONCATENATE function can format text with spaces or other punctuation

Indicate whether the statement is true or false.

Computer Science & Information Technology

Which applet method is called by the Web browser to display the applet to the screen?

A. drawApplet() B. paint() C. paintApplet() D. setApplet()

Computer Science & Information Technology