Isidora Correa Proyecto 8 IE 2012

De Casiopea


TítuloIsidora Correa Proyecto 8 IE 2012
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 8
Período2012-2012
Del CursoImagen Escrita 2012
CarrerasDiseñ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)Isidora Correa
ProfesorHerbert Spencer

Intervención pixeles de una fotografía


import processing.pdf.*;

PImage vista; // la foto
PFont font; // la tipografía
String[] code; // el texto del código


float margenIzquierda = 30; 
float margenArriba = 20;
float margenDerecha = 20;
float margenAbajo = 20;
float escala;

void setup() {

vista = loadImage("vista.jpg"); 
size(609, 765, PDF, "vista.pdf"); 



float ancho = width - (margenIzquierda + margenDerecha);
escala = ancho/(float)vista.width;

noStroke();
noLoop(); 
background(255);

font = createFont("Arial", 8); 
textFont(font, 8);

code = loadStrings("trazo.pde"); 
}



void draw() {

float spacer = 10;


for (int y = 0; y < vista.height; y += spacer) {
for (int x = 0; x < vista.width; x += spacer) {

// obtengo el color
float plotX = map(x, 0, vista.width, margenIzquierda, width-margenDerecha);
float plotY = map(y, 0, vista.height, margenArriba, margenArriba + (vista.height * escala));
color c = vista.get(x, y);


trazo(plotX, plotY, c, spacer);
}
}
printCode();
println("----->PDF done!");
exit();
}

void printCode() {
float interlinea = 0;
for (int i = 0; i < code.length; i++) {

text(code[i], width/4, 2 * margenArriba + vista.height * escala + interlinea);
interlinea += 15;
}
}



void trazo(float x, float y, color c, float amp) {
fill(c);

ellipse(x, y, map(brightness(c), 0, 255, amp, 0), 
map(brightness(c), 0, 255, amp, 0));
}