-1
即时通讯试图运行一个处理草图,让您从您的计算机中选择一个图像,当选择在处理窗口中加载图像,并且一旦点击就会产生另外2张图像,原始副本每个都有自己的效果当点击,然后能够保存这些图像,到目前为止,我可以打开图像,并有一个副本与点化效果稍有变化,但我不能得到另一种效果的工作,我不知道如何保存它们,其他效果我本来计划要像三角形,而不是椭圆形的彩画立体派的影响,请帮助..试图对处理中的图像应用2种效果?
这里是我的代码....
Boolean imageAvailable = false;
PImage picture = null;
void setup() {
size(1280, 720);
selectInput("Select a file to process:", "fileSelected");
}
void fileSelected(File selection) {
if (selection == null) {
println("Window was closed or the user hit cancel.");
} else {
picture = loadImage(selection.getAbsolutePath());
imageAvailable = (picture != null);
}
}
void draw() {
if (imageAvailable) {
image(picture, 0, 0);
}
}
void mousePressed() {
if (imageAvailable) {
pointalise(picture, picture.width, 0);
}
}
void pointalise(PImage p, int sx, int sy) {
noStroke();
final int POINTSIZE = 15;
for (int y = 0; y < p.height; y += random(POINTSIZE)) {
for (int x = 0; x < p.width; x += random(POINTSIZE)) {
color c = p.get(x, y);
fill(red(c), green(c), blue(c), random(255));
float pSize = random(1, POINTSIZE);
ellipse(sx + x , sy + y, pSize, pSize);
}
}
}
你的问题到底是什么?第二个效应是什么让你感到困惑? –