public void invert(CPRect r) {
		CPRect rect = new CPRect(0, 0, width, height);
		rect.clip(r);

		for (int j = rect.top; j < rect.bottom; j++) {
			for (int i = rect.left; i < rect.right; i++) {
				data[i + j * width] ^= 0xffffff;
			}
		}
	}