Пример #1
0
  /**
   * Adjust the image scale.
   *
   * @param width to scale the image to.
   * @param height to scale the image to.
   */
  public void setImageSize(int width, int height) {
    DjVuImage image = getImageWait();
    final Dimension imageSize = image.getSize();
    final int owidth = imageSize.width;
    final int oheight = imageSize.height;

    if ((width != owidth) || (height != oheight)) {
      zoom = 0;
      image = image.getScaledInstance(width, height);

      if (image != null) {
        width = image.getBounds().width;
        height = image.getBounds().height;
        setImage(image);
      }

      scaleScrollPosition(owidth, oheight, width, height);
      recursiveRevalidate();
    }
  }