예제 #1
0
  // --参数计算---------------------------------------------------------------
  public void resetZoomState(ImageZoomView view, Bitmap bitmap) {
    mView = view;
    mBitmap = bitmap;
    mAspectQuotient = -1;

    do {
      if (null == mView || null == mBitmap) {
        break;
      }

      if (mView.getHeight() <= 0
          || mView.getWidth() <= 0
          || mBitmap.getHeight() <= 0
          || mBitmap.getWidth() <= 0) {
        break;
      }

      mAspectQuotient =
          (((float) mBitmap.getWidth()) / mBitmap.getHeight())
              / (((float) mView.getWidth()) / mView.getHeight());

      logd("mAspectQuotient = " + mAspectQuotient);
      calculateMinMaxZoom();
      calculateMinMaxPanX();
      calculateMinMaxPanY();

      // 初始化OK,通知外部,显示小图标
      setZoomChanged();
      notifyObservers();
    } while (false);
  }
예제 #2
0
 public void setZoom(float zoom) {
   zoom = adjustZoom(zoom);
   if (!floatEquel(zoom, mZoom)) {
     mZoom = zoom;
     logd("----> mZoom = " + mZoom);
     calculateMinMaxPanX();
     calculateMinMaxPanY();
     setZoomChanged();
   }
 }