Francisco Casas - Experimento "Paint"

De Casiopea
La versión para imprimir ya no se admite y puede contener errores de representación. Actualiza los marcadores del navegador y utiliza en su lugar la función de impresión predeterminada del navegador.


TítuloExperimento Paint
Tipo de ProyectoProyecto de Curso
Palabras Clavetarea 4
Período2012-
AsignaturaImagen Escrita 2012,
Del CursoImagen Escrita 2012,
CarrerasArquitectura
Alumno(s)Francisco Casas
ProfesorHerbert Spencer


<pre> int bwbar; int colorbar; int s; void setup() { size(600, 600); background(255); //smooth(); } void draw() { colorfields(); if (mousePressed) {//darkness/lightness if (mouseY > 1 && mouseY<height/20 && mouseX < width-1 && mouseX > width/20) { bwbar = abs(mouseX % width); } } if (mousePressed) { //color select if (mouseY < height-1 && mouseY>height/20 && mouseX < width/20 && mouseX >1) { colorbar = abs(mouseY % height); } } stroke(0); noFill(); strokeWeight(2); rect(width/20+1, height/20+1, width, height); stroke(255); strokeWeight(0); line(bwbar+1, 0, bwbar+1, height/20-2); line(bwbar-1, 0, bwbar-1, height/20-2); line(0, colorbar-1, width/20-2, colorbar-1); line(0, colorbar+1, width/20-2, colorbar+1); color x; color y; color z; y = get(0, colorbar); x = get(bwbar, 0); z = blendColor(x, y, OVERLAY); fill(z); rect (0, 0, width/20, height/20); drawing(); } void keyReleased() { s ++; if (key == 's' || key == 'S') { PImage partialSave = get(width/20+2, width/20+2, width, height); partialSave.save("pic" + s); } } void colorfields() { color black; color white; black = #000000; white = #FFFFFF; for (int x = 0+width/20; x < width; x++) { float percent = norm(x, 0, width); stroke(lerpColor(black, white, percent, HSB)); line(x, 0, x, height/20); } color one = #0033ee; color two = #00ee33; one = #ff0000; two = #00ff00; for (int y=0+height/20;y < height; y++) { float percent2 = norm (y, 0, height/3); stroke(lerpColor(one, two, percent2, HSB)); line(0, y, width/20, y); } } void drawing() { if (mousePressed) { if (mouseX > width/20+1 && mouseY>height/20+1) { stroke(get(1, 1)); strokeWeight(10); line(pmouseX, pmouseY, mouseX, mouseY); stroke(255); strokeWeight(5); } } } </pre>