title: Drawing an out fading transparent oval
body: <p>I'm trying to draw an out fading transparent oval to highlight a tile on a tiled screen. Unfortunately I wasn't able to find an implemented feature in <code>Swing</code> that can do that, so I wrote my own:</p>
  
  <pre><code>private void drawGradientedOval(Graphics2D g2d, Rectangle bounds) {
  
      g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
  
      int loops = (int) Math.min(bounds.getWidth() / 2, bounds.getHeight() / 2);
      int x = bounds.x + (int) (bounds.getWidth() / 2);
      int y = bounds.y + (int) (bounds.getHeight() / 2);
      int scale = 1;
      float alpha = 0.5f;
      float step = alpha / loops;
  
      for (int i = 0; i &lt; loops; i++) {
          g2d.setColor(new Color(1f, 1f, 1f, alpha));
          g2d.drawOval(x--, y--, scale, scale);
          scale += 2;
          alpha -= step;
      }
  
  }
  </code></pre>
  
  <p>The resulting oval looks like(the crop is larger than the oval bounds): </p>
  
  <p><a href="https://i.stack.imgur.com/VZ9MI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VZ9MI.png" alt="enter image description here"></a></p>
  
  <p>The result is not a smooth oval, there is a "cross" and some other small artifacts.</p>
  
  <p>I assume this is caused by "overlapping" pixels that are drawn on top of each other.</p>
  
  <p><strong>Is there an intelligent way of fixing this?</strong></p>
  
  <p>Please note that I rather avoid implementing a lower level solution like manipulating individual pixels on a <code>Raster</code> level simply because the effort involves a huge amount of variables not mentioned above.</p>