copy()
Image / PixelsDescription
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
| Name | Type | Description |
|---|---|---|
| sx | int | x-coordinate of source |
| sy | int | y-coordinate of source |
| sw | int | source width |
| sh | int | source height |
| dx | int | x-coordinate of destination |
| dy | int | y-coordinate of destination |
| dw | int | destination width |
| dh | int | destination height |
Returns
voidRelated
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);
}