Tabnine Logo
SubsamplingScaleImageView.setScaleAndCenter
Code IndexAdd Tabnine to your IDE (free)

How to use
setScaleAndCenter
method
in
com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView

Best Java code snippets using com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView.setScaleAndCenter (Showing top 5 results out of 315)

origin: Piasy/BigImageViewer

mImageView.setScaleAndCenter(maxScale, new PointF(imageWidth / 2, imageHeight / 2));
origin: davemorrissey/subsampling-scale-image-view

  view.setScaleAndCenter(0f, new PointF(3900, 3120));
  view.setPanEnabled(false);
} else {
  view.setScaleAndCenter(1f, new PointF(3900, 3120));
  view.setZoomEnabled(false);
} else {
origin: davemorrissey/subsampling-scale-image-view

/**
 * Double tap zoom handler triggered from gesture detector or on touch, depending on whether
 * quick scale is enabled.
 */
private void doubleTapZoom(PointF sCenter, PointF vFocus) {
  if (!panEnabled) {
    if (sRequestedCenter != null) {
      // With a center specified from code, zoom around that point.
      sCenter.x = sRequestedCenter.x;
      sCenter.y = sRequestedCenter.y;
    } else {
      // With no requested center, scale around the image center.
      sCenter.x = sWidth()/2;
      sCenter.y = sHeight()/2;
    }
  }
  float doubleTapZoomScale = Math.min(maxScale, SubsamplingScaleImageView.this.doubleTapZoomScale);
  boolean zoomIn = (scale <= doubleTapZoomScale * 0.9) || scale == minScale;
  float targetScale = zoomIn ? doubleTapZoomScale : minScale();
  if (doubleTapZoomStyle == ZOOM_FOCUS_CENTER_IMMEDIATE) {
    setScaleAndCenter(targetScale, sCenter);
  } else if (doubleTapZoomStyle == ZOOM_FOCUS_CENTER || !zoomIn || !panEnabled) {
    new AnimationBuilder(targetScale, sCenter).withInterruptible(false).withDuration(doubleTapZoomDuration).withOrigin(ORIGIN_DOUBLE_TAP_ZOOM).start();
  } else if (doubleTapZoomStyle == ZOOM_FOCUS_FIXED) {
    new AnimationBuilder(targetScale, sCenter, vFocus).withInterruptible(false).withDuration(doubleTapZoomDuration).withOrigin(ORIGIN_DOUBLE_TAP_ZOOM).start();
  }
  invalidate();
}
origin: kollerlukas/Camera-Roll-Android-App

  @Override
  public void onImageLoaded() {
    super.onImageLoaded();
    float scale = imageView.getScale();
    PointF center = new PointF(imageView.getWidth() / 2, 0.0f);
    imageView.setScaleAndCenter(scale, center);
  }
});
origin: mozilla-tw/Rocket

/**
 * Double tap zoom handler triggered from gesture detector or on touch, depending on whether
 * quick scale is enabled.
 */
private void doubleTapZoom(PointF sCenter, PointF vFocus) {
  if (!panEnabled) {
    if (sRequestedCenter != null) {
      // With a center specified from code, zoom around that point.
      sCenter.x = sRequestedCenter.x;
      sCenter.y = sRequestedCenter.y;
    } else {
      // With no requested center, scale around the image center.
      sCenter.x = sWidth()/2;
      sCenter.y = sHeight()/2;
    }
  }
  float doubleTapZoomScale = Math.min(maxScale, SubsamplingScaleImageView.this.doubleTapZoomScale);
  boolean zoomIn = scale <= doubleTapZoomScale * 0.9;
  float targetScale = zoomIn ? doubleTapZoomScale : minScale();
  if (doubleTapZoomStyle == ZOOM_FOCUS_CENTER_IMMEDIATE) {
    setScaleAndCenter(targetScale, sCenter);
  } else if (doubleTapZoomStyle == ZOOM_FOCUS_CENTER || !zoomIn || !panEnabled) {
    new AnimationBuilder(targetScale, sCenter).withInterruptible(false).withDuration(doubleTapZoomDuration).withOrigin(ORIGIN_DOUBLE_TAP_ZOOM).start();
  } else if (doubleTapZoomStyle == ZOOM_FOCUS_FIXED) {
    new AnimationBuilder(targetScale, sCenter, vFocus).withInterruptible(false).withDuration(doubleTapZoomDuration).withOrigin(ORIGIN_DOUBLE_TAP_ZOOM).start();
  }
  invalidate();
}
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewsetScaleAndCenter

Javadoc

Externally change the scale and translation of the source image. This may be used with getCenter() and getScale() to restore the scale and zoom after a screen rotate.

Popular methods of SubsamplingScaleImageView

  • setImage
    Set the image source from a bitmap, resource, asset, file or other URI, starting with a given orient
  • setDoubleTapZoomScale
    Set the scale the image will zoom in to when double tapped. This also the scale point where a double
  • setMaxScale
    Set the maximum scale allowed. A value of 1 means 1:1 pixels at maximum scale. You may wish to set t
  • setMinimumDpi
    This is a screen density aware alternative to #setMaxScale(float); it allows you to express the maxi
  • getWidth
  • setDoubleTapZoomDpi
    A density aware alternative to #setDoubleTapZoomScale(float); this allows you to express the scale t
  • setMinimumScaleType
    Set the minimum scale type. See static fields. Normally #SCALE_TYPE_CENTER_INSIDE is best, for image
  • setMinimumTileDpi
    By default, image tiles are at least as high resolution as the screen. For a retina screen this may
  • setPanEnabled
    Enable or disable pan gesture detection. Disabling pan causes the image to be centered.
  • setZoomEnabled
    Enable or disable zoom gesture detection. Disabling zoom locks the the current scale.
  • <init>
  • getCenter
    Returns the source point at the center of the view.
  • <init>,
  • getCenter,
  • getContext,
  • getHeight,
  • getOrientation,
  • getScale,
  • isReady,
  • onDraw,
  • onImageLoaded

Popular in Java

  • Running tasks concurrently on multiple threads
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • ImageIO (javax.imageio)
  • Reference (javax.naming)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now