public static void drawImageZb(Graphics2D g, double[][] zb, Image image,
			int x, int y, double z, int w, int h) {

		BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
		Graphics2D g2 = bi.createGraphics();
		g2.drawImage(image, 0, 0, w, h, null);
		g2.dispose();

		int[] biDataBuffer = ((DataBufferInt) bi.getRaster().getDataBuffer())
				.getData();

		try {
			for (int i = 0; i < w; i++)
				for (int j = 0; j < h; j++) {

					int windowPixelX = x + i;
					int windowPixelY = y + j;
					int pixelNum = i + j * w;

					if (checkCollisionBB(windowPixelX, windowPixelY, 0, 0, 1,
							1, Game.WIDTH, Game.HEIGHT)
							&& (z > zb[windowPixelX][windowPixelY] || (z == -Double.MAX_VALUE && zb[windowPixelX][windowPixelY] == -Double.MAX_VALUE))
							&& (biDataBuffer[pixelNum] & 0xff000000) != 0)

						zb[windowPixelX][windowPixelY] = z;
					else
						biDataBuffer[pixelNum] = 0;

				}
			g.drawImage(bi, x, y, null);
		} catch (ArrayIndexOutOfBoundsException | IllegalArgumentException e) {
			e.printStackTrace();
		}

	}