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

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

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

origin: davemorrissey/subsampling-scale-image-view

/**
 * Given a requested source center and scale, calculate what the actual center will have to be to keep the image in
 * pan limits, keeping the requested center as near to the middle of the screen as allowed.
 */
@NonNull
private PointF limitedSCenter(float sCenterX, float sCenterY, float scale, @NonNull PointF sTarget) {
  PointF vTranslate = vTranslateForSCenter(sCenterX, sCenterY, scale);
  int vxCenter = getPaddingLeft() + (getWidth() - getPaddingRight() - getPaddingLeft())/2;
  int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop())/2;
  float sx = (vxCenter - vTranslate.x)/scale;
  float sy = (vyCenter - vTranslate.y)/scale;
  sTarget.set(sx, sy);
  return sTarget;
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Get the translation required to place a given source coordinate at the center of the screen, with the center
 * adjusted for asymmetric padding. Accepts the desired scale as an argument, so this is independent of current
 * translate and scale. The result is fitted to bounds, putting the image point as near to the screen center as permitted.
 */
@NonNull
private PointF vTranslateForSCenter(float sCenterX, float sCenterY, float scale) {
  int vxCenter = getPaddingLeft() + (getWidth() - getPaddingRight() - getPaddingLeft())/2;
  int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop())/2;
  if (satTemp == null) {
    satTemp = new ScaleAndTranslate(0, new PointF(0, 0));
  }
  satTemp.scale = scale;
  satTemp.vTranslate.set(vxCenter - (sCenterX * scale), vyCenter - (sCenterY * scale));
  fitToBounds(true, satTemp);
  return satTemp.vTranslate;
}
origin: davemorrissey/subsampling-scale-image-view

int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop())/2;
float targetScale = limitedScale(this.targetScale);
PointF targetSCenter = panLimited ? limitedSCenter(this.targetSCenter.x, this.targetSCenter.y, targetScale, new PointF()) : this.targetSCenter;
origin: davemorrissey/subsampling-scale-image-view

float yPaddingRatio = getPaddingTop() > 0 || getPaddingBottom() > 0 ? getPaddingTop()/(float)(getPaddingTop() + getPaddingBottom()) : 0.5f;
origin: davemorrissey/subsampling-scale-image-view

/**
 * Returns the minimum allowed scale.
 */
private float minScale() {
  int vPadding = getPaddingBottom() + getPaddingTop();
  int hPadding = getPaddingLeft() + getPaddingRight();
  if (minimumScaleType == SCALE_TYPE_CENTER_CROP || minimumScaleType == SCALE_TYPE_START) {
    return Math.max((getWidth() - hPadding) / (float) sWidth(), (getHeight() - vPadding) / (float) sHeight());
  } else if (minimumScaleType == SCALE_TYPE_CUSTOM && minScale > 0) {
    return minScale;
  } else {
    return Math.min((getWidth() - hPadding) / (float) sWidth(), (getHeight() - vPadding) / (float) sHeight());
  }
}
origin: mozilla-tw/Rocket

/**
 * Given a requested source center and scale, calculate what the actual center will have to be to keep the image in
 * pan limits, keeping the requested center as near to the middle of the screen as allowed.
 */
private PointF limitedSCenter(float sCenterX, float sCenterY, float scale, PointF sTarget) {
  PointF vTranslate = vTranslateForSCenter(sCenterX, sCenterY, scale);
  int vxCenter = getPaddingLeft() + (getWidth() - getPaddingRight() - getPaddingLeft())/2;
  int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop())/2;
  float sx = (vxCenter - vTranslate.x)/scale;
  float sy = (vyCenter - vTranslate.y)/scale;
  sTarget.set(sx, sy);
  return sTarget;
}
origin: mozilla-tw/Rocket

/**
 * Get the translation required to place a given source coordinate at the center of the screen, with the center
 * adjusted for asymmetric padding. Accepts the desired scale as an argument, so this is independent of current
 * translate and scale. The result is fitted to bounds, putting the image point as near to the screen center as permitted.
 */
private PointF vTranslateForSCenter(float sCenterX, float sCenterY, float scale) {
  int vxCenter = getPaddingLeft() + (getWidth() - getPaddingRight() - getPaddingLeft())/2;
  int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop())/2;
  if (satTemp == null) {
    satTemp = new ScaleAndTranslate(0, new PointF(0, 0));
  }
  satTemp.scale = scale;
  satTemp.vTranslate.set(vxCenter - (sCenterX * scale), vyCenter - (sCenterY * scale));
  fitToBounds(true, satTemp);
  return satTemp.vTranslate;
}
origin: mozilla-tw/Rocket

int vyCenter = getPaddingTop() + (getHeight() - getPaddingBottom() - getPaddingTop())/2;
float targetScale = limitedScale(this.targetScale);
PointF targetSCenter = panLimited ? limitedSCenter(this.targetSCenter.x, this.targetSCenter.y, targetScale, new PointF()) : this.targetSCenter;
origin: mozilla-tw/Rocket

float yPaddingRatio = getPaddingTop() > 0 || getPaddingBottom() > 0 ? getPaddingTop()/(float)(getPaddingTop() + getPaddingBottom()) : 0.5f;
origin: mozilla-tw/Rocket

/**
 * Returns the minimum allowed scale.
 */
private float minScale() {
  int vPadding = getPaddingBottom() + getPaddingTop();
  int hPadding = getPaddingLeft() + getPaddingRight();
  if (minimumScaleType == SCALE_TYPE_CENTER_CROP) {
    return Math.max((getWidth() - hPadding) / (float) sWidth(), (getHeight() - vPadding) / (float) sHeight());
  } else if (minimumScaleType == SCALE_TYPE_CUSTOM && minScale > 0) {
    return minScale;
  } else {
    return Math.min((getWidth() - hPadding) / (float) sWidth(), (getHeight() - vPadding) / (float) sHeight());
  }
}
com.davemorrissey.labs.subscaleviewSubsamplingScaleImageViewgetPaddingTop

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 IntelliJ plugins
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