Ithan Cabrera - Pizarra - Imagen Escrita

De Casiopea


TítuloTarea N° 4 Imagen Escrita 2012
Tipo de ProyectoProyecto de Curso
Palabras Claveprocessing, tarea 4
Período2012-
AsignaturaImagen Escrita 2012,
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.
Alumno(s)Ithan Cabrera
ProfesorHerbert Spencer

//Definition der Button Positionen

//Mausklick boolean mausklick = false;

//Achsen auf der die Buttons liegen int buttonxAngle = 25; int buttonyAngle = 0;

//Buttongröße int buttonWidth = 30; int buttonHeight = 30;

//Formbuttons int shapeButton01x = buttonxAngle; int shapeButton01y = buttonyAngle+20;

int shapeButton02x = buttonxAngle; int shapeButton02y = buttonyAngle+70;

int shapeButton03x = buttonxAngle; int shapeButton03y = buttonyAngle+120;

//Funktionsbuttons int operatorButton01x = buttonxAngle; int operatorButton01y = buttonyAngle+170;

int operatorButton02x = buttonxAngle; int operatorButton02y = buttonyAngle+220;

int operatorButton03x = buttonxAngle; int operatorButton03y = buttonyAngle+270;

//Farbregler int colorControlerRed = 128; int colorControlerGreen = 128; int colorControlerBlue = 128; int colorControlerTransp = 0;

//Button Gedrückt

 //Formbuttons
 int shapeButton01Pressed = 0;
 int shapeButton02Pressed = 0;
 int shapeButton03Pressed = 0;
 //Funktionsbuttons
 int operatorButton01Pressed = 0;
 int operatorButton02Pressed = 0;
 int operatorButton03Pressed = 0;


//Button Switch int buttonSwitch = 0;

//Pinsel Größe int penSize =1;

//Pinselschatten int verschwinden =100;


void setup(){

size (640,320); frameRate(30); background (255);

}


void draw(){

PImage drawTable = get(80, 0, 480, 320);
background (255);

set(80, 0, drawTable);
 
smooth();


 //Zeichenfarbe
 color drawColor = color(255-colorControlerRed, 255-colorControlerGreen, 255-colorControlerBlue, 255-colorControlerTransp);
 
 //Layout
 noStroke();
 fill(100,130,255,76);  
 rect(0,0,80,320);
 rect(560,0,80,320);
 
 //Button Rahmen
 stroke(100,130,255,127);
 strokeWeight(4);
 
 //Formbuttons
 
 //Formbutton 1 (einfacher  Pinsel)
 fill(100,130,255,shapeButton01Pressed);
 rect(shapeButton01x,shapeButton01y,buttonWidth,buttonHeight);
 stroke(0,0,0,100);
 strokeWeight(2);
 line(32,27,48,43);
 stroke(100,130,255,127);
 strokeWeight(4);
 
 //Formbutton 2 (Rechteck)
 fill(100,130,255,shapeButton02Pressed);
 rect(shapeButton02x,shapeButton02y,buttonWidth,buttonHeight);
 rectMode(CENTER);
 stroke(0,0,0,100);
 strokeWeight(2);
 rect(40,86,15,15);
 stroke(100,130,255,127);
 strokeWeight(4);
 rectMode(CORNER);
 
 //Formbutton 3 (Kreis)
 fill(100,130,255,shapeButton03Pressed);
 rect(shapeButton03x,shapeButton03y,buttonWidth,buttonHeight);
 stroke(0,0,0,100);
 strokeWeight(2);
 ellipse(40,135,20,20);
 stroke(100,130,255,127);
 strokeWeight(4);
 
 
 
 //Funktionsbuttons
 
 stroke(210,100,100,127);
 
 //Funktionsbutton 1 (Größer)
 fill(210,100,100,operatorButton01Pressed);
 rect(operatorButton01x,operatorButton01y,buttonWidth,buttonHeight);
 stroke(0,0,0,100);
 strokeWeight(2);
 line(35,185,45,185);
 line(40,180,40,190);
 stroke(210,100,100,127);
 strokeWeight(4);
 
 //Funktionsbutton 2 (Kleiner)
 fill(210,100,100,operatorButton02Pressed);
 rect(operatorButton02x,operatorButton02y,buttonWidth,buttonHeight);
 stroke(0,0,0,100);
 strokeWeight(2);
 line(35,235,45,235);
 stroke(210,100,100,127);
 strokeWeight(4);
 
 //Funktionsbutton 3 (Neu)
 fill(210,100,100,operatorButton03Pressed);
 rect(operatorButton03x,operatorButton03y,buttonWidth,buttonHeight);
 stroke(0,0,0,100);
 strokeWeight(2);
 line(32,277,48,293);
 line(32,293,48,277);
 stroke(210,100,100,127);
 strokeWeight(4);
 



     //Farbregler
 
 noStroke();
 for (int i=0; i<255; i++) {
               fill(256-i, 0, 0);
               rect(572, 20+i, 1, 1);
               fill(0, 256-i, 0);
               rect(591, 20+i, 1, 1);
               fill(0, 0, 256-i);
               rect(609, 20+i, 1, 1);
               fill(0, 0, 0, 256-i);
               rect(628, 20+i, 1, 1);
               }
 
     //Controler
       rectMode(CENTER);
       noStroke();
       
   
       //Rot Regler
       fill(255,0,0,128);
       rect(572, colorControlerRed+20, 10, 10);
       //Grün Regler
       fill(0,255,0,128);
       rect(591, colorControlerGreen+20, 10, 10);  
       //Blau Regler
       fill(0,0,255,128);
       rect(609, colorControlerBlue+20, 10, 10);
       //Transparenz Regler
       fill(0,0,0,0);
       stroke(0);
       strokeWeight(1);
       rect(628, colorControlerTransp+20, 10, 10);
           
   
       //Farbanzeigekästchen
       stroke(255);
       strokeWeight(4);
       fill(drawColor);
       rect(600,300,30,15);
    
    
       rectMode(CORNER); 
    
          //Controler Bewegung
      
            //Controler Rot
            if (mouseX >= 567 && mouseX <= 577 && mausklick == true){
              colorControlerRed = (mouseY-20);
            }
      
            if(colorControlerRed >= 255){
               colorControlerRed = 255;
            }
            if(colorControlerRed <= 0){
               colorControlerRed = 0;
            }
            //Controler Grün
            if (mouseX >= 586 && mouseX <= 596 && mausklick == true){
              colorControlerGreen = (mouseY-20);
            }
      
            if(colorControlerGreen >= 255){
              colorControlerGreen = 255;
            }

            if(colorControlerGreen <= 0){
              colorControlerGreen = 0;
            }
            //Controler Blau
            if (mouseX >= 604 && mouseX <= 614 && mausklick == true){
              colorControlerBlue = (mouseY-20);
            }
       
            if(colorControlerBlue >= 255){
               colorControlerBlue = 255;
            }
           if(colorControlerBlue <= 0){
           colorControlerBlue = 0;
           }
           
           //Controler Transparenz
            if (mouseX >= 623 && mouseX <= 633 && mausklick == true){
              colorControlerTransp = (mouseY-20);
            }
       
            if(colorControlerTransp >= 255){
               colorControlerTransp = 255;
            }
           if(colorControlerTransp <= 0){
           colorControlerTransp = 0;
           }
          
     //Button Rollover
     
     //Formbutton  1  (einfacher  Pinsel)
     if (mouseX <= shapeButton01x+buttonWidth && mouseX >= shapeButton01x && mouseY >= shapeButton01y && mouseY <= shapeButton01y+buttonHeight){
         fill(100,130,255,0);
         stroke(100,130,255,127);
         strokeWeight(4);
      rect(shapeButton01x,shapeButton01y,buttonWidth,buttonHeight);
     } 
     
     //Formbutton  2 (Rechteck)
     if (mouseX <= shapeButton02x+buttonWidth && mouseX >= shapeButton02x && mouseY >= shapeButton02y && mouseY <= shapeButton02y+buttonHeight){
         fill(100,130,255,0);
         stroke(100,130,255,127);
         strokeWeight(4);
      rect(shapeButton02x,shapeButton02y,buttonWidth,buttonHeight);
     } 
     
     //Formbutton  3 (Kreis)
     if (mouseX <= shapeButton03x+buttonWidth && mouseX >= shapeButton03x && mouseY >= shapeButton03y && mouseY <= shapeButton03y+buttonHeight){
         fill(100,130,255,0);
         stroke(100,130,255,127);
         strokeWeight(4);
      rect(shapeButton03x,shapeButton03y,buttonWidth,buttonHeight);
     } 
     
     
     //Funktionsbutton  1  (Größer)
     if (mouseX <= operatorButton01x+buttonWidth && mouseX >= operatorButton01x && mouseY >= operatorButton01y && mouseY <= operatorButton01y+buttonHeight){
         fill(100,130,255,0);
         stroke(210,100,100,127);
         strokeWeight(4);
      rect(operatorButton01x,operatorButton01y,buttonWidth,buttonHeight);
     } 
     
     //Funktionsbutton  2 (Kleiner)
     if (mouseX <= operatorButton02x+buttonWidth && mouseX >= operatorButton02x && mouseY >= operatorButton02y && mouseY <= operatorButton02y+buttonHeight){
         fill(100,130,255,0);
         stroke(210,100,100,127);
         strokeWeight(4);
      rect(operatorButton02x,operatorButton02y,buttonWidth,buttonHeight);
     } 
     
     //Funktionsbutton  3 (Neu)
     if (mouseX <= operatorButton03x+buttonWidth && mouseX >= operatorButton03x && mouseY >= operatorButton03y && mouseY <= operatorButton03y+buttonHeight){
         fill(100,130,255,0);
         stroke(210,100,100,127);
         strokeWeight(4);
      rect(operatorButton03x,operatorButton03y,buttonWidth,buttonHeight);
     } 



         //Button Gedrückt
     
             //Formbutton  1  (einfacher  Pinsel)
              if (mouseX <= shapeButton01x+buttonWidth && mouseX >= shapeButton01x && mouseY >= shapeButton01y && mouseY <= shapeButton01y+buttonHeight && mausklick == true){
                 buttonSwitch = (1);
              } 
     
              if (buttonSwitch ==  1){
                  shapeButton01Pressed = 255;
              } else {
                  shapeButton01Pressed = 0;
              }  
     
     
             //Formbutton  2 (Rechteck)
              if (mouseX <= shapeButton02x+buttonWidth && mouseX >= shapeButton02x && mouseY >= shapeButton02y && mouseY <= shapeButton02y+buttonHeight && mausklick == true){
                 buttonSwitch = (2);
              } 
     
              if (buttonSwitch ==  2){
                  shapeButton02Pressed = 255;
              } else {
                  shapeButton02Pressed = 0;
              }  
     
     
             //Formbutton  3 (Kreis)
              if (mouseX <= shapeButton03x+buttonWidth && mouseX >= shapeButton03x && mouseY >= shapeButton03y && mouseY <= shapeButton03y+buttonHeight && mausklick == true){
                 buttonSwitch = (3);
              } 
              if (buttonSwitch ==  3){
                  shapeButton03Pressed = 255;
              } else {
                  shapeButton03Pressed = 0;
              }  
              
              
              
             //Funktionsbutton  1 (Größer)
              if (mouseX <= operatorButton01x+buttonWidth && mouseX >= operatorButton01x && mouseY >= operatorButton01y && mouseY <= operatorButton01y+buttonHeight && mausklick == true){
                 penSize = penSize+1;
                 operatorButton01Pressed = 255;
              } else {
                 operatorButton01Pressed = 0;
              }  
              
             //Funktionsbutton  2 (Kleiner)
              if (mouseX <= operatorButton02x+buttonWidth && mouseX >= operatorButton02x && mouseY >= operatorButton02y && mouseY <= operatorButton02y+buttonHeight && mausklick == true){
                 penSize = penSize-1;
                  if(penSize <=1){
                    penSize =1;
                  }
                 operatorButton02Pressed = 255;
              } else {
                 operatorButton02Pressed = 0;
              }  
              
             //Funktionsbutton  3 (Neu)
              if (mouseX <= operatorButton03x+buttonWidth && mouseX >= operatorButton03x && mouseY >= operatorButton03y && mouseY <= operatorButton03y+buttonHeight && mausklick == true){
                 fill(255);
                 noStroke();
                 rect(80,0,480,320);
                 operatorButton03Pressed = 255;
              } else {
                 operatorButton03Pressed = 0;
              }  


//Zeichenfunktionen

 //Normaler Pinsel
 if (buttonSwitch == 1 && mouseX >= 80 && mouseX <= 560 && mausklick == true){
   stroke(drawColor);
   strokeWeight(penSize);
   line(mouseX, mouseY,pmouseX,pmouseY);
   }
 //Rechteck
 if (buttonSwitch == 2 && mouseX >= 80 && mouseX <= 560 && mausklick == true){
   fill(drawColor);
   noStroke();
   rectMode(CENTER);
   rect(mouseX, mouseY,penSize*10,penSize*10);
   rectMode(CORNER);
   }
  
 //Kreis
 if (buttonSwitch == 3 && mouseX >= 80 && mouseX <= 560 && mausklick == true){
   fill(drawColor);
   noStroke();
   ellipse(mouseX, mouseY,penSize*10,penSize*10);
   }

}


void mousePressed() {

   mausklick = true; 

}

void mouseReleased() {

   mausklick = false;
   

}