title: How to draw a sector of a BufferedImage?
body: <p>I'm making a game with a mouse cursor, and I'd like to represent the health by overlaying the cursor with a green version of the image, but only a geometric sector of it corresponding to the health percentage. Solutions from posts like these: <a href="https://stackoverflow.com/questions/15167276/drawing-slices-of-a-circle-in-java">Drawing slices of a circle in java?</a> &amp; <a href="https://stackoverflow.com/questions/19170714/how-to-draw-portions-of-circles-based-on-percentages-in-graphics2d">How to draw portions of circles based on percentages in Graphics2D?</a> are pretty much what I want to do, but with a BufferedImage as opposed to a solid color fill.</p>
  
  <pre><code>    //Unfortunately all this does is cause nothing to draw, but commenting this out allows the overlay image to draw
      Arc2D.Double clip = new Arc2D.Double(Arc2D.PIE);
      double healthAngle = Math.toRadians((((Double)data.get("health")).doubleValue() * 360.0 / 100.0) - 270.0);
      clip.setAngles(0, -1, Math.cos(healthAngle), Math.sin(healthAngle));
      System.out.println(Math.cos(healthAngle) + " " + Math.sin(healthAngle));
      g.setClip(clip);
  </code></pre>
  
  <p>In short, how do I draw a sector of a BufferedImage given any angle?</p>