public void zoomIn() {
    Dimension asz = this.getSize();
    int maxzf = 3;
    int coef = 1;
    int r;

    cmdline =
        "/bin/sh get.sh "
            + j2kfilename
            + " "
            + iw
            + " "
            + ih
            + " "
            + rect.x
            + " "
            + rect.y
            + " "
            + rect.width
            + " "
            + rect.height;
    Exec.execPrint(cmdline);

    rect.x = rect.y = rect.width = rect.height = 0;

    img = pgm.open("out.pgm");

    iw = img.getWidth(this);
    ih = img.getHeight(this);
    bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
    big = bi.createGraphics();
    selected = 0;
    fullRefresh = true;
    repaint();
  }
 private void scaleImage() {
   Image img =
       back.getScaledInstance(scx(back.getWidth()), scy(back.getHeight()), Image.SCALE_SMOOTH);
   back =
       new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
   Graphics g = back.getGraphics();
   g.drawImage(img, 0, 0, null);
   g.dispose();
 }
  public void init() {
    String str;
    int port;

    imgId = 4;
    if (isApplet && (((hostname = this.getParameter("hostname")) == null) || hostname.equals("")))
      hostname = "localhost";
    if (!isApplet || ((str = this.getParameter("cmdPort")) == null)) {
      port = 3000;
    } else {
      port = new Integer(str).intValue();
    }

    this.setSize(512, 512);
    Dimension asz = this.getSize();
    zl.x2 = asz.width;
    zl.y2 = asz.height;

    cmdline =
        "/bin/sh get.sh "
            + j2kfilename
            + " "
            + asz.width
            + " "
            + asz.height
            + " "
            + zl.x1
            + " "
            + zl.y1
            + " "
            + zl.x2
            + " "
            + zl.y2;
    Exec.execPrint(cmdline);
    img = pgm.open("out.pgm");

    iw = img.getWidth(this);
    ih = img.getHeight(this);

    setBackground(Color.black);
    bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB);
    big = bi.createGraphics();
    myMML = new MML(this);
    addMouseListener(myMML);
    addMouseMotionListener(myMML);
  }
示例#4
0
 public void setImage(Image img, int gsize) {
   pieceSize = gsize;
   image = img.getScaledInstance(pieceSize, pieceSize, Image.SCALE_SMOOTH);
   this.setSize(pieceSize, pieceSize);
   this.setIcon(new ImageIcon(image));
 }