ImageLibrary jar file and images available @Im having trouble doing the "Horizontal Flip"..I did the psychadelic and overlay can someone please help with the horizontal flip im frustratedHTML Code:https://drive.google.com/folderview?id=0By-OXgq5-r0TbWs2cXRiblJpYVk&usp=sharing
If you can please guide me in the right direction i would be really thankful, i have this due tonight..i just dont get it D:
public class HussainDilawerA4Q1 //Class { public static void main(String[]args) //Main Method { double[] raster; //psychedelicImage ImageLibrary.loadImage("jennifer.jpg"); raster = ImageLibrary.getImageRaster(); double[] psychedelicImage = psycImage(raster); ImageLibrary.setImageRaster(psychedelicImage); ImageLibrary.drawImage(); //OverlayImage ImageLibrary.loadImage("overlay-a.jpg"); raster = ImageLibrary.getImageRaster(); ImageLibrary.loadImage("overlay-b.png"); double[] raster1= ImageLibrary.getImageRaster(); overLmethod(raster, raster1); ImageLibrary.setImageRaster(raster); ImageLibrary.drawImage(); /* horizontal flip – flip an image horizontally, as shown in the example. Accomplish this using a set of 2 loops, one nested in the other. The outer loop goes through the y coordinates (the rows), and the inner loop goes through the columns (x). To flip, simply reverse each horizontal array. */ //HorizontalFlip //ImageLibrary.loadImage("jennifer.jpg"); //raster = ImageLibrary.getImageRaster(); //idk what to do here how many rasters and how many methods im suppose to make? } public static double[] psycImage(double[] raster){ //make an array to implement the changes on. double[] psychedelic = new double[raster.length]; //Use a for loop to go through all the values and add 0.5 to it for(int i = 0; i < raster.length; i++){ psychedelic[i] = raster[i]+0.5; //If the value is above 1 then subtract it by 1 if( psychedelic[i] > 1 ){ psychedelic[i]=psychedelic[i]-1; } } return psychedelic; } public static void overLmethod(double[] target, double[] overlay){ for(int i = 0; i < target.length; i++){ if(overlay[i] != -1){ target[i] = overlay[i]; } } } }