CIS 174                                                        LAB ASSIGNMENT  #10
Assigned date: Thursday 4/10
Due date: Wednesday 4/17
30 points

1. [15 points] Write a method called copyNonWhitePixels that copies all but the white pixels from one picture to another. Use this to put the robot in robot.jpg on the moon in moon-surface.jpg.

public void copyNonWhitePixels(Picture sourcePicture, int startX, int startY, int endX, int endY, int targetStartX, int targetStartY)

Output sample

2. [15 points] Create a method called drawTopCenteredString to draw a string at the top of the picture and centered horizontally. You need to use FontMetrics class to get the height of the string in pixels in order to determine where the baseline should be so that string is visible. You should also subtract the descent from the height.

public void drawTopCenteredString(String text,Font font, Color color)

Output sample