Saltar al contenido Saltar a la navegación

Sebastian cubillos tarea 8 canchas ciudad abierta


Títulocanchas ciudad abierta
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea n° 8
Período2012-
AsignaturaTaller Inicial Común 1ª y 2ª Etapa,
Del CursoImagen Escrita 2012,
CarrerasArquitectura, 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)Sebastián Cubillos
ProfesorHerbert Spencer

import processing.pdf.*;

PImage atardecer;
PFont font;
String[] code;  

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

void setup() {

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

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

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

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

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



void draw() {

  float spacer = 30;


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


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


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

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

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


---------------trazo-----------------------------------------

void trazo(float x, float y, color c, float amp) {
  fill(c); 
  stroke(c); 
  rect(x, y, map(brightness(c), 0, 255, amp, 0), 
  map(brightness(c), 0, 255, amp, 0));
}