/* Lukas Pauer & Tomas Polach for CAAD @ ETH, 2008 */ String picture = "pics/009.jpg"; color BGcolor = color(0, 0, 0); float drag = 1.0; //umgekehre beschleunigung (je höher, desto langsamer) int farbVarianz = 10; int lineStrenght = 1; int varianzX = 25; int varianzY = 25; int numBez = 1; float opak = 100; int thumbBreite = 150; String fontType = "data/GoodTimes-8.vlw"; float timerSave = 2000; PImage bild; PGraphics thumb; void setup() { smooth(); //frameRate(30); background(BGcolor); //noLoop(); bild = loadImage(picture); float bildH = bild.height; float bildB = bild.width; int thumbHoehe = thumbBreite/(round(bildB/bildH)); thumb = createGraphics(thumbBreite, thumbHoehe, P3D); size(750, 368); //lade schriftart PFont fontA; fontA = loadFont(fontType); textFont(fontA, 10); //text fill(255,255,255); text("BILD-STRICKEN",bild.width,20); text("VARIANZ:",bild.width,40); fill(60,60,60); text("ANLEITUNG:",bild.width,bild.height-120); text("positions-varianz +/-",bild.width,bild.height-110); text("1/2",bild.width,bild.height-100); text("farb-varianz +/-",bild.width,bild.height-90); text("3/4",bild.width,bild.height-80); text("Anzaht Splines +/-",bild.width,bild.height-70); text("5/6",bild.width,bild.height-60); text("Opazität +/-",bild.width,bild.height-50); text("7/8",bild.width,bild.height-40); text("bild speichern: s",bild.width,bild.height-30); text("start/pause: a",bild.width,bild.height-20); beginShape(); } float newX = mouseX; float newY = mouseY; color newColor = BGcolor; float oldX = 0; float oldY = 0; color oldColor = color(0,0,0); float timerCursor = 0; int fV = 0; boolean powerSwitch = false; int thX = 0; int thY = 0; float vSx = 0; float vSy = 0; float vS = 0; int modeSwitch = 2; void draw() { noStroke(); fill(0,0,0); rect(bild.width,40,bild.width+80,100); fill(255,255,255); text("position: "+varianzX,bild.width,60); text("farbe: "+farbVarianz,bild.width,80); text("linien: "+numBez,bild.width,100); text("tansparenz: "+round(opak/255*100)+"%",bild.width,120); text("anz. schritte: "+round(timerCursor),bild.width,140); float bildH = bild.height; float bildB = bild.width; int thumbHoehe = thumbBreite/(round(bildB/bildH)); thX=thumbBreite*mouseX/bild.width; thY=thumbHoehe*mouseY/bild.height; thumb.beginDraw(); thumb.image(bild,0,0, thumbBreite, thumbHoehe); thumb.stroke(255,0,0); thumb.line(thX-5,thY,thX+5,thY); thumb.line(thX,thY-5,thX,thY+5); thumb.endDraw(); image(thumb, bild.width, 150); if (powerSwitch == true) { oldX = newX; oldY = newY; oldColor = newColor; float difx = mouseX - newX; newX = (newX + difx/drag)+random(-varianzX,varianzX); newX = constrain(newX, 0, bild.width); float dify = mouseY - newY; newY = (newY + dify/drag)+random(-varianzY,varianzY); newY = constrain(newY, 1, bild.height-1); vSx = random(oldX-newX); if (vSx<0) vSx=vSx*(-1); vSy = random(oldY-newY); if (vSy<0) vSy=vSy*(-1); vS = vSx + vSy; newColor = bild.pixels[ceil(newY-1)*bild.width+ceil(newX)]; fV = round(random(-farbVarianz,farbVarianz)); stroke(color(red(newColor)+fV,green(newColor)+fV,blue(newColor)+fV),opak); noFill(); for (int i=0; i0) varianzX--; if (varianzY>0) varianzY--; } else if ( key == '2') { varianzX++; varianzY++; } else if ( key == '3') { if (farbVarianz>0) farbVarianz--; } else if ( key == '4') { farbVarianz++; } else if ( key == '5') { if (numBez>0) numBez--; } else if ( key == '6') { numBez++; } else if ( key == '7') { if (opak>10) opak=opak-10; } else if ( key == '8') { if (opak<245) opak=opak+10; } } void mousePressed() { newX = mouseX; newY = mouseY; if (powerSwitch == false) { powerSwitch=true; } else { powerSwitch = false; } } //eigene funtkion: speichere bild void savePicture() { save("output/pic_"+day()+"-"+month()+"_"+hour()+"-"+minute()+"-"+second()+"_"+millis()+".tif"); }