- AceTutor
- Rating : 28
- Grade : A+
- Questions : 0
- Solutions :832
- Blog : 1
- Earned : $20923.75
CSCI 1302 Lab 3
(100 points)
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.
- This Solution has been Purchased 2 time
- Average Rating for this solution is A+
- Submitted On 03 Oct, 2015 06:57:12
- AceTutor
- Rating : 28
- Grade : A+
- Questions : 0
- Solutions :832
- Blog : 1
- Earned : $20923.75