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

Method setImpl

core/src/processing/core/PImage.java:767–782  ·  view source on GitHub ↗

Internal function to actually handle setting a block of pixels that has already been properly cropped from the image to a valid region.

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

Source from the content-addressed store, hash-verified

765 * has already been properly cropped from the image to a valid region.
766 */
767 protected void setImpl(PImage sourceImage,
768 int sourceX, int sourceY,
769 int sourceWidth, int sourceHeight,
770 int targetX, int targetY) {
771 int sourceOffset = sourceY * sourceImage.pixelWidth + sourceX;
772 int targetOffset = targetY * pixelWidth + targetX;
773
774 for (int y = sourceY; y < sourceY + sourceHeight; y++) {
775 System.arraycopy(sourceImage.pixels, sourceOffset, pixels, targetOffset, sourceWidth);
776 sourceOffset += sourceImage.pixelWidth;
777 targetOffset += pixelWidth;
778 }
779
780 //updatePixelsImpl(targetX, targetY, sourceWidth, sourceHeight);
781 updatePixels(targetX, targetY, sourceWidth, sourceHeight);
782 }
783
784
785

Callers 1

setMethod · 0.95

Calls 2

updatePixelsMethod · 0.95
arraycopyMethod · 0.80

Tested by

no test coverage detected