Loading...
Logo
Processing Forum
Why this artifacts in upper left corner of the ellipse when they overlap?
EDIT:
it seems to be related to the antialias, if you skip smooth() the artifact is gone...

Copy code
  1. PGraphics c;
  2. PGraphics d;
  3. void setup() {
  4.   size(300, 300);
  5.   background(255);
  6.   c = createGraphics(width, height, JAVA2D);
  7.   d = createGraphics(width, height, JAVA2D);
  8.   c.beginDraw();
  9.   c.smooth();
  10.   c.endDraw();
  11.   d.beginDraw();
  12.   d.smooth();
  13.   d.endDraw();
  14. }

  15. void draw() {  
  16.   background(255);
  17.   c.beginDraw();
  18.   c.background(0, 0);
  19.   c.fill(255);
  20.   c.stroke(0);
  21.   c.ellipse(mouseX, mouseY, 30, 30);
  22.   c.endDraw();

  23.   d.beginDraw();
  24.   d.background(0, 0);
  25.   d.fill(255);
  26.   d.stroke(0);
  27.   d.ellipse(width/2, height/2, 30, 30);
  28.   d.endDraw();
  29.   d.blend(c, 0, 0, width, height, 0, 0, width, height, DIFFERENCE);
  30.   image(d, 0, 0);
  31. }

Replies(1)