sektionschef_proiezione/.proiezione.pde.swp
b0VIM 7.4»ñKT1D¤stefanlambert~stefan/Dropbox/prog/sketchbook_processing/20140517 futuregarden/proiezione/proiezione.pde
3210#"! Utp`naadž`ôÄž~rL*ßÞ’^0Ü
±
…
„
Y


Ù¨[ßÞÔ¼—†fePOF7Ÿ
K
J
I
F
ý	ú	ë	j	O	öóáÄ‹^Yòñ¹£mT$äßÊ™ZŠSOLÐÏ¤¢¡žVSEÊÇûù¾ž|U0
÷âáž  for (int i = 0; i < zone_count; i++) { //loop for the five zones// println(zone[0]);                   };                     {2,5,11,19}                       {1,8,12,20,21},                     {4,7,9,13,15,17},                     {0,3,14,18},                     {6,10,16}, int[][] zone = { //number of elements for the five zones  //    println(axel_row); //debug  TableRow axel_row = scheme.getRow(surp%scheme.getRowCount()); //initialize a single row manually chosen, use the modulo to restrict the surp not exceeding the row count    background(0); //background black, so there is nothing in the projection  buttonState = arduino.digitalRead(buttonPin);void draw() {/////////////////////////////////// DRAW //////////////////////////////////}  time = millis();//store the current time  println(scheme.getRowCount() + " total rows in table"); //debug, Anzahl Rows  scheme = loadTable( table_path, "header");    }      element[i].scale(0.5);// scale, which percentage      element[i] = canvas.getChild(str(i)); // Initialize each object with the ID of the svg; convert it to string so it is accepted  for (int i = 0; i < element_count; i++) { //get all the children at once//  rect_a = canvas.getChild("a"); //archive for getting child  canvas = loadShape( svg_path ); //load the svg  //get svg elements      offscreen = createGraphics(displayWidth, displayHeight, P3D);    // (The offscreen buffer can be P2D or P3D)    // CornerPinSurface.    // note that we're matching the resolution of the    // want projected  // We need an offscreen buffer to draw the surface we//  colorMode(HSB); //change the color mode, so the whole color change thing is easier - still needed?      arduino.pinMode(buttonPin, Arduino.INPUT);  arduino = new Arduino(this, Arduino.list()[0], 57600);  //println(Arduino.list());  //Arduino Setup    surface = ks.createCornerPinSurface(width, height, 20); //height, width, distance grid  ks = new Keystone(this);  size(displayWidth, displayHeight,P3D); //P3D important for keystone, since it relies on texture mapping to deform; fill screenvoid setup() {/////////////////////////////////// SETUP //////////////////////////////////PShape[] element = new PShape[element_count]; //declare them all at once - Achtung //PShape[] element = new PShape[scheme.getColumnCount()]; //declare them all at once - column count not possible because table not loaded at this stagePShape canvas;//shapesPGraphics offscreen;Table scheme; //table, load csvArduino arduino;CornerPinSurface surface; //keystoneKeystone ks; //keystone//Objectsint whiteout = 0; //0-255 more brightness for the whole imageint[] hue = new int[element_count]; //array for colour levles//int[] element_names = new int[17]; // create array with element ids of svgint surp = 0; //starting line of color csv tableString table_path = "scheme.csv"; //path to table with colorsint wait = 10*1000; //milliseconds - delay for changing colours int time; //time from start, for the delayint height = 400; //height of canvas - 80*5int width = 600; //width of canvas - 120*5int element_count = 22;// number of elements in svg, mind that the loop starts at 0int zone_count = 5; // number of zones in csvint boring = 0; //start hue loop from; first columnString svg_path = "canvas_sketch_postpainting.svg"; //path to svg of canvasint lastButtonState = 0; //last moment button state, needed for the switchint buttonState; //arduino switchint buttonPin = 2; //arduino read pin//variablesimport cc.arduino.*; //arduinoimport processing.serial.*; //arduinoimport deadpixel.keystone.*; //keystone library//LibrariesadAn«{gFoiedc/ø
õ
ô
ñ
Ø
Õ
ž
}
_
B
{urëÓ¯¬©n5Ý
Ú
Ã
Á
�
_
\
)

Ê	®	{	]	N	&	 			éÆ¥¤�aL=8æã¸¬˜–“’fVJöÚÏÎÂ¤•Š‰}eVKJ>$èâ×Ë³ŸwodXK*}  }       break;    println("p pressed");//debug    surp+=1;  case 'p':    break;    }        println("whiteout: " + whiteout);      whiteout-=15;    if (whiteout > 0) {  case 'b':    break;    }      println("whiteout: " + whiteout);      whiteout+=15;    if (whiteout < 255) {  case 'w':    break;    ks.save();    // saves the layout  case 's':    break;    ks.load();    // loads the saved layout  case 'l':    break;    ks.toggleCalibration();    // and moved    // enter/leave calibration mode, where surfaces can be warped   case 'c':  switch(key) {void keyPressed() { //function for keystone*/}  //println(surp);   surp+=1; void mousePressed(){ // pressing the mouse/*// MOUSE INSTEAD OF ARDUINO}  }    time = millis();//update the stored time        boring+=1;    println("tick");  if(millis() - time >= wait){ //delay loop  //TIMED COLOR CHANGE  lastButtonState = buttonState;  //for next time through the loop  // save the current state as the last state,     }    }      println("button pressed");//debug      surp+=1;      // wend from off to on:      // if the current state is 1 then the button    if (buttonState == 1) {    // if the state has changed, increment the counter  if (buttonState != lastButtonState) {  // compare the buttonState to its previous state    surface.render(offscreen);       // render the scene, transformed using the corner pin surface   offscreen.endDraw();    PVector surfaceMouse = surface.getTransformedMouse();  // surface from your screen.   // this will allow you to use mouse events inside the   // Convert the mouse coordinate into surface coordinates      offscreen.rect(0,0,width,height);  offscreen.noStroke();  offscreen.fill(255,255,255,whiteout);  // add a white rectengular for softening the colours in total, transparency value = whiteout    }        offscreen.shape( element[i], 0 ,125); //552, 122 oder 0px deviance, no idea why - probably because of rescaling from 1000 to 500; for offscreen (keystoning) it takes 0 instead of -552px for y)      offscreen.noStroke();       offscreen.fill(hue[i]);      element[i].disableStyle();  for (int i = 0; i < element_count; i++) {               offscreen.beginDraw();      println(axel_row.getString(zone_count+1)); //palette  println(axel_row.getString(zone_count)); //artist  }    }      hue[zone[i][z]] = unhex("ff"+axel_row.getString(r)); //get value for each element and write it in an array; getString for unhexing; mode is ARGB! so put "ff in front for full colour (in format "ff"+"2d495e")       //println(zone[i][z]);          //println(r);    for (int z = 0; z < zone[i].length ; z++) {    int r = (i+boring)%5; //the color is swapped but the cycle stays between 0 and 5