Daniela Labra: Autoretrato con pincel en Processing
De Casiopea
Título | Autoretrato con pincel en Processing |
---|---|
Tipo de Proyecto | Proyecto de Taller |
Período | 2011-2011 |
Asignatura | Presentación del Diseño Industrial 3, |
Del Curso | Presentación al Lenguaje Abierto |
Carreras | Diseño Gráfico"Diseño Gráfico" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property., Diseño Industrial"Diseño Industrial" is not in the list (Arquitectura, Diseño, Magíster, Otra) of allowed values for the "Carreras Relacionadas" property. |
Alumno(s) | Daniela Labra |
Profesor | Marcelo Araya, Herbert Spencer |
Autoretrato con pincel en processing
Elaboración de un autoretrato por medio de la creación de un tipo de pincel en el programa Processing
Código desde Processing
import processing.pdf.*; PImage retrato; float margenIzquierda = 85; // 3 cm float margenArriba = 85; float margenDerecha = 85; float escala; boolean pinta; int x, y; void setup() { retrato = loadImage("daniela.jpg"); size(750, 1500); // 27 x 27 cm. debiera ser (2423, 4846); 85 x 170 cm smooth(); beginRecord(PDF, "Paisaje"+day()+hour()+minute()+".pdf"); float ancho = width - (margenIzquierda + margenDerecha); escala = ancho / (float)retrato.width; strokeCap(ROUND); background(255); x = y = 0; pinta = true; } void draw() { float spacer = 12; float plotX = map(x, 0, retrato.width, margenIzquierda, width-margenDerecha); float plotY = map(y, 0, retrato.height, margenArriba, margenArriba + (retrato.height * escala)); color c = retrato.get(x,y); if(pinta) pincel(plotX, plotY, c, spacer); if (x < retrato.width - spacer) { x+= spacer; } else if(y < retrato.height) { x = 0; y += spacer; } if (y > retrato.height) { println("listo!"); endRecord(); pinta = false; // exit(); } } void pincel(float x, float y, color c, float amp) { // si el color es oscuro tiene m´s achurados int achurados = (int)map(brightness(c), 0, 255, 50, 0); float r = random(1, 6); for (int i = 0; i < achurados; i++) { pushMatrix(); { translate(x + random(-amp,amp), y + random (-amp,amp)); stroke(c, 80); if (brightness(c) < 125) { fill(c, 50); ellipse(amp, amp, r,r); strokeWeight(r*2); } else if(brightness(c) > 125 ) { fill(c, 120); ellipse(amp, amp, r,r); } } popMatrix(); } } void mousePressed() { endRecord(); exit(); }