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

**URL:** <https://discourse.processing.org/t/copy-bug-pixel-bleeding-lower-half-of-the-screen/35917>\
**Category:** Processing\
**Created:** [March 24, 2022, 10:58am UTC](https://discourse.processing.org/t/copy-bug-pixel-bleeding-lower-half-of-the-screen/35917 "2022-03-24T10:58:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rroarrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/rroarrg/32/15928_2.png) [@rroarrg](https://discourse.processing.org/u/rroarrg)\
**Post date:** [March 24, 2022, 10:58am UTC](https://discourse.processing.org/t/copy-bug-pixel-bleeding-lower-half-of-the-screen/35917/1 "2022-03-24T10:58:02Z")

</div>

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?

 ![bug](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/e/eeee4eba57beabe5d59d6c03146ad1f0af31cd82.jpeg)

````auto
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);  
}```
````

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [March 24, 2022, 10:57pm UTC](https://discourse.processing.org/t/copy-bug-pixel-bleeding-lower-half-of-the-screen/35917/2 "2022-03-24T22:57:17Z")

</div>

Hello @rroarrg,

Here is a related topic:

> [@A surprising glitch(?) in Processing Java](https://discourse.processing.org/t/a-surprising-glitch-in-processing-java/21204):
>
> Good morning all, So I had a simple idea. Make a ball rotate the center of canvas draw a rect over canvas with lots of opacity, so that image fades a bit every time copy a slightly smaller part of canvas and stretch it to fill whole canvas. It creates an effect that you are closing in. Here’s the p5.js program [p5.js Web Editor](https://editor.p5js.org/hartzaq/sketches/lEhw3akdY) I have used this copy screen & stretch method before and noticed it does something funny along x and y axis passing through origo or center of the screen. I thought i…

Try different renderers:

```auto
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); 
  }

```

> [@rroarrg](#):
>
> I’m trying to find a logic behind but it feels like it’s just a bug.

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

References:  
[https://processing.org/reference/size\_.html](https://processing.org/reference/size_.html)

`:)`
