if (srcY < dstY) { final int diff = dstY - srcY; if (diff >= srcH) { return; } srcOffset += srcScansize * diff; srcY += diff; srcH -= diff;
for(int yp = y; yp < (y + h); yp++) { for(int xp = x; xp < (x + w); xp++) {   if(xp >= this.x && yp >= this.y && xp < (this.x + this.width) && yp < (this.y + this.height)) { int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset; int p = (yp - y) * scansize + (xp - x) + offset; if (forceRGB) { ints_delivered = true;  int_pixel_buffer[i] = currentModel.getRGB (pixels[p]); } else { bytes_delivered = true;  byte_pixel_buffer[i] = pixels[p];
	public void setPixels(int srcX, int srcY, int srcW, int srcH, ColorModel model, byte[] pixels, int srcOffset, int srcScansize) {		if (srcY < dstY) {			final int diff = dstY - srcY;			if (diff >= srcH) {				return;			}			srcOffset += srcScansize * diff;			srcY += diff;			srcH -= diff;		}		if (srcY + srcH > dstY + dstHeight) {			srcH = (dstY + dstHeight) - srcY;			if (srcH <= 0) {				return;			}		}		if (srcX < dstX) {			final int diff = dstX - srcX;			if (diff >= srcW) {				return;			}			srcOffset += diff;			srcX += diff;			srcW -= diff;		}		if (srcX + srcW > dstX + dstWidth) {			srcW = (dstX + dstWidth) - srcX;			if (srcW <= 0) {				return;			}		}		if (intPixels == null) {			intPixels = new int[dstWidth * dstHeight];			dstScansize = dstWidth;		}		int dstPtr = dstOffset + (srcY - dstY) * dstScansize + (srcX - dstX);		final int dstRem = dstScansize - srcW;		final int srcRem = srcScansize - srcW;		int lastARGB = -1;		int lastPixel = -1;		for (int h = srcH; h > 0; h--) {			for (int w = srcW; w > 0; w--) {				final int pixel = pixels[srcOffset++];				if ((pixel != lastPixel) || (lastARGB == -1)) {					lastARGB = model.getRGB(pixel);					lastPixel = pixel;				}				intPixels[dstPtr++] = lastARGB;			}			srcOffset += srcRem;			dstPtr += dstRem;		}	}