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)
| 820 | * use the fastest possible pixel copying method. |
| 821 | */ |
| 822 | protected void getImpl(int sourceX, int sourceY, |
| 823 | int sourceWidth, int sourceHeight, |
| 824 | PImage target, int targetX, int targetY) { |
| 825 | int sourceIndex = sourceY*pixelWidth + sourceX; |
| 826 | int targetIndex = targetY*target.pixelWidth + targetX; |
| 827 | for (int row = 0; row < sourceHeight; row++) { |
| 828 | System.arraycopy(pixels, sourceIndex, target.pixels, targetIndex, sourceWidth); |
| 829 | sourceIndex += pixelWidth; |
| 830 | targetIndex += target.pixelWidth; |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | |
| 835 | /** |