Génesis Morales - Tarea 7

De Casiopea


TítuloGénesis Morales - Tarea 7
Tipo de ProyectoProyecto de Taller
Palabras Clavetarea 7
Período2012-
AsignaturaTaller Inicial 1ª y 2ª Etapa,
Del Cursoimagen escrita 2012
CarrerasArquitectura
Alumno(s)Génesis Morales
ProfesorHerbert Spencer

import processing.pdf.*; String[] code; PFont font; PImage img;

void setup() {

 String file = ""+year()+'-'+month()+'-'+day()+'_'+hour()+"-"+minute()+".pdf";
 size((int)anchoPagina, (int)altoPagina, PDF, file); // equivale a tamaño oficio apaisado
 code = loadStrings("dibujo.pde");
 font = createFont("Courier New", 30);
 img = loadImage("1.jpg");
 noLoop();

}

void draw() {

 background(255);
 marcaPliegue();
 image(img, origenX, origenY, ancho, alto);
 cruces();
 texto();
 drawCode();
 println("Listo. Presione Ctrl+K para ver el pdf");
 exit();

}


void drawCode() {

 textFont(font, 13);
 fill(100);
 float interlinea = 15;
 float Vinc = 0;
 for (int i = 0; i < code.length; i++) {
   // escribo cada línea de código en la pantalla
   text(code[i], margenH, margenV + 30 + Vinc);
   Vinc += interlinea;
 }

}


etc--------------------

float anchoPagina = 940; float altoPagina = 610; float mitadH = anchoPagina/2; // 470 float mitadV = altoPagina/2; // 305 float margenH = 80; float margenV = 100; float origenX = 550; // 550 float origenY = 100; // 100 float ancho = 310; // ancho del dibujo, 310 float alto = 300; // alto del dibujo, 300


void marcaPliegue() {

 stroke(0);
 strokeWeight(1);
 float largoLinea = 25;
 line(width/2, 0, width/2, largoLinea);
 line(width/2, height-largoLinea, width/2, height);

}

void cruces() {

 strokeWeight(1);
 stroke(0);
 float largoLinea = 10;  // largo de la cruz de calce
 float offset = 3;       // offset del borde del area imprimible
 // horizontales
 line(origenX - largoLinea - offset, origenY, origenX - offset, origenY);                                // horizontal superior izquierda
 line(origenX + ancho + offset, origenY, origenX + ancho + offset + largoLinea, origenY);                // hsd
 line(origenX - largoLinea - offset, origenY + alto, origenX - offset, origenY + alto);                  // hii
 line(origenX + ancho + offset, origenY + alto, origenX + ancho + offset + largoLinea, origenY + alto);  // hid
 // verticales
 line(origenX, origenY - offset - largoLinea, origenX, origenY - offset);                                // vsi
 line(origenX + ancho, origenY - offset - largoLinea, origenX + ancho, origenY - offset);                // vsd
 line(origenX, origenY + alto + offset, origenX, origenY + alto + offset + largoLinea);                  // vii
 line(origenX + ancho, origenY + alto + offset, origenX + ancho, origenY + alto + offset + largoLinea);  // vid

}


void encuadre() {

 fill(255);
 noStroke();
 rect(origenX-30, origenY-30, 30, alto+30); // encuadre izquierdo
 rect(origenX, origenY-30, ancho+30, 30); // encuadre arriba
 rect(origenX+ancho, origenY, 30, alto+30); // encuadre derecho
 rect(origenX-30, origenY+alto, ancho+30, 30); // encuadre abajo

}

void texto(){

 fill(0);
 textFont(font, 18);
 text("Tarea 7: Insectario", margenH, margenV);

}



dibujo----------------

void dibujo() {

 class mascaras {
   float x, y;
   float[][] v; 
   int vn; 
   float tam; 
   float w, h;
   mascaras(float x, float y) {
     this.x = x;
     this.y = y;
     vn = round(random(10, 40));
     v = new float[vn][2];
     tam = 30;
     init();
   }
   void init() {
     w = tam/2;
     h = tam;
     for (int i = 0; i < vn; i++) {
       v[i][0] = random(w);
       v[i][1] = random(-h/2, h/2);
     }
   }
 }

}