{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Java Lab7 - targetY...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 public void modPic() { Pixel{}pixelArray = this.getPixels() Pixel pixel = null for(int index = 0 { pixel = pixelArray[index] pixel.setGreen(pixel.getRed()) pixel.setBlue(pixel.getGreen()) } } public Picture scaleUp(int numTimes) { Picture targetPicture = new Picture(this.getWidth() * numTimes, this.getHeight() * numTimes) Pixel sourcePixel = null Pixel targetPixel = null int targetX = 0 int targetY = 0 //loop through the source picture columns for (int sourceX = 0 sourceX < this.getWidth() sourceX++) { //loop through the sorce picture rows for (int sourceY = 0 sourceY < this.getHeight() sourceY++) { //get the source pixel sourcePixel = this.getPixel(sourceX, sourceY) //loop copying to the target y for (int indexY = 0 { //loop copying to the target x for (int indexX = 0 { targetX = sourceX * numTimes + indexX targetY = sourceY * numTimes + indexY targetPixel = targetPicture.getPixel(targetX,
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: targetY) targetPixel.setColor(sourcePixel.getColor()) } } } } return targetPicture Sheet1 Page 2 } Assignment 3 public Picture frame(int frameSize, Color frameColor) { public Picture mirror() { int width= this.getWidth() int mirrorPoint = width / 2 Pixel leftPixel = null Pixel rightPixel = null for (int y = 0 { for (int x = 0 { leftPixel = getPixel(x, y) rightPixel = getPixel(width - 1 - x, y) rightPixel.setColor(leftPixel.getColor()) } } return targetPicture } Color tempColor = rightPixel.getColor() rightPixel.setColor(leftPixel.getColor()) leftPixel.setColor(tempColor) Sheet1 Page 3 index < pixelArray.length index++) indexY < numTimes indexY++) indexX < numtimes indexX++) Sheet1 Page 4 y < getHeight() y++) x < mirrorPoint x++) // not sure about the Color type here -- check that...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern