MCPcopy Index your code
hub / github.com/benfry/processing4 / getImpl

Method getImpl

core/src/processing/core/PImage.java:671–681  ·  view source on GitHub ↗

Internal function to actually handle getting a block of pixels that has already been properly cropped to a valid region. That is, x/y/w/h are guaranteed to be inside the image space, so the implementation can use the fastest possible pixel copying method.

(int sourceX, int sourceY,
                         int sourceWidth, int sourceHeight,
                         PImage target, int targetX, int targetY)

Source from the content-addressed store, hash-verified

669 * use the fastest possible pixel copying method.
670 */
671 protected void getImpl(int sourceX, int sourceY,
672 int sourceWidth, int sourceHeight,
673 PImage target, int targetX, int targetY) {
674 int sourceIndex = sourceY*pixelWidth + sourceX;
675 int targetIndex = targetY*target.pixelWidth + targetX;
676 for (int row = 0; row < sourceHeight; row++) {
677 System.arraycopy(pixels, sourceIndex, target.pixels, targetIndex, sourceWidth);
678 sourceIndex += pixelWidth;
679 targetIndex += target.pixelWidth;
680 }
681 }
682
683
684 /**

Callers 1

getMethod · 0.95

Calls 1

arraycopyMethod · 0.80

Tested by

no test coverage detected