Sofia López. Pincel 2
De Casiopea
Título | Pincel Sofia López |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 9 |
Período | 2012- |
Asignatura | Taller Inicial 1ª y 2ª Etapa, |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura |
Alumno(s) | Sofia López |
Profesor | Herbert Spencer |
import processing.pdf.*;
PImage img; PFont font; String[] code; float escala;
void setup() {
img = loadImage("1.jpg"); size(940, 610); //tamaño oficio apaisado background(255); float ancho = width - 160; escala = ancho/img.width;
font = createFont("Courier New", 15, true); textFont(font, 11); code = loadStrings("Trazo_Pincel.pde"); // cargo el código "trazo" (el pincel) noLoop();
}
void draw() {
float spacer = 10;
for (int y = 0; y < img.height; y += spacer) { for (int x = 0; x < img.width; x += spacer) {
// obtengo el color float plotX = map(x, 0, img.width, origenX, width-margenH); float plotY = map(y, 0, img.height, margenV, 400); color c = img.get(x, y);
trazo(plotX, plotY, c, spacer); encuadre(); } } cruces(); marcaPliegue(); printCode();
} ___________________________________________________________________
float anchoPagina = 940;
float altoPagina = 610;
float mitadH = anchoPagina/2; // 470
float mitadV = altoPagina/2; // 305
float margenH = 80;
float margenV = 100;
float origenX = 550;
float origenY = margenV;
float ancho = 310; // ancho del dibujo
float alto = 300; // alto del dibujo
void marcaPliegue() {
stroke(200); strokeWeight(.25); float largoLinea = 25; line(width/2, 0, width/2, largoLinea); line(width/2, height-largoLinea, width/2, height);
}
void cruces() {
strokeWeight(.25); stroke(0); float largoLinea = 10; // largo de la cruz de calce float offset = 3; // offset del borde del area imprimible // horizontales line(origenX - largoLinea - offset, margenV, origenX - offset, margenV); // horizontal superior izquierda line(origenX + ancho + offset, margenV, origenX + ancho + offset + largoLinea, margenV); // hsd line(origenX - largoLinea - offset, margenV + alto, origenX - offset, margenV + alto); // hii line(origenX + ancho + offset, margenV + alto, origenX + ancho + offset + largoLinea, margenV + alto); // hid // verticales line(origenX, margenV - offset - largoLinea, origenX, margenV - offset); // vsi line(origenX + ancho, margenV - offset - largoLinea, origenX + ancho, margenV - offset); // vsd line(origenX, margenV + alto + offset, origenX, margenV + alto + offset + largoLinea); // vii line(origenX + ancho, margenV + alto + offset, origenX + ancho, margenV + alto + offset + largoLinea); // vid
}
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], margenH-20, margenV + interlinea, width/2, height); interlinea += 15; }
}
void encuadre(){
fill(255); noStroke(); rect(0,0,width,margenV); // encuadre arriba rect(0,0,width-margenH-ancho,height); // encuadre izquierda rect(width-margenH,0,margenH,height); // encuadre derecha rect(0, 400, width, 210); // encuadre abajo
} ___________________________________________________________________________
void trazo(float x, float y, color c, float amp) {
noFill(); float alfa = map(brightness(c), 0, 255, 200, 10); float sw = map(brightness(c), 0, 255, 3, 0.1); float s1 = map(brightness(c), 0, 255, 3, amp*3);
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(); }
}