Gabriela Torres: tarea 8

De Casiopea
{{{Título}}}



Título
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 8
Del CursoImagen Escrita 2012,
CarrerasArquitectura
Alumno(s)Gabriela Torres
ProfesorHerbert Spencer

//la tarea intenta mostrar un estilo impresionista con un nuevo trazo//

import processing.pdf.*;

PImage img;	
PFont font;
String[] code;

float mI = 30; // Margen Izquierda
float mAr  = 20; // Margen Arriba
float mD = 20; // Margen Derecha
float mAb   = 20; // Margen Abajo
float escala;

void setup() {
  size(609,765, PDF, "tarea_8.pdf");
  img = loadImage("alpes.jpg");
  background (255);
  noLoop();
  smooth();
  float ancho = width - (mI + mD);
  escala = ancho/(float)img.width;
  font = createFont("Courier", 8, true);
  textFont(font, 8);
  code = loadStrings("pincel.pde");
}

void draw() {
  
  float sp = 10;
  for (int y = 0; y < img.height; y += sp){
    for (int x = 0; x< img.width; x += sp){
      
      float plotX = map(x, 0, img.width, mI, width-mD);
      float plotY = map(y, 0, img.height, mAr, mAr + (img.height * escala));
      color c = img.get(x, y);
      
      trazo(plotX, plotY, c, sp);
    }
  }
  printCode();
  texto();
  println("----->PDF done!");
  exit();
}

void printCode() {
  fill(0);
  float interlinea = 0;
  for (int i = 0; i < code.length; i++) {
    text(code[i], width/4, 2 * mAr + img.height * escala + interlinea);
    interlinea += 15;
  }
}

void texto() {
  fill(0);
  text("Gabriela Torres", width - mD*5, height - mAb - 20);
  text("1 Año Arquitectura", width - mD*5, height - mAb);
}

/*******************trazo**********************/

void trazo(float x, float y, color c, float amp) { 
  stroke (c);
  strokeWeight(random(1,3));
  line(x-amp, y+amp,x+amp, y-amp);
 
}

//la imagen se construye con líneas diagonales de distinto grosor//