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

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

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

origin: davemorrissey/subsampling-scale-image-view

/**
 * Convert screen coordinate to source coordinate.
 * @param vxy view X/Y coordinate.
 * @return a coordinate representing the corresponding source coordinate.
 */
@Nullable
public final PointF viewToSourceCoord(PointF vxy) {
  return viewToSourceCoord(vxy.x, vxy.y, new PointF());
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Convert screen coordinate to source coordinate.
 * @param vx view X coordinate.
 * @param vy view Y coordinate.
 * @return a coordinate representing the corresponding source coordinate.
 */
@Nullable
public final PointF viewToSourceCoord(float vx, float vy) {
  return viewToSourceCoord(vx, vy, new PointF());
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Convert screen coordinate to source coordinate.
 * @param vxy view coordinates to convert.
 * @param sTarget target object for result. The same instance is also returned.
 * @return source coordinates. This is the same instance passed to the sTarget param.
 */
@Nullable
public final PointF viewToSourceCoord(PointF vxy, @NonNull PointF sTarget) {
  return viewToSourceCoord(vxy.x, vxy.y, sTarget);
}
origin: davemorrissey/subsampling-scale-image-view

  @Override
  public boolean onDoubleTap(MotionEvent e) {
    if (imageView.isReady()) {
      PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
      Toast.makeText(getApplicationContext(), "Double tap: " + ((int)sCoord.x) + ", " + ((int)sCoord.y), Toast.LENGTH_SHORT).show();
    } else {
      Toast.makeText(getApplicationContext(), "Double tap: Image not ready", Toast.LENGTH_SHORT).show();
    }
    return true;
  }
});
origin: davemorrissey/subsampling-scale-image-view

@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
  if (imageView.isReady()) {
    PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
    Toast.makeText(getApplicationContext(), "Single tap: " + ((int)sCoord.x) + ", " + ((int)sCoord.y), Toast.LENGTH_SHORT).show();
  } else {
    Toast.makeText(getApplicationContext(), "Single tap: Image not ready", Toast.LENGTH_SHORT).show();
  }
  return true;
}
@Override
origin: davemorrissey/subsampling-scale-image-view

@Override
public void onLongPress(MotionEvent e) {
  if (imageView.isReady()) {
    PointF sCoord = imageView.viewToSourceCoord(e.getX(), e.getY());
    Toast.makeText(getApplicationContext(), "Long press: " + ((int)sCoord.x) + ", " + ((int)sCoord.y), Toast.LENGTH_SHORT).show();
  } else {
    Toast.makeText(getApplicationContext(), "Long press: Image not ready", Toast.LENGTH_SHORT).show();
  }
}
@Override
origin: davemorrissey/subsampling-scale-image-view

/**
 * Returns the source point at the center of the view.
 * @return the source coordinates current at the center of the view.
 */
@Nullable
public final PointF getCenter() {
  int mX = getWidth()/2;
  int mY = getHeight()/2;
  return viewToSourceCoord(mX, mY);
}
origin: davemorrissey/subsampling-scale-image-view

  @Override
  public boolean onDoubleTap(MotionEvent e) {
    if (zoomEnabled && readySent && vTranslate != null) {
      // Hacky solution for #15 - after a double tap the GestureDetector gets in a state
      // where the next fling is ignored, so here we replace it with a new one.
      setGestureDetector(context);
      if (quickScaleEnabled) {
        // Store quick scale params. This will become either a double tap zoom or a
        // quick scale depending on whether the user swipes.
        vCenterStart = new PointF(e.getX(), e.getY());
        vTranslateStart = new PointF(vTranslate.x, vTranslate.y);
        scaleStart = scale;
        isQuickScaling = true;
        isZooming = true;
        quickScaleLastDistance = -1F;
        quickScaleSCenter = viewToSourceCoord(vCenterStart);
        quickScaleVStart = new PointF(e.getX(), e.getY());
        quickScaleVLastPoint = new PointF(quickScaleSCenter.x, quickScaleSCenter.y);
        quickScaleMoved = false;
        // We need to get events in onTouchEvent after this.
        return false;
      } else {
        // Start double tap zoom animation.
        doubleTapZoom(viewToSourceCoord(new PointF(e.getX(), e.getY())), new PointF(e.getX(), e.getY()));
        return true;
      }
    }
    return super.onDoubleTapEvent(e);
  }
});
origin: mozilla-tw/Rocket

/**
 * Convert screen coordinate to source coordinate.
 */
public final PointF viewToSourceCoord(PointF vxy, PointF sTarget) {
  return viewToSourceCoord(vxy.x, vxy.y, sTarget);
}
origin: mozilla-tw/Rocket

/**
 * Convert screen coordinate to source coordinate.
 */
public final PointF viewToSourceCoord(float vx, float vy) {
  return viewToSourceCoord(vx, vy, new PointF());
}
origin: mozilla-tw/Rocket

/**
 * Convert screen coordinate to source coordinate.
 */
public final PointF viewToSourceCoord(PointF vxy) {
  return viewToSourceCoord(vxy.x, vxy.y, new PointF());
}
origin: mozilla-tw/Rocket

  @Override
  public boolean onDoubleTap(MotionEvent e) {
    if (zoomEnabled && readySent && vTranslate != null) {
      // Hacky solution for #15 - after a double tap the GestureDetector gets in a state
      // where the next fling is ignored, so here we replace it with a new one.
      setGestureDetector(context);
      if (quickScaleEnabled) {
        // Store quick scale params. This will become either a double tap zoom or a
        // quick scale depending on whether the user swipes.
        vCenterStart = new PointF(e.getX(), e.getY());
        vTranslateStart = new PointF(vTranslate.x, vTranslate.y);
        scaleStart = scale;
        isQuickScaling = true;
        isZooming = true;
        quickScaleLastDistance = -1F;
        quickScaleSCenter = viewToSourceCoord(vCenterStart);
        quickScaleVStart = new PointF(e.getX(), e.getY());
        quickScaleVLastPoint = new PointF(quickScaleSCenter.x, quickScaleSCenter.y);
        quickScaleMoved = false;
        // We need to get events in onTouchEvent after this.
        return false;
      } else {
        // Start double tap zoom animation.
        doubleTapZoom(viewToSourceCoord(new PointF(e.getX(), e.getY())), new PointF(e.getX(), e.getY()));
        return true;
      }
    }
    return super.onDoubleTapEvent(e);
  }
});
origin: mozilla-tw/Rocket

/**
 * Returns the source point at the center of the view.
 */
public final PointF getCenter() {
  int mX = getWidth()/2;
  int mY = getHeight()/2;
  return viewToSourceCoord(mX, mY);
}
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewviewToSourceCoord

Javadoc

Convert screen coordinate to source coordinate.

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
  • setScaleAndCenter
    Externally change the scale and translation of the source image. This may be used with getCenter() a
  • 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>
  • setZoomEnabled,
  • <init>,
  • getCenter,
  • getContext,
  • getHeight,
  • getOrientation,
  • getScale,
  • isReady,
  • onDraw,
  • onImageLoaded

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • addToBackStack (FragmentTransaction)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Kernel (java.awt.image)
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • JList (javax.swing)
  • Best plugins for Eclipse
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