public void Mix(CImage image, Rectangle rect, int count) {
		count = count % 8;
		if (count < 0) {
			count = count + 8;
		}
		Rectangle rect2 = (Rectangle)rect.clone();
		if (rect2.x < 0)
			rect2.x = 0;
		if (rect2.x + rect2.width > image.Width())
			rect2.width = image.Width() - rect2.x;
		if (rect2.x + rect2.width > this.Width())
			rect2.width = this.Width() - rect2.x;
		int[] pixels = new int[rect2.width * rect2.height];
		_bmd.getRGB(rect2.x, rect2.y, rect2.width, rect2.height, pixels, 0, rect2.width);
		int[] img_pixels = new int[rect2.width * rect2.height];
		image._bmd.getRGB(rect2.x, rect2.y, rect2.width, rect2.height, img_pixels, 0, rect2.width);
		int[] pixels2 = new int[rect2.width * rect2.height];
		int w = rect2.width;
		int pixels_position = 0;
		int img_pixels_position = 0;
		int pixels2_position = 0;
		for (int y = 0; pixels_position < pixels.length; y++) {
			for (int x = 0; x < w; x++) {
				int mask = (int)(BitMask[count]) & (int)(YMask[y & 3]);
				int p = pixels[pixels_position++];
				int p2 = img_pixels[img_pixels_position++];	
				if ((p2 & 0xFF000000) == 0) {
					pixels2[pixels2_position++] = p;
				} else if ((mask & XMask[x & 3]) != 0) {
					pixels2[pixels2_position++] = p2;
				} else {
					pixels2[pixels2_position++] = p;
				}
			}
		}
		_bmd.setRGB(rect.x, rect.y, rect.width, rect.height, pixels2, 0, rect.width);
	}