copy()

Image / Pixels

Description

Copies a region of the display window to another location on the display window.

Syntax

void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)

Parameters

NameTypeDescription
sxintx-coordinate of source
syinty-coordinate of source
swintsource width
shintsource height
dxintx-coordinate of destination
dyinty-coordinate of destination
dwintdestination width
dhintdestination height

Returns

void

Related

Under the Hood

From Processing.h:

PVector copy() const { return PVector(x, y, z); } PColor copy() const { return PColor(r, g, b, a); } void copy(const PImage& src, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh) { for (int iy=0; iy<dh; iy++) for (int ix=0; ix<dw; ix++) { int srcX = sx+(int)(ix*(float)sw/dw); int srcY = sy+(int)(iy*(float)sh/dh); set(dx+ix, dy+iy, src.get(srcX, srcY)); } dirty = true; } IntList copy() const { IntList r; r.data = data; return r; } FloatList copy() const { FloatList r; r.data = data; return r; } StringList copy() const { StringList r; r.data = data; return r; } void copy(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);

Under the Hood

From Processing.cpp:

void PApplet::copy(int sx,int sy,int sw,int sh,int dx,int dy,int dw,int dh){ blend(sx,sy,sw,sh,dx,dy,dw,dh,BLEND); }