private void oilResatBuffer(CPRect srcRect, CPRect dstRect, int[] buffer, int w, int alpha1, int color1) {
			if (alpha1 <= 0) {
				return;
			}

			int by = srcRect.top;
			for (int j = dstRect.top; j < dstRect.bottom; j++, by++) {
				int srcOffset = srcRect.left + by * w;
				int dstOffset = dstRect.left + j * width;
				for (int i = dstRect.left; i < dstRect.right; i++, srcOffset++, dstOffset++) {
					int color2 = buffer[srcOffset];
					int alpha2 = (color2 >>> 24);

					int newAlpha = alpha1 + alpha2 - alpha1 * alpha2 / 255;
					if (newAlpha > 0) {
						int realAlpha = alpha1 * 255 / newAlpha;
						int invAlpha = 255 - realAlpha;

						int newColor = newAlpha << 24
								| ((color1 >>> 16 & 0xff) + (((color2 >>> 16 & 0xff) * invAlpha - (color1 >>> 16 & 0xff)
										* invAlpha) / 255)) << 16
								| ((color1 >>> 8 & 0xff) + (((color2 >>> 8 & 0xff) * invAlpha - (color1 >>> 8 & 0xff)
										* invAlpha) / 255)) << 8
								| ((color1 & 0xff) + (((color2 & 0xff) * invAlpha - (color1 & 0xff) * invAlpha) / 255));

						buffer[srcOffset] = newColor;
					}
				}
			}
		}