Write a method changeblueweight do not change any color of


Question 1.

Write a method changeBlue(weight). Do not change any color of the pixels in the first half of a picture. For the second half, change blue value of each pixel by new blue=original blue * weight. For example, if a pixel has values (200,100,100) and weight is 0.5, then the new values will be (200,100,50). If the weight is 1.5, then the new values will be (200,100,150).

This is first half, do not change!

This is second half, change blue.

Question 2.

Write a method mirrorVertical(). The method  mirrors the left half of a picture to  the right half of the picture. For instance, the two pictures below show that the left one is the original picture, and the right one is the new picture.

Question 3.

Write a method copyPart(w,h). The method copies an upper left rectangle area in an image to its lower right area. w and h are width and height of the rectangle. In the figure below, |ab| is w and |ac| is h. We assume that 2*w is less than the picture's width,  and 2*h is less than the picture's height. That is, the source area and the destination area are not overlapped and w or h is not out of bound.

All methods need to be included in the file Picture.java. Once you are finished, recompile your Picture.java, and then test your methods in DrJava. You can use any picture to test your programs.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a method changeblueweight do not change any color of
Reference No:- TGS01227019

Now Priced at $40 (50% Discount)

Recommended (97%)

Rated (4.9/5)

A

Anonymous user

2/22/2016 1:16:58 AM

For the following questions, the methods need to be comprised in the file Picture.java. Read the questions carefully and perform the tasks as per instructions given. Q1. Write down a method changeBlue(weight). Don’t change any color of the pixels in the first half of a picture. For the second half, change blue value of each and every pixel by new blue=original blue * weight. For illustration, if a pixel consists of values (200,100,100) and weight is 0.5, then the new values will be (200, 100, 50). If the weight is 1.5, then the new values will be (200,100,150). • This is first half, don’t change! • This is second half, change blue. Q2. Write down a method mirrorVertical(). The method mirrors the left half of a picture to the right half of the picture. For example, the two pictures beneath illustrate that the left one is the original picture and the right one is the new picture.