Renata Villaseñor, tarea 8
Título | Renata Villaseñor, tarea 8 |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 8 |
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) | Renata Villaseñor |
Profesor | Herbert Spencer |
Intervención pixeles de una fotografía
import processing.pdf.*;
PImage perro; // 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() {
perro = loadImage("perro.jpg"); size(609, 765, PDF, "perro.pdf");
float ancho = width - (margenIzquierda + margenDerecha); escala = ancho/(float)perro.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 < perro.height; y += spacer) {
for (int x = 0; x < perro.width; x += spacer) {
// obtengo el color float plotX = map(x, 0, perro.width, margenIzquierda, width-margenDerecha); float plotY = map(y, 0, perro.height, margenArriba, margenArriba + (perro.height * escala)); color c = perro.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 + perro.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)); }