Valeria Contreras: Pincel Mejorado
De Casiopea
Título | Valeria Contreras: Pincel Mejorado |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 8 |
Período | 2012- |
Asignatura | Taller Inicial Común 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita 2012, |
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) | Valeria Contreras |
Profesor | Herbert Spencer |
/** Se construye, desde una imagen, un trazo que imita el trazo de un pincel **/ import processing.pdf.*; PImage imagen; PFont font; String[] code; float margenIzquierda = 30; float margenArriba = 40; float margenDerecha = 30; float margenAbajo = 30; float escala; void setup() { imagen = loadImage("calle.jpg"); // al cargar la imagen se construye el objeto PImage imagen size(609, 765, PDF, "calle.pdf"); // hoja tamaño carta // desde la imagen al pincel float ancho = width - (margenIzquierda + margenDerecha); escala = ancho/(float)imagen.width; noStroke(); noLoop(); background(255); smooth(); font = createFont("Courier", 8, true); // construcción de la tipografía textFont(font, 8); code = loadStrings("trazo.pde"); // se carga el código "trazo", que construye el pincel } void draw() { float spacer = 10; // muestreo regular desde la foto (modificable) for (int y = 0; y < imagen.height; y += spacer) { for (int x = 0; x < imagen.width; x += spacer) { // obtención del color float plotX = map(x, 0, imagen.width, margenIzquierda, width-margenDerecha); float plotY = map(y, 0, imagen.height, margenArriba, margenArriba + (imagen.height * escala)); color c = imagen.get(x,y); trazo(plotX, plotY, c, spacer); } } printCode(); println("Listo.Presione Ctrl + K para ver archivo pdf"); exit(); } void printCode() { float interlinea = 0; for (int i = 0; i < code.length; i++) { // cada linea de código escrita en la pantalla text(code[i], width/4, 2 * margenArriba + imagen.height * escala + interlinea); interlinea += 15; } } /** trazo pincel **/ void trazo(float x, float y, color c, float amp) { noFill(); float alfa = map(brightness(c), 0, 255, 200, 10); // transparencia del trazo float sw = map(brightness(c), 0, 255, 5, 0.1); // ancho del trazo float sl = map(brightness(c), 0, 255, 5, amp*3); // largo del trazo int trazos = round(map(brightness(c), 0, 255, 23, 1)); for (int i = 0; i <= trazos; i++) { pushMatrix(); { translate(x, y); float rot = map ((float)hue(c), 0, 255, 0, PI/6); rotate(rot + HALF_PI * 3); stroke(c, alfa); // color de la imagen pasada al trazo strokeWeight(sw); // grosor de la linea float localy = random(-amp/2, amp/2); /* construcción del pelo del pincel*/ bezier(-sl - random(-amp/5, amp/5), localy, /* pl */ -amp/2 - random(-amp/5, amp/5), localy - random(amp/2), /*c1*/ amp/2 + random(-amp/5, amp/5), localy - random(amp/2), /*c2*/ sl + random(-amp/5, amp/5), localy + random(-amp/5, amp/5));/*p2*/ } popMatrix(); } }