Reference+
Name
copy()
Description
Copies a region of pixels from one image into another. If the source and
destination regions aren't the same size, it will automatically resize
source pixels to fit the specified target region. No alpha information
is used in the process, however if the source image has an alpha channel
set, it will be copied as well.
As of release 0149, this function ignores imageMode().
Examples
size(400,400); PImage img = loadImage("hometown.jpg"); image(img, 0, 0, width, height); copy(56, 176, 80, 80, 280, 200, 400, 400); stroke(255); noFill(); // Rectangle shows area being copied rect(56, 176, 80, 80);
Syntax
copy()
copy(sx, sy, sw, sh, dx, dy, dw, dh)
copy(src, sx, sy, sw, sh, dx, dy, dw, dh)
Parameters
sx
(int)
X coordinate of the source's upper left cornersy
(int)
Y coordinate of the source's upper left cornersw
(int)
source image widthsh
(int)
source image heightdx
(int)
X coordinate of the destination's upper left cornerdy
(int)
Y coordinate of the destination's upper left cornerdw
(int)
destination image widthdh
(int)
destination image heightsrc
(PImage)
an image variable referring to the source image.
Return
void or PImage
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.