System.out.println("Magnification is "+magnification); System.out.println("Parent is "+viewportSize.width+" by "+viewportSize.height+"; Image is "+imageWidth+" by "+imageHeight);
	public ImageCanvas(ImagePlus imp) {		this.imp = imp;		ij = IJ.getInstance();		int width = imp.getWidth();		int height = imp.getHeight();		imageWidth = width;		imageHeight = height;		srcRect = new Rectangle(0, 0, imageWidth, imageHeight); 		addMouseListener(this); 		addMouseMotionListener(this); 		addKeyListener(ij);  // ImageJ handles keyboard shortcuts		Dimension viewportSize = ij.getViewportSize();		//magnification = 1.0;		magnification = Math.min(1.0, Math.min((float)viewportSize.width / (float)imageWidth, (float)(viewportSize.height - 20) / (float)imageHeight));		System.out.println("Magnification is "+magnification);		System.out.println("Parent is "+viewportSize.width+" by "+viewportSize.height+"; Image is "+imageWidth+" by "+imageHeight);		if (Prefs.blackCanvas && getClass().getName().equals("ij.gui.ImagePanel")) {			setForeground(Color.white);			setBackground(Color.black);		} else {        	setForeground(Color.black);        	setBackground(Color.white);        }		addKeyListener(ij);	}