void setup(){
size(800,600);
background(#F2478E);
}
void draw(){
fill(0,255,0);rect(0,0,100,100);
fill(0,0,255);rect(0,100,100,100);
fill(255,255,0);rect(0,200,100,100);
}
void mouseDragged(){
line(mouseX,mouseY,pmouseX,pmouseY);
}
void mousePressed(){
if(mouseX<100 && mouseY<100){stroke(0,255,0);}
else if(mouseX<100 && mouseY<200){stroke(0,0,255);}
else if(mouseX<100 && mouseY<300){stroke(255,255,0);}
}
void setup(){
size(800,600);
background(255);
stroke(#FF081C);
}
float myTsuTsuDer=1;
color myStroke=color(0);//0=black
void draw(){
stroke(0);strokeWeight(1);
fill(0,255,0);rect(0,0,100,100);
fill(0,0,255);rect(0,100,100,100);
fill(255,255,0);rect(0,200,100,100);
stroke(myStroke);strokeWeight(myTsuTsuDer);
}
void mouseDragged(){
line(mouseX,mouseY,pmouseX,pmouseY);
}
void mousePressed(){
if(mouseX<100 && mouseY<100){stroke(0,255,0);}
else if(mouseX<100 && mouseY<200){stroke(0,0,255);}
else if(mouseX<100 && mouseY<300){stroke(255,255,0);}
if(mouseX>700) myTsuTsuDer=mouseY/30;
}
PImage imgBG;
PImage imgBlack;
void setup(){
size(800,600);
imgBG=loadImage("a.jpg");
imgBlack=createImage(800,600,ALPHA);
imgBlack.loadPixels();
for (int i=0;i<imgBlack.pixels.length;i++){
imgBlack.pixels[i] =color(255);
}
imgBlack.updatePixels();
}
void draw() {
image(imgBG, 0 ,0 ,width,height);
}
void mouseDragged(){
}
PImage imgBG;
PImage imgBlack;
void setup(){
size(800,600);
imgBG=loadImage("a.jpg");
imgBlack=createImage(800,600,ARGB);
imgBlack.loadPixels();
for (int i=0;i<imgBlack.pixels.length;i++){
imgBlack.pixels[i] =color(0,0,0,255);
}
imgBlack.updatePixels();
}
void draw() {
image(imgBG,0,0,width,height);
image(imgBlack,0,0,width,height);
}
void mouseDragged(){
imgBlack.loadPixels();
imgBlack.pixels[mouseX+mouseY*width] = color(0,0,0,0);
imgBlack.updatePixels();
}
PImage imgBG;
PGraphics pgBlack;
void setup(){
size(800,600);
imgBG=loadImage("a.jpg");
pgBlack=createGraphics(800,600);
pgBlack.beginDraw();
pgBlack.strokeWeight(50);
pgBlack.stroke(0,0,0,28);
pgBlack.endDraw();
}
void draw() {
image(imgBG,0,0,width,height);
image(pgBlack,0,0);
}
void mouseDragged(){
pgBlack.beginDraw();
pgBlack.strokeWeight(50);
pgBlack.stroke(255,255,255,100);
pgBlack.line(mouseX,mouseY,pmouseX,pmouseY);
pgBlack.endDraw();
}
沒有留言:
張貼留言