public void renderAgentFromWorld(int i, BufferedImage world,
			BufferedImage target) {
		Graphics2D graphics = target.createGraphics();
		background(graphics, target.getWidth(), target.getHeight());

		int x = gridToPixel(lerp(aStats[i].x0, aStats[i].x,
				Math.min((float) m_moveCounter * 3, 1f)));
		int y = gridToPixel(lerp(aStats[i].y0, aStats[i].y,
				Math.min((float) m_moveCounter * 3, 1f)));
		int radius = (Constants.AGENT_RANGE * Constants.CELL_DISTANCE) / 2;

		graphics.drawImage(world, 0, 0, target.getWidth(), target.getHeight(),
				x - radius, y - radius, x + radius, y + radius, null);

		// draw the mask
		graphics.setColor(Color.BLACK);
		float adjustedCellDistance = (int) Math.round((float) target.getWidth()
				/ Constants.AGENT_RANGE);
		float gridDistance = Constants.AGENT_RANGE / 2;
		for (int a = 0; a < Constants.AGENT_RANGE; ++a) {
			for (int b = 0; b < Constants.AGENT_RANGE; ++b) {
				float distance = Math.abs(gridDistance - a)
						+ Math.abs(gridDistance - b);
				if (distance > gridDistance) {
					graphics.fillRect(a * (int) adjustedCellDistance, b
							* (int) adjustedCellDistance,
							(int) adjustedCellDistance,
							(int) adjustedCellDistance);
				}
			}
		}
	}