Copy() bug, pixel bleeding lower half of the screen

Hi, i’m trying to make some analog-like video feedback effects using the copy() function.
copy(sx, sy, sw, sh, dx, dy, dw, dh) s=source, d=destination

When copying the screen and scaling it by some pixels, making a scaled duplicate of the content behind itself, the lower half of the screens begins a “bleeding river” of pixels. I’m trying to find a logic behind but it feels like it’s just a bug. Could you guys help me?

int a=10;

public void setup() {
  size(1000, 1000);
  background(255);
   fill(255, 10);
   stroke(255, 0, 150);
   strokeWeight(2);
}

public void draw() {
//i want to copy the content on the center on the screen and make it a little bigger on the background
copy(a,a,width-a*2,height-a*2,0,0,width,height); //(0,0,width,height,-a,-a,width+a*2,height+a*2) has the same issue
translate(width/2,height/2);
ellipse(0,0,100,100);  
}```

Hello @rroarrg,

Here is a related topic:

Try different renderers:

int a = 10;

void setup()
  {
  size(600, 600); //Default
  //size(600, 600, JAVA2D); //Default and same as size(600, 600);
  //size(600, 600, P2D);
  //size(600, 600, P3D);
  //size(600, 600, FX2D);
  
  //noSmooth(); // Try this
  
  // Curious:
  println(sketchRenderer());
  print(JAVA2D);
  }

void draw() 
  {
  copy(a, a, width-a*2, height-a*2, 0, 0, width, height); 
  circle(width/2, height/2, 100);
  //copy(a, a, width-2*a, height-2*a, 0, 0, width, height); 
  }

I don’t have an answer to why this happens with JAVA2D.

References:
https://processing.org/reference/size_.html

:)

1 Like