code: public AffineTransform getImageTransform() {
  		if (getImage()==null) throw new IllegalStateException("No image");
  		if (!hasSize()) throw new IllegalStateException("Viewer size is zero");
  		double currentZoom;
  		switch (resizeStrategy) {
  			case NO_RESIZE:
  				currentZoom=1;
  				break;
  			case SHRINK_TO_FIT:
  				currentZoom = Math.min(getSizeRatio(), 1);
  				break;
  			case RESIZE_TO_FIT:
  				currentZoom = getSizeRatio();
  				break;
  			case CUSTOM_ZOOM:
  				currentZoom = zoomFactor;
  				break;
  			default:
  				throw new Error("Unhandled resize strategy");
  		}
  		AffineTransform tr=new AffineTransform();
  		tr.setToTranslation((getWidth()-image.getWidth()*currentZoom)/2.0, (getHeight()-image.getHeight()*currentZoom)/2.0);
  		tr.scale(currentZoom, currentZoom);
  		return tr;
  	}
docs: Returns the transformation that is applied to the image. Most commonly the transformation
  is the concatenation of a uniform scale and a translation.
  <p>
  The <code>AffineTransform</code>
  instance returned by this method should not be modified.
  @return the transformation applied to the image before painting
  @throws IllegalStateException if there is no image set or if the size of the viewer is 0 (for example because
  it is not in a visible component)