Juan Francisco Rojas: Pincel Mejorado
De Casiopea
Título | Juan Francisco Rojas: Pincel Mejorado |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 8 |
Período | 2012- |
Asignatura | Taller Inicial 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura |
Alumno(s) | Juan Francisco Rojas |
Profesor | Herbert Spencer |
- Esta tarea consiste en una mejora de la tarea 8.
- Se construye un trazo que imita el trazo de un pincel.
Descargar el archivo: Medio:Juan Francisco Rojas Tarea 8 Mejorada.rar
import processing.pdf.*; PImage imagen; PFont font; String[] code; float mI = 30; // Margen Izquierda float mAr = 30; // Margen Arriba float mD = 40; // Margen Derecha float mAb = 30; // Margen Abajo float escala; void setup() { imagen = loadImage("1.jpg"); size(609, 765, PDF, "Tarea_8_Mejorada.pdf"); // tamaño carta float ancho = width - (mI + mD); escala = ancho/imagen.width; noLoop(); background(255); smooth(); font = createFont("Courier", 15, true); textFont(font, 12); code = loadStrings("Trazo_Pincel.pde"); // cargo el código "trazo" (el pincel) } void draw() { float spacer = 10; for (int y = 0; y < imagen.height; y += spacer) { for (int x = 0; x < imagen.width; x += spacer) { // obtengo el color float plotX = map(x, 0, imagen.width, mI, width-mD); float plotY = map(y, 0, imagen.height, mAr, mAr + (imagen.height * escala)); color c = imagen.get(x, y); trazo(plotX, plotY, c, spacer); encuadre(); } } printCode(); texto(); println("Listo. Presione Ctrl + K para ver el archivo pdf"); exit(); } void printCode() { fill(#747272); // color de la letra float interlinea = 0; for (int i = 0; i < code.length; i++) { // escribo cada línea de código en la pantalla text(code[i], width/16, height/2 + 83 + interlinea); interlinea += 12.5; } } void texto() { fill(#000000); text("Juan Francisco Rojas", width - mD*5, height - mAb - 10); text("1 Año Arquitectura", width - mD*5, height - mAb + 5 ); } void encuadre() { float x = height/2 + 50; noStroke(); fill(255); rect(0, 0, 30, height); // rectángulo izquierdo rect(0, 0, width, 30); // rectángulo arriba rect(width-50, 0, 50, height); // rectángulo derecha rect(0, x, width, x); // rectángulo abajo } /*Trazo Pincel*/ void trazo(float x, float y, color c, float amp) { noFill(); float alfa = map(brightness(c), 0, 255, 200, 10); //transp. del trazo float sw = map(brightness(c), 0, 255, 3, 0.1); // ancho del trazo float s1 = map(brightness(c), 0, 255, 3, amp*3); // largo del trazo int trazos = round(map(brightness(c), 0, 255, 20, 0)); 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 línea float localy = random(-amp/2, amp/2); bezier(-s1 - random(-amp/5, amp/5), localy, -amp/2 - random(-amp/5, amp/5), localy - random(amp/2), amp/2 + random(-amp/5, amp/5), localy - random(amp/2), s1 + random(-amp/5, amp/5), localy + random(-amp/5, amp/5)); } popMatrix(); } }