[−][src]Static p5_sys::global::copy
pub static copy: CopyInternalType
Copies a region of the canvas to another region of the canvas and copies a region of pixels from an image used as the srcImg parameter into the canvas srcImage is specified this is used as the source. If the source and destination regions aren't the same size, it will automatically resize source pixels to fit the specified target region.
Examples
let img;
function preload() {
img = loadImage('assets/rockies.jpg');
}
function setup() {
background(img);
copy(img, 7, 22, 10, 10, 35, 25, 50, 50);
stroke(255);
noFill();
// Rectangle shows area being copied
rect(7, 22, 10, 10);
}
Overloads
srcImage
source image
sx
X coordinate of the source's upper left corner
sy
Y coordinate of the source's upper left corner
sw
source image width
sh
source image height
dx
X coordinate of the destination's upper left corner
dy
Y coordinate of the destination's upper left corner
dw
destination image width
dh
destination image height
sx
X coordinate of the source's upper left corner
sy
Y coordinate of the source's upper left corner
sw
source image width
sh
source image height
dx
X coordinate of the destination's upper left corner
dy
Y coordinate of the destination's upper left corner
dw
destination image width
dh
destination image height