// Program 12.7 Broken Magnify Image
import java.applet.Applet;
import java.awt.Image;
import java.awt.Graphics;


public class BrokenMagnifyImage extends Applet {

  Image theImage;
  int scaleWidth, scaleHeight;

  public void init() {
  
    String filename=getParameter("imagefile");
    theImage = getImage(getDocumentBase(), filename);
    int scalefactor = Integer.valueOf( 
      getParameter( "scalefactor" )).intValue();
    int x = theImage.getWidth(this);
    int y = theImage.getHeight(this);
    scaleWidth =  x * scalefactor;
    scaleHeight =  y * scalefactor;  
    
  }
  
  public void paint (Graphics g) {

    g.drawImage(theImage, 0, 0, scaleWidth, scaleHeight, this);

  }

}
