我可以帮助您将Processing 3(和2)应用于OSX和Windows。在离屏PGraphics缓冲区中的线性图形比直接绘制的线条要丑陋得多。似乎边缘处的抗锯齿效果不太好。您需要我帮助让离屏缓冲区图形更加美观吗?
示例图片(右侧为难看的离屏,左侧为屏幕上的):
示例代码
示例图片(右侧为难看的离屏,左侧为屏幕上的):
示例代码
PGraphics pg;
void setup(){
size (1024,768, P2D);
pixelDensity(2);
smooth();
pg = createGraphics(width, height, P2D);
noLoop();
}
void draw(){
background (0);
pushMatrix();
translate (width/2-100, height/2);
rotate (PI/6);
stroke(255);
noFill();
strokeWeight(0.5);
rect (0,0,100,100);
popMatrix();
pg.beginDraw();
pg.smooth();
pg.clear();
pg.translate (width/2+100, height/2);
pg.rotate (PI/6);
pg.stroke(255);
pg.noFill();
pg.strokeWeight(0.5);
pg.rect (0,0,100,100);
pg.endDraw();
image(pg,0,0, width, height);
save("shot.png");
}
谢谢!
这个问题也在Processing论坛这里发表了。