Education/Projects/ProcessingForTheWeb/PImage.copy

From MozillaWiki
Jump to: navigation, search

Summary

This is a method of the PImage class written for Education/Projects/ProcessingForTheWeb. GCopies a region of pixels from one image into another. View official Reference

Examples


void setup() 
{      
      size(250,200);
      background(0);
}
PImage pimg = new PImage(loadImage("fish.jpg"));
pimg.copy(0,0,65,92,78,0,65,92);
image(pimg,0,0);
void draw() 
{ 
      image(pimg,0,0);
}



PImageCopy.jpg

Syntax

Description
img.copy(sx, sy, swidth, sheight, dx, dy, dwidth, dheight); copies pixels in the same image from destination(d) to source(s)
img.copy(srcImg, sx, sy, swidth, sheight, dx, dy, dwidth, dheight); copies pixels in the same image from destination(d) to source(s)

the source pixels come from srcImg

Parameters

Description
img PImage
sx x coordinate of the source's upper left corner
sy y-coordinate of the source's upper left corner
swidth source image width
sheight source image height
dx x coordinate of the destination's upper left corner
dy y-coordinate of the destination's upper left corner
dwidth destination image width
dheight destination image height
srcImg PImage referring to the source image

Returns

none

Bugs

Refer to the reference of each function for a specific bug report.

Bug Description Fixed?(Date)

Tests

Test Location
copy() copy()
copy() with srcPImage copy()