 |
 |
 |
 |
Name |
|
copy() |
 |
|
|
Examples |
|
 |
PImage img = loadImage("eames.jpg");
image(img, 0, 0);
copy(15, 25, 10, 10, 35, 25, 50, 50);
noFill();
// Rectangle shows area being copied
rect(15, 25, 10, 10);
|
 |
|
Description |
|
Copies a region of pixels from the display window to another area of the display window and copies a region of pixels from an image used as the srcImg parameter into the display window. If the source and destination regions aren't the same size, it will automatically resize the 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.
The imageMode() function changes the way the parameters work. For example, a call to imageMode(CORNERS) will change the width and height parameters to define the x and y values of the opposite corner of the image. |
 |
|
|
Syntax |
|
copy(sx, sy, swidth, sheight, dx, dy, dwidth, dheight)
copy(srcImg, sx, sy, swidth, sheight, dx, dy, dwidth, dheight)
|
 |
|
|
Parameters |
|
sx |
|
int: X coordinate of the source's upper left corner
|
sy |
|
int: Y coordinate of the source's upper left corner
|
swidth |
|
int: source image width
|
sheight |
|
int: source image height
|
dx |
|
int: X coordinate of the destination's upper left corner
|
dy |
|
int: Y coordinate of the destination's upper left corner
|
dwidth |
|
int: destination image width
|
dheight |
|
int: destination image height
|
srcImg |
|
PImage: image variable referring to the source image
|
|
 |
|
|
Returns |
|
None |
 |
|
|
Usage |
|
Web & Application |
 |
|
|
Related |
|
imageMode() blend() get() |
|
|