Diferencia entre revisiones de «Tarea 8»
Sin resumen de edición |
Sin resumen de edición |
||
Línea 1: | Línea 1: | ||
{{Proyecto | {{Proyecto | ||
|Título=tarea 8 | |Título=tarea 8 puente | ||
|Tipo de Proyecto=Proyecto de Curso | |Tipo de Proyecto=Proyecto de Curso | ||
|Palabras Clave=tarea 8 | |Palabras Clave=tarea 8 | ||
|Carreras Relacionadas= | |Año de Inicio=2012 | ||
|Cursos Relacionados= | |Carreras Relacionadas=Arquitectura | ||
|Asignaturas Relacionadas=Imagen Escrita 2012, | |||
|Cursos Relacionados=Taller Inicial 1ª y 2ª Etapa, | |||
|Profesor=Helbert Spencer, | |Profesor=Helbert Spencer, | ||
|Alumnos= | |Alumnos=Paula Ramírez Guevara, | ||
|Imagen=Puentesillo.png | |||
}} | }} | ||
{{Media:Sketch jun21d.rar}} | |||
import processing.pdf.*; | import processing.pdf.*; | ||
PImage | |||
PFont font; | PImage puente; | ||
String[] code; | PFont font; | ||
String[] code; | |||
Línea 23: | Línea 30: | ||
void setup() { | void setup() { | ||
puente = loadImage("puente.jpg"); | |||
size(609, 765, PDF, " | size(609, 765, PDF, "puente.pdf"); | ||
float ancho = width - (margenIzquierda + margenDerecha); | float ancho = width - (margenIzquierda + margenDerecha); | ||
escala = ancho/(float) | escala = ancho/(float)puente.width; | ||
noStroke(); | noStroke(); | ||
Línea 35: | Línea 40: | ||
background(255); | background(255); | ||
font = createFont(" | font = createFont("Courier", 8); | ||
textFont(font, 8); | textFont(font, 8); | ||
code = loadStrings("trazo.pde"); | code = loadStrings("trazo.pde"); | ||
} | } | ||
void draw() { | void draw() { | ||
Línea 48: | Línea 51: | ||
for (int y = 0; y < | for (int y = 0; y <puente.height; y += spacer) { | ||
for (int x = 0; x < | for (int x = 0; x < puente.width; x += spacer) { | ||
float plotX = map(x, 0, puente.width, margenIzquierda, width-margenDerecha); | |||
float plotY = map(y, 0, puente.height, margenArriba, margenArriba + (puente.height * escala)); | |||
color c = puente.get(x, y); | |||
trazo(plotX, plotY, c, spacer); | trazo(plotX, plotY, c, spacer); | ||
Línea 63: | Línea 65: | ||
println("----->PDF done!"); | println("----->PDF done!"); | ||
exit(); | exit(); | ||
} | } | ||
Línea 69: | Línea 73: | ||
for (int i = 0; i < code.length; i++) { | for (int i = 0; i < code.length; i++) { | ||
text(code[i], width/4, 2 * margenArriba + | text(code[i], width/4, 2 * margenArriba + puente.height * escala + interlinea); | ||
interlinea += 15; | interlinea += 15; | ||
} | } | ||
} | } | ||
***********************TRAZO******************* | |||
void trazo(float x, float y, color c, float amp) { | void trazo(float x, float y, color c, float amp) { | ||
fill(c); | fill(c); | ||
ellipse(x, y, map(brightness(c), | |||
map(brightness(c), | ellipse(x, y, map(brightness(c), 89, 34, amp, 13), | ||
map(brightness(c), 56, 76, amp, 8)); | |||
} | } |
Revisión del 10:29 21 jun 2012
Título | tarea 8 puente |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 8 |
Período | 2012- |
Asignatura | Imagen Escrita 2012, |
Del Curso | Taller Inicial 1ª y 2ª Etapa, |
Carreras | Arquitectura |
Alumno(s) | Paula Ramírez Guevara |
Profesor | Helbert Spencer |
import processing.pdf.*;
PImage puente;
PFont font;
String[] code;
float margenIzquierda = 30; float margenArriba = 20; float margenDerecha = 20; float margenAbajo = 20; float escala;
void setup() {
puente = loadImage("puente.jpg"); size(609, 765, PDF, "puente.pdf");
float ancho = width - (margenIzquierda + margenDerecha); escala = ancho/(float)puente.width;
noStroke(); noLoop(); background(255);
font = createFont("Courier", 8); textFont(font, 8);
code = loadStrings("trazo.pde"); }
void draw() {
float spacer = 10;
for (int y = 0; y <puente.height; y += spacer) {
for (int x = 0; x < puente.width; x += spacer) {
float plotX = map(x, 0, puente.width, margenIzquierda, width-margenDerecha);
float plotY = map(y, 0, puente.height, margenArriba, margenArriba + (puente.height * escala));
color c = puente.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 + puente.height * escala + interlinea); interlinea += 15; } }
- TRAZO*******************
void trazo(float x, float y, color c, float amp) { fill(c);
ellipse(x, y, map(brightness(c), 89, 34, amp, 13),
map(brightness(c), 56, 76, amp, 8));
}