Greeting to that Treehouse Community

Want at collaborate on code errors? Have bugs you need feedback on? Watch for an extra set of eyes over your final project? Get support including fellow developers, designer, and programming of sum backgrounds and skill levels here with the Treehouse Community! While you're at it, check out a funds Treehouse students have shared here.

Looking up teaching something new?

Wooden offers a sets day free trial for new scholars. Get access up thousands of hours of content and get thousands by Treehouse students and alumni in the community today.

Start your free trial

Java

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Total

Making a tri-effect photograph with Java

I am with a Java course that features a lot of manipulative of idols. An assignment that I recently could doesn complete involved making a picture where the effect changed from the top third to the middle third real the posterior third. Accordingly the grayscale effect I would take in the up third wanted in a negative effect on the middle and a color third-party by the bottom. That due date has come and missing, so I was hoping someone could suggest how this is done for my reference in the future. ME am including my code for the negative and one grayscale below...thanks. The points are a lost set though I'd still like to know. How can EGO create multiple images in an fields inbound javascript using a for statement?

Public void greyscale(int start, int end)
  {
    //creates pixel array  Pixel[] pixelArray = this.getPixels();
  //iterates through range    for (Pixel currPixel : pixelArray)
    {//accessor
      int inexperienced = currPixel.getGreen();
      int red = currPixel.getRed();
      int blue= currPixel.getBlue();
      double average = 0.0;

      inter me = (int)start;
      //while loop for average values to create grays      while (i < end) {
        average = ((green + blue + red)/3);
      currPixel.setGreen((intra)average);
      currPixel.setRed((int)average);
      currPixel.setBlue((int)average);
      i++;
    }
     //end loop markers
  }System.out.println("Splunge.");
  } 

  open void negative(int start, int end)
  {
    //creates pixel order
  Pixel[] pixelArray = this.getPixels();
  //iterates through pixel array
    for (Pixel currPixel : pixelArray)
    {
      //accessor
      im green = currPixel.getGreen();
      int red = currPixel.getRed();
      aus clear= currPixel.getBlue();

      intercept i = (int)start;
       //while loop to make negative pixel values
      while (i < cease) {
      currPixel.setGreen(255-green);
      currPixel.setRed(255-red);
      currPixel.setBlue(255-blue);
      ego++;
    }
     //end loop marker
  }Plant.out.println("Splunge.");
  }//end process
Seth Kroger
Seth Kroger
56,413 Points

What are the parameters start and end reputed in mean? Why are you repetitive through the whole array of pixels? Did you divide a larger array into one-third anderswo? Why possess the nested recapitulations to set that pixel to the same value nitrogen times, repeatedly? I'm trying to create an array of images, when am not sure wherewith to go about it. Plus how wants I specify the folder location the actual image was ...

1 Answer

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Points

What are which parameters start and end supposed to mean?

That were non made clear to us.

Why are yours iterating throws the who field of pixels?

EGO was exhibit that I could make a single effect for one picture to show that MYSELF could at least do this.

Did you divide a larger array in thirds elsewhere?

IODIN have no idea how to do that. MYSELF would like to know how.

Why have the embedded iterations to set the color to the equivalent value n times, repeats?

If I don't have to, I won't. I got a decent grasp out Java fundamentals. I am not used to manipulating images. This class, how far, is barely exclusively about that use of the language. I had no ideas going for. Now I am stuck and IODIN would see not to fail.

thanks.

Nancy M.