Sei sulla pagina 1di 2

PImage img,img2;

float scaleFactor, translateX, translateY;


float scaler = 1;
int rectX, rectY;
// Position of square button
int rectSize = 90;
// Diameter of rect
color rectColor, circleColor, baseColor;
color rectHighlight, circleHighlight;
color currentColor;
boolean rectOver = false;
String a=str(mouseX);
String b=str(mouseY);
void setup() {
size(800,600);
// Images must be in the "data" directory to load correctly
img2 = loadImage("left_eye_full.png");
}
void draw() {
// background(50);
//cursor(CROSS);
update(mouseX, mouseY);
//background(200);
if (rectOver) {
fill(color(200));
} else {
fill(rectColor);
}
stroke(255);
rect(rectX, rectY, rectSize, rectSize);

translate(width/2,height/2); // use translate around scale


scale(scaler);
translate(-width/2,-height/2); // to scale from the center
q();
image(img2, 200, 40);
}
void
if
if
if
}

keyPressed()
(key == 'z')
(key == 'x')
(key == 'c')

{
{scaler -= 0.1;} // smaller
{scaler += 0.1;} // bigger
{scaler = 1;} // reset scale

void q(){
noFill();
stroke(255);
quad(299+190,144+30,311+190,83+30,271+190,79+30,271+190,141+30);

quad(299+190,144+30,321+190,152+30,343+190,93+30,311+190,83+30);
quad(331+190,155+30,370+190,74+30,353+190,68+30,321+190,151+30);

}
void mouseWheel(MouseEvent e)
{
scaler -= e.getAmount()/126;
}
//button load
void update(int x, int y) {
rectOver = false;
if ( overRect(rectX, rectY, rectSize, rectSize) ) {
rectOver = true;
}
}
boolean overRect(int x, int y, int width, int height) {
if (mouseX >= x && mouseX <= x+width &&
mouseY >= y && mouseY <= y+height) {
return true;
} else {
return false;
}
}
void fileSelected(File selection) {
if (selection == null) {
println("Window was closed or the user hit cancel.");
} else {
println("User selected " + selection.getAbsolutePath());
// label1.setText(selection.getAbsolutePath());
img = loadImage(selection.getAbsolutePath());
img.resize(500, 500);
image(img, 170, 0);
}
}
void mousePressed() {
selectInput("Select a file to process:", "fileSelected");
}