Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Mason Marnell
- //I just called both methods respectively and then explored the picture in the main
- public void Open()
- {
- Pixel[][] pixels = this.getPixels2D();
- for (int row = 0; row < pixels.length;row++)
- {
- for (int col = pixels[row].length / 2; col < pixels[row].length; col++)
- {
- Pixel pixelObj = pixels[row][(col-pixels[row].length / 2)];
- pixelObj.setRed(0);
- }
- for (int col = row + 160; col < pixels[row].length; col++)
- {
- Pixel pixelObj = pixels[row][col];
- pixelObj.setGreen(0);
- }
- for (int col = 0; col < row; col++)
- {
- Pixel pixelObj = pixels[row][col];
- double g = pixelObj.getAverage();
- pixelObj.setRed((int) g);
- pixelObj.setGreen((int) g);
- pixelObj.setBlue((int) g);
- }
- }
- }
- public void Combine(Picture sec)
- {
- Pixel[][] pixels = this.getPixels2D();
- Pixel[][] pix2 = sec.getPixels2D();
- int rowStop = Math.min(pixels.length, pix2.length);
- int colStop = Math.min(pixels[0].length, pix2[0].length);
- for (int row = 0; row < rowStop;row++)
- {
- for (int col = 0; col < colStop; col++)
- {
- Pixel pixelObj = pixels[row][col];
- Pixel pixo2 = pix2[row][col];
- int red = (pixelObj.getRed()+ pixo2.getRed() / 2);
- int green = (pixelObj.getGreen() + pixo2.getGreen() / 2);
- int blue = (pixelObj.getBlue() + pixo2.getBlue() / 2);
- pixelObj.setRed(red);
- pixelObj.setGreen(green);
- pixelObj.setBlue(blue);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement