protected void setImpl(int dx, int dy, int sx, int sy, int sw, int sh, PImage src) { WritableRaster raster = ((BufferedImage) (primarySurface ? offscreen : image)).getRaster(); if ((sx == 0) && (sy == 0) && (sw == src.width) && (sh == src.height)) { raster.setDataElements(dx, dy, src.width, src.height, src.pixels); } else { // TODO Optimize, incredibly inefficient to reallocate this much memory PImage temp = src.get(sx, sy, sw, sh); raster.setDataElements(dx, dy, temp.width, temp.height, temp.pixels); } }