Tabnine Logo
com.davemorrissey.labs.subscaleview
Code IndexAdd Tabnine to your IDE (free)

How to use com.davemorrissey.labs.subscaleview

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

origin: davemorrissey/subsampling-scale-image-view

private AnimationBuilder(float scale) {
  this.targetScale = scale;
  this.targetSCenter = getCenter();
  this.vFocus = null;
}
origin: davemorrissey/subsampling-scale-image-view

  @Override
  public boolean onSingleTapConfirmed(MotionEvent e) {
    performClick();
    return true;
  }
});
origin: davemorrissey/subsampling-scale-image-view

/**
 * Get source width taking rotation into account.
 */
@SuppressWarnings("SuspiciousNameCombination")
private int sWidth() {
  int rotation = getRequiredRotation();
  if (rotation == 90 || rotation == 270) {
    return sHeight;
  } else {
    return sWidth;
  }
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Check whether view and image dimensions are known and either a preview, full size image or
 * base layer tiles are loaded. First time, send ready event to listener. The next draw will
 * display an image.
 */
private boolean checkReady() {
  boolean ready = getWidth() > 0 && getHeight() > 0 && sWidth > 0 && sHeight > 0 && (bitmap != null || isBaseLayerReady());
  if (!readySent && ready) {
    preDraw();
    readySent = true;
    onReady();
    if (onImageEventListener != null) {
      onImageEventListener.onReady();
    }
  }
  return ready;
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Get the current state of the view (scale, center, orientation) for restoration after rotate. Will return null if
 * the view is not ready.
 * @return an {@link ImageViewState} instance representing the current position of the image. null if the view isn't ready.
 */
@Nullable
public final ImageViewState getState() {
  if (vTranslate != null && sWidth > 0 && sHeight > 0) {
    //noinspection ConstantConditions
    return new ImageViewState(getScale(), getCenter(), getOrientation());
  }
  return null;
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Determine whether tile is visible.
 */
private boolean tileVisible(Tile tile) {
  float sVisLeft = viewToSourceX(0),
    sVisRight = viewToSourceX(getWidth()),
    sVisTop = viewToSourceY(0),
    sVisBottom = viewToSourceY(getHeight());
  return !(sVisLeft > tile.sRect.right || tile.sRect.left > sVisRight || sVisTop > tile.sRect.bottom || tile.sRect.top > sVisBottom);
}
origin: commonsguy/cw-omnibus

 void setPage(PdfRenderer.Page page) {
  if (bitmap==null) {
   int height=2000;
   int width=height * page.getWidth() / page.getHeight();

   bitmap=Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
  }

  bitmap.eraseColor(0xFFFFFFFF);
  page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
  iv.resetScaleAndCenter();
  iv.setImage(ImageSource.cachedBitmap(bitmap));
 }
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Set scale, center and orientation from saved state.
 */
private void restoreState(ImageViewState state) {
  if (state != null && VALID_ORIENTATIONS.contains(state.getOrientation())) {
    this.orientation = state.getOrientation();
    this.pendingScale = state.getScale();
    this.sPendingCenter = state.getCenter();
    invalidate();
  }
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Check whether either the full size bitmap or base layer tiles are loaded. First time, send image
 * loaded event to listener.
 */
private boolean checkImageLoaded() {
  boolean imageLoaded = isBaseLayerReady();
  if (!imageLoadedSent && imageLoaded) {
    preDraw();
    imageLoadedSent = true;
    onImageLoaded();
    if (onImageEventListener != null) {
      onImageEventListener.onImageLoaded();
    }
  }
  return imageLoaded;
}
origin: davemorrissey/subsampling-scale-image-view

private void sendStateChanged(float oldScale, PointF oldVTranslate, int origin) {
  if (onStateChangedListener != null && scale != oldScale) {
    onStateChangedListener.onScaleChanged(scale, origin);
  }
  if (onStateChangedListener != null && !vTranslate.equals(oldVTranslate)) {
    onStateChangedListener.onCenterChanged(getCenter(), origin);
  }
}
origin: davemorrissey/subsampling-scale-image-view

  @Override public void onClick(View v) { imageView.setOrientation((imageView.getOrientation() + 90) % 360); }
});
origin: davemorrissey/subsampling-scale-image-view

/**
 * Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image
 * beyond the panning limits, the image is automatically panned during the animation.
 * @param scale Target scale.
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
@Nullable
public AnimationBuilder animateScale(float scale) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(scale);
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * On resize, preserve center and scale. Various behaviours are possible, override this method to use another.
 */
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
  debug("onSizeChanged %dx%d -> %dx%d", oldw, oldh, w, h);
  PointF sCenter = getCenter();
  if (readySent && sCenter != null) {
    this.anim = null;
    this.pendingScale = scale;
    this.sPendingCenter = sCenter;
  }
}
origin: davemorrissey/subsampling-scale-image-view

  public boolean handleMessage(Message message) {
    if (message.what == MESSAGE_LONG_CLICK && onLongClickListener != null) {
      maxTouchCount = 0;
      SubsamplingScaleImageView.super.setOnLongClickListener(onLongClickListener);
      performLongClick();
      SubsamplingScaleImageView.super.setOnLongClickListener(null);
    }
    return true;
  }
});
origin: davemorrissey/subsampling-scale-image-view

/**
 * Releases all resources the view is using and resets the state, nulling any fields that use significant memory.
 * After you have called this method, the view can be re-used by setting a new image. Settings are remembered
 * but state (scale and center) is forgotten. You can restore these yourself if required.
 */
public void recycle() {
  reset(true);
  bitmapPaint = null;
  debugTextPaint = null;
  debugLinePaint = null;
  tileBgPaint = null;
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Returns the minimum allowed scale.
 * @return the minimum scale as a source/view pixels ratio.
 */
public final float getMinScale() {
  return minScale();
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Creates a scale animation builder, that when started will animate a zoom in or out. If this would move the image
 * beyond the panning limits, the image is automatically panned during the animation.
 * @param scale Target scale.
 * @param sCenter Target source center.
 * @return {@link AnimationBuilder} instance. Call {@link SubsamplingScaleImageView.AnimationBuilder#start()} to start the anim.
 */
@Nullable
public AnimationBuilder animateScaleAndCenter(float scale, PointF sCenter) {
  if (!isReady()) {
    return null;
  }
  return new AnimationBuilder(scale, sCenter);
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Get source height taking rotation into account.
 */
@SuppressWarnings("SuspiciousNameCombination")
private int sHeight() {
  int rotation = getRequiredRotation();
  if (rotation == 90 || rotation == 270) {
    return sWidth;
  } else {
    return sHeight;
  }
}
origin: davemorrissey/subsampling-scale-image-view

@Override
public boolean onSingleTapConfirmed(MotionEvent e) {
  performClick();
  return true;
}
origin: davemorrissey/subsampling-scale-image-view

/**
 * Returns the actual orientation of the image relative to the source file. This will be based on the source file's
 * EXIF orientation if you're using ORIENTATION_USE_EXIF. Values are 0, 90, 180, 270.
 * @return the orientation applied after EXIF information has been extracted. See static fields.
 */
public final int getAppliedOrientation() {
  return getRequiredRotation();
}
com.davemorrissey.labs.subscaleview

Most used classes

  • SubsamplingScaleImageView
    Displays an image subsampled as necessary to avoid loading too much image data into memory. After a
  • ImageSource
    Helper class used to set the source and additional attributes from a variety of sources. Supports us
  • SubsamplingScaleImageView$AnimationBuilder
    Builder class used to set additional options for a scale animation. Create an instance using #animat
  • ImageViewState
    Wraps the scale, center and orientation of a displayed image for easy restoration on screen rotate.
  • CompatDecoderFactory
    Compatibility factory to instantiate decoders with empty public constructors.
  • SubsamplingScaleImageView$Anim,
  • SubsamplingScaleImageView$BitmapLoadTask,
  • SubsamplingScaleImageView$OnAnimationEventListener,
  • SubsamplingScaleImageView$OnImageEventListener,
  • SubsamplingScaleImageView$OnStateChangedListener,
  • SubsamplingScaleImageView$ScaleAndTranslate,
  • SubsamplingScaleImageView$Tile,
  • SubsamplingScaleImageView$TileLoadTask,
  • SubsamplingScaleImageView$TilesInitTask,
  • DecoderFactory,
  • ImageDecoder,
  • SubsamplingScaleImageView$DefaultOnAnimationEventListener,
  • SubsamplingScaleImageView$DefaultOnImageEventListener,
  • SkiaImageRegionDecoder
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