/* This app demonstrates the use of the ImageView class for image presentation. The class contains a library of algorthims that can be easily accesses and modified for repeated use in projects. It allows for the selection of both an action (i.e. tiling the screen) as well as the time in milliseconds to spend on each image. The Available actions are: \ case 1: POPULATE SCREEN HORIZONTAL case 2: POPULATE SCREEN VERTICAL case 3: INCREASE NUMBER OF IMAGES DISPLAYED case 4: DRAW GRID case 5: CLEAR SCREEN case 6: PAUSE case 7: GRADIENT case 8: DYNAMIC MOSAIC case 9: ADD RED case 10: ADD GREEN case 11: ADD BLUE case 12: AVERAGE COLOR CASE 13: CAPTURE SCREEN IMAGE case 14: RESET IMAGES CASE 15: GET NEW IMAGES FOR THE ARRAYLIST by Aaron Levisohn */ ImageView myImages; void setup(){ size(828,551); frameRate(60); smooth(); background(0); myImages = new ImageView(81); //create a new ImageView Object and load 90 images //ACTIONS TO PERFORM myImages.newAction(5,0);//CLEAR myImages.newAction(2,0);//populate images matrix myImages.newAction(9,5);//SUBTRACT COLOR myImages.newAction(4,20);//draw grid of images myImages.newAction(3,0);//Increase Number of Images myImages.newAction(14,0);//RESET IMAGES myImages.newAction(15,0);//GET NEW IMAGES myImages.newAction(1,0);//populate images matrix myImages.newAction(10,100);//SUBTRACT COLOR myImages.newAction(4,10);//draw grid of images myImages.newAction(3,0);//Increase Number of Images myImages.newAction(14,0);//RESET IMAGES myImages.newAction(15,0);//GET NEW IMAGES myImages.newAction(2,0);//populate images matrix myImages.newAction(11,100);//SUBTRACT COLOR myImages.newAction(4,10);//draw grid of images myImages.newAction(6,5);//PAUSE myImages.newAction(8,100);//mosaic myImages.newAction(3,0);//Increase Number of Images myImages.newAction(14,0);//RESET IMAGES myImages.newAction(15,0);//GET NEW IMAGES myImages.newAction(1,0);//populate images matrix myImages.newAction(5,0);//CLEAR myImages.newAction(4,50);//draw grid of images myImages.newAction(1,0);//populate images matrix myImages.newAction(12,15); //average color //myImages.newAction(2,5);//draw images myImages.newAction(3,0);//Increase Number of Images myImages.newAction(14,0);//RESET IMAGES myImages.newAction(15,0);//GET NEW IMAGES myImages.newAction(2,0);//populate images matrix myImages.newAction(5,0);//CLEAR myImages.newAction(10,100);//SUBTRACT COLOR myImages.newAction(4,10);//draw grid of images myImages.newAction(12,20); //average color myImages.newAction(3,0);//Increase Number of Images myImages.newAction(14,0);//RESET IMAGES myImages.newAction(15,0);//GET NEW IMAGES } void draw(){ myImages.drawStuff(); } /* void rotateImage(){ pushMatrix(); rotate(radians(4)); mainImage.drawImage(); updatePixels(); popMatrix(); } void scaleMe(float Zoomfactor){ //need this here so that the keypressed function works //loadPixels(); screenCopy = get(); background(0); currentScale=Zoomfactor; //println("currentScale: "+currentScale ); scale(currentScale); pushMatrix(); //translate(mouseX/2, mouseY/2); image(screenCopy,0,0); popMatrix(); resetMatrix(); } void doMe(){ background(0); mainImage.setWidth(width/2); mainImage.setHeight(height/2); /* // mainImage2 = mainImage; mainImage2.setPImage(screenCopy); //mainImage2.setWidth(width/2); //mainImage2.setHeight(height/2); // mainImage2.setPosition(width/2,0); mainImage2.setWidth(600); mainImage2.setHeight(400); //mainImage2.setPosition(600,0); // mainImage3 = mainImage; mainImage3.setPImage(screenCopy); // mainImage3.setWidth(width/2); // mainImage3.setHeight(height/2); // mainImage3.setPosition(0,height/2); mainImage3.setWidth(600); mainImage3.setHeight(400); // mainImage3.setPosition(0,400); //mainImage4 = mainImage; mainImage4.setPImage(screenCopy); mainImage4.setHeight(height/2); mainImage4.setPosition(0,height/2); mainImage4.setPosition(width/2,height/2); //pushMatrix(); mainImage.setPosition(0,0); mainImage.drawImage(); mainImage.setPosition(width/2,0); mainImage.drawImage(); mainImage.setPosition(0,height/2); mainImage.drawImage(); mainImage.setPosition(width/2,height/2); mainImage.drawImage(); //mainImage2.drawImage(); //mainImage3.drawImage(); // mainImage4.drawImage(); //popMatrix(); } void setScale(){ float dynamicZoom = 1; for(int i=0;i 5){ reruns = 0; } if(!imgList.isEmpty()){ //check for character objects MyImage f = (MyImage)imgList.get(0); println("set f"); img1 = f; } switch(reruns){ //rotates through the various stages of mosaic for this image case 0: background(0); //img1 = new MyImage("image"+(imageloop+1)+".jpg"); //create new object and load image img2 = new MyImage("image"+(imageloop+2)+".jpg"); img3 = new MyImage("image"+(imageloop+3)+".jpg"); img4 = new MyImage("image"+(imageloop+1)+".jpg"); currentScale =currentScale + .2; // currentScale =currentScale - .2; if(currentScale <=.2){ currentScale = 1; } println(currentScale); pushMatrix(); scale(currentScale); image(img1,0,0); //draw image on screen; image(img2,0,img1.height); //draw image on screen; image(img3,img1.width,0); //draw image on screen; image(img4,img1.width,img1.height); //draw image on screen; popMatrix(); break; imageloop+=4; //move to the next set of image scaleFactor ++; break; } } } */