Tarea8ValentinaOlivares
De Casiopea
Título | Valentina Olivares: tarea 8 |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 8 |
Del Curso | Imagen Escrita 2012, |
Carreras | Arquitectura, Diseño Gráfico, Diseño Industrial |
Alumno(s) | Valentina Olivares |
Profesor | Herbert Spencer |
import processing.pdf.*;
PImage bosque123; // la foto: imagen del bosque PFont font; // la fuente tipográfica String[] code; // el texto del código
/*
Al exportar un PDF, Processing translada las unidades de pixeles a puntos tipográficos. 1 pt = 0.0352778 cm 1 cm = 28.346438837 pt */
float margenIzquierda = 30; float margenArriba = 20; float margenDerecha = 30; float margenAbajo = 20; float escala;
void setup() {
bosque123 = loadImage("bosque123.jpg"); size(609, 765, PDF, "tarea8valentinaolivares.pdf"); // tamaño carta smooth();
float ancho = width - (margenIzquierda + margenDerecha);
escala = ancho/bosque123.width; noLoop(); background (255); smooth();
font = createFont("Helvetica", 10, true); // tipografía a partir de una fuente de sistema textFont(font, 10); code = loadStrings("trazo.pde"); // el pincel
}
void draw() {
float spacer = 5;
for (int y = 0; y < bosque123.height; y += spacer) { for (int x = 0; x < bosque123.width; x += spacer) {
// el color
float plotX = map(x, 5, bosque123.width, margenArriba, width-margenDerecha); float plotY = map(y, 0, bosque123.height, margenDerecha, margenArriba + (bosque123.height * escala)); color c = bosque123.get(x, y);
trazo(plotX, plotY, c, spacer); } } printCode(); println("Listo. Presione Ctrl + K para ver el archivo pdf"); exit();
} void printCode() {
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/4, 2 * margenArriba + bosque123.height * escala + interlinea); interlinea += 15; } }
/**************trazo*************/ void trazo(float x, float y, color c, float random) {
fill(c);
ellipse(x, y, map(brightness(c),25, 255,0,amp,5), map(brightness(c),10, 255,amp,0));
}