How to make clone stamp tool as the photoshop?

please format code with </> button * homework policy * asking questions

The idea is with mouse pointer(as photoshop) clone pixel or pixels from the PImage1 to PImage2,please!!

From left to right. If you want a round stamp you need to use a mask.

PImage pi_1, pi_2, pi_3;
int stamp_width = 30;
int stamp_height = 30;
int transparency = 15;

void setup() {
  String url = "https://i.pinimg.com/236x/d9/63/aa/d963aa82a6b11b236543d0a3a0842e50.jpg";
  pi_1 = loadImage(url, "png");
  pi_2 = pi_1;
  size(800, 400);
  background(255);
  pi_1.resize(400, 400);
  pi_1.resize(400, 400);
  image(pi_1, 0, 0);
  image(pi_2, 400, 0);
  
}

void draw() {
  if(mouseX > 440 && mousePressed) {
    image(pi_3, mouseX-stamp_width/2, mouseY-stamp_height/2);
    tint(255, transparency);
  }
}

void mousePressed () {
  if(mouseX < 360) pi_3 = get(mouseX-stamp_width/2, mouseY-stamp_height/2, stamp_width, stamp_height);
}