if (dim == null) dim = new Dimension(w, h);
dx = (double)dim.width / (double)w;
dy = (double)dim.height / (double)h;
d = Math.min(dx, dy);
g2d.scale(d, d);
g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, m_interpolation);
Rectangle rect = g2d.getClipBounds();
if (rect != null)
g2d.drawImage(m_img, (int)rect.getX(), (int)rect.getY(), (int)(rect.getX() + rect.getWidth()), (int)(rect.getY() + rect.getHeight()), (int)rect.getX(), (int)rect.getY(), (int)(rect.getX() + rect.getWidth()), (int)(rect.getY() + rect.getHeight()), this);
}