Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This method below currently sets the color of all of the pixels in the given Picture to black. It needs to only sets the pixels

This method below currently sets the color of all of the pixels in the given Picture to black. It needs to only sets the pixels on the left half of the image to black. In other words, all pixels with an x coordinate less than half the width should be set to black. What should be changed in the for loops below so that the method does what is needed

public void setLeftHalfOfPicture(Picture pic)

{

for (int x = 0; x < pic.getWidth(); x++)

{

for (int y = 0; y < pic.getHeight(); y++)

{

pic.getPixel(x, y).setColor(Color.BLACK);

}

}

}

Step by Step Solution

3.38 Rating (151 Votes )

There are 3 Steps involved in it

Step: 1

public void setLeftHalfOfPicturePicture pic int ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Marketing And Export Management

Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr

8th Edition

1292016922, 978-1292016924

More Books

Students also viewed these Operating System questions

Question

9. Who would drink more pure watersomeone wit

Answered: 1 week ago