Create a new method that will blend two pictures with 10% from just the first picture and a 80% overlap and then 10% from the just the last picture. It helps if the two pictures are the same width and height.
What will be an ideal response?
```
public void blendPictures108010 ( )
{
Picture p1 = new Picture ( FileChooser.getMediaPath ( " church.jpg " ) ) ;
Picture p2 = new Pictur e ( FileChooser.getMediaPath ( " eiffel.jpg " ) ) ;
Pixel source1 = null ;
Pixel source2 = null ;
Pixel target = null ;
// copy the first 10% of p1
int end1 = ( int ) ( p1.getWidth ( ) * 0.10 ) ;
for ( int x = 0 ; x < end1 ; x++)
{
for ( int y = 0 ; y < p1.getHeight ( ) ; y++)
{
source1 = p1. getPixel (x , y) ;
target = this.getPixel (x , y ) ;
target.setColor (source1. getColor ( ) ) ;
}
}
// now blend p1 and p2 for 80% of p1
int end2 = ( int ) ( p1. getWidth ( ) * 0 . 9 ) ;
for ( int x = end1 ; x < end2 ; x++)
{
for (int y = 0 ; y < p1.getHeight ( ) ; y++)
{
source1 = p1.getPixel (x , y ) ;
source2 = p2.getPixel (x , y ) ;
target = this.getPixel (x , y ) ;
target.setColor (new Color (source1.getRed ( ) / 2 +
source2.getRed ( ) / 2 ,
source1.getGreen ( ) / 2 +
source2.getGreen ( ) / 2 ,
source1.getBlue ( ) / 2 +
source2.getBlue ( ) / 2 ) ) ;
}
}
// copy last 10% of p2
for ( int x = end2 ; x < p2.getWidth ( ) ; x++)
{
for ( int y = 0 ; y < p2.getHeight ( ) ; y++)
{
source2 = p2.getP xel (x ,y) ;
target = this.getPixel (x , y ) ;
target.setColor (source2.getColor ( ) ) ;
}
}
}
```
You might also like to view...
________ objects can formatted, aligned, and moved as one object
Fill in the blank(s) with correct word
Many classes provide methods to perform common tasks that do not require specific objects—they must be called using a class name. Such methods are called ________ methods.
a) classwide b) dot (.) c) console d) static