Reference for Processing version 1.5. 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.

Class | PImage

Name

### copy()

Examples

    PImage img = loadImage("tower.jpg");
    img.copy(50, 0, 50, 100, 0, 0, 50, 100);
    image(img, 0, 0);

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().

Syntax

    img.copy(sx, sy, swidth, sheight, dx, dy, dwidth, dheight);
    img.copy(srcImg, sx, sy, swidth,  sheight, dx, dy, dwidth, dheight);

Parameters

img | PImage: any variable of type PImage
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: a image variable referring to the source image.

Returns | None
Usage | Web & Application
Related | alpha() blend()

Updated on August 30, 2010 04:29:39pm EDT