以下為程式碼
void setup(){
size(600,600);
}
void draw(){
if(mousePressed)line(mouseX,mouseY,pmouseX,pmouseY);
}
void keyPressed(){
if(key=='1')stroke(#FF0015);
if(key=='2')stroke(#FFD900);
if(key=='3')stroke(#00FF1B);
if(key=='4')strokeWeight(30);
if(key=='5')strokeWeight(40);
if(key=='s') save("now.png");
if(key=='r'){
PImage img=loadImage("now.png");
if(img!=null) image(img, 0,0);
}
}
int now=1;
void mouseWheel(MouseEvent event){
float e = event.getCount();
//可打println(e);來看看監測區的數值變化
now += e;
if(now<1) now=1;
strokeWeight(now);
println(now);
}
--------------------------------------------------------------------------
void setup(){
size(600,600);
}
void draw(){
if(mousePressed)line(mouseX,mouseY,pmouseX,pmouseY);
}
boolean bColorSelect = false;
void keyPressed(){
if(key=='1')stroke(#FF0015);
if(key=='2')stroke(#FFD900);
if(key=='3')stroke(#00FF1B);
if(key=='4')strokeWeight(30);
if(key=='5')strokeWeight(40);
if(key=='s') save("now.png");
if(key=='r'){
PImage img=loadImage("now.png");
if(img!=null) image(img, 0,0);
}
if(key=='c'){
bColorSelect=true;
save("beforeColor.png");
PImage img=loadImage("colorMap.png");
image(img,0,0);
}
if(key=='d'){
PImage img=loadImage("beforeColor.png");
if(img!=null) image(img,0,0);
}
//上面只是叫出調色盤圖片 目前無效果
}
int now=1;
void mouseWheel(MouseEvent event){
float e = event.getCount();
//println(e);
now += e;
if(now<1) now=1;
strokeWeight(now);
println(now);
}
---------
void setup(){
size(600,600);
background(255);
}
void draw(){
if(bColorSelect){
loadPixels();
stroke(pixels[mouseX+mouseY*width]);
}
else if(mousePressed)line(mouseX,mouseY,pmouseX,pmouseY);
}
boolean bColorSelect = false;
void keyPressed(){
if(key=='1')stroke(#FF0015);
if(key=='2')stroke(#FFD900);
if(key=='3')stroke(#00FF1B);
if(key=='4')strokeWeight(30);
if(key=='5')strokeWeight(40);
if(key=='s') save("now.png");
if(key=='r'){
PImage img=loadImage("now.png");
if(img!=null) image(img, 0,0);
}
if(key=='c' && bColorSelect==false){
bColorSelect=true;
save("beforeColor.png");
PImage img=loadImage("colorMap.png");
image(img,0,0);
}else if(key=='c' && bColorSelect==true){
bColorSelect=false;
PImage img=loadImage("beforeColor.png");
if(img!=null)image(img, 0,0);
}
if(key=='d'){
PImage img=loadImage("beforeColor.png");
if(img!=null) image(img,0,0);
}
}
int now=1;
void mouseWheel(MouseEvent event){
float e = event.getCount();
//println(e);
now += e;
if(now<1) now=1;
strokeWeight(now);
println(now);
}
可以截取顏色惹~~
void setup(){
size(600,600);
background(255);
}
void draw(){
if(bColorSelect){
loadPixels();
stroke(pixels[mouseX+mouseY*width]);
}
else if(mousePressed)line(mouseX,mouseY,pmouseX,pmouseY);
}
boolean bColorSelect = false;
void keyPressed(){
if(key=='1')stroke(#FF0015);
if(key=='2')stroke(#FFD900);
if(key=='3')stroke(#00FF1B);
if(key=='4')strokeWeight(30);
if(key=='5')strokeWeight(40);
if(key=='s') save("now.png");
if(key=='r'){
PImage img=loadImage("now.png");
if(img!=null) image(img, 0,0);
}
if(key=='c' && bColorSelect==false){
bColorSelect=true;
save("beforeColor.png");
PImage img=loadImage("colorMap.png");
image(img,0,0);
}else if(key=='c' && bColorSelect==true){
bColorSelect=false;
PImage img=loadImage("beforeColor.png");
if(img!=null)image(img, 0,0);
}
if(key=='d'){
PImage img=loadImage("beforeColor.png");
if(img!=null) image(img,0,0);
}
}
int now=1;
void mouseWheel(MouseEvent event){
float e = event.getCount();
//println(e);
now += e;
if(now<1) now=1;
strokeWeight(now);
println(now);
}
可以截取顏色惹~~
沒有留言:
張貼留言