This reference is for Processing 2.0+. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

copy()

Examples
example pic
PImage img = loadImage("eames.jpg");
image(img, 0, 0, width, height);
copy(7, 22, 10, 10, 35, 25, 50, 50);
stroke(255);
noFill();
// Rectangle shows area being copied
rect(7, 22, 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.

As of release 0149, this function ignores imageMode().
Syntax
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 corner
sy int: Y coordinate of the source's upper left corner
sw int: source image width
sh 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
dw int: destination image width
dh int: destination image height
src PImage: an image variable referring to the source image.
Returnsvoid
Relatedalpha()
blend()
Updated on May 19, 2014 05:30:02pm PDT

Creative Commons License