title: Java Swing BufferedImage poor quality
body: <p>I'm trying to create a drawing on BufferedImage and then copy in onto JPanel.
  When I draw directly on JPanel quality of the picture is v.good but when using intermediate BufferedImage quality / resolution is visibly reduced.
  I've checked that with zoom option from OSX's Accessibility panel.
  I'm developing on MacBook Pro Retina.</p>
  
  <p>Is there some sort of automated scaling happening?
  What am I doing wrong with BufferedImage?</p>
  
  <p>Here's the code demonstrating the problem</p>
  
  <pre><code>package com.sample.gui;
  
  import java.awt.BorderLayout;
  import java.awt.Color;
  import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.Graphics2D;
  import java.awt.RenderingHints;
  import java.awt.geom.Ellipse2D;
  import java.awt.image.BufferedImage;
  
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  
  public class QualityProblem {
  
  private static final double DOT_SIZE = 4;
  
  public static void main(String[] args) {
      JFrame frame = new JFrame("ChartPanel demo");
      frame.setBackground(Color.WHITE);
  
      // JPanel draw = new DrawingOK();
      JPanel draw = new DrawingUgly();
      draw.setBackground(Color.BLACK);
  
      frame.getContentPane().add(draw, BorderLayout.CENTER);
      frame.setSize(new Dimension(1200, 900));
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  
      frame.setVisible(true);
  }
  
  private static class DrawingOK extends JPanel {
  
      private static final long serialVersionUID = 1L;
  
      @Override
      protected void paintComponent(Graphics g) {
          super.paintComponent(g);
  
          Graphics2D g2draw = (Graphics2D) g.create();
          try {
              g2draw.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
              g2draw.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
              g2draw.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
  
              Ellipse2D.Double e = new Ellipse2D.Double(50, 50, DOT_SIZE, DOT_SIZE);
              g2draw.setColor(Color.YELLOW);
              g2draw.fill(e);
          } finally {
              g2draw.dispose();
          }
      }
  }
  
  private static class DrawingUgly extends JPanel {
  
      private static final long serialVersionUID = 1L;
  
      @Override
      protected void paintComponent(Graphics g) {
          super.paintComponent(g);
  
          Dimension size = getParent().getSize();
          BufferedImage image = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
  
          Graphics2D ig = image.createGraphics();
          ig.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
          ig.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
          ig.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
  
          Graphics2D g2draw = (Graphics2D) g.create();
          try {
              Ellipse2D.Double e = new Ellipse2D.Double(50, 50, DOT_SIZE, DOT_SIZE);
              ig.setColor(Color.YELLOW);
              ig.fill(e);
              g2draw.drawImage(image, 0, 0, null);
          } finally {
              ig.dispose();
              g2draw.dispose();
          }
      }
  }
  }
  </code></pre>
  
  <p>Edited:
  Added images with 4 pixel dot and 50D both zoomed in.
  Ugly one comes from BufferedImage copied onto screen's Graphics
  <img src="https://i.stack.imgur.com/L94vX.png" alt="Small 4pixel dot">
  <img src="https://i.stack.imgur.com/CRSGE.png" alt="Big balls"></p>