当前位置: 首页>>代码示例>>Java>>正文


Java ScaleToFit类代码示例

本文整理汇总了Java中android.graphics.Matrix.ScaleToFit的典型用法代码示例。如果您正苦于以下问题:Java ScaleToFit类的具体用法?Java ScaleToFit怎么用?Java ScaleToFit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScaleToFit类属于android.graphics.Matrix包,在下文中一共展示了ScaleToFit类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureBounds

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
private void configureBounds(Canvas canvas) {
    Rect clipBounds = canvas.getClipBounds();
    Matrix canvasMatrix = canvas.getMatrix();
    if (ScaleType.CENTER == this.mScaleType) {
        this.mBounds.set(clipBounds);
    } else if (ScaleType.CENTER_CROP == this.mScaleType) {
        applyScaleToRadii(canvasMatrix);
        this.mBounds.set(clipBounds);
    } else if (ScaleType.FIT_XY == this.mScaleType) {
        Matrix m = new Matrix();
        m.setRectToRect(this.mBitmapRect, new RectF(clipBounds), ScaleToFit.FILL);
        this.mBitmapShader.setLocalMatrix(m);
        this.mBounds.set(clipBounds);
    } else if (ScaleType.FIT_START == this.mScaleType || ScaleType.FIT_END == this
            .mScaleType || ScaleType.FIT_CENTER == this.mScaleType || ScaleType
            .CENTER_INSIDE == this.mScaleType) {
        applyScaleToRadii(canvasMatrix);
        this.mBounds.set(this.mBitmapRect);
    } else if (ScaleType.MATRIX == this.mScaleType) {
        applyScaleToRadii(canvasMatrix);
        this.mBounds.set(this.mBitmapRect);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:24,代码来源:SelectableRoundedImageView.java

示例2: calculateImageMatrixFromScale

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
private void calculateImageMatrixFromScale(float scale, Matrix matrix) {
  matrix.reset();

  Drawable drawable = view.getDrawable();
  if (drawable != null && maxImageSize != 0) {
    // First make sure our image respects mMaxImageSize.
    RectF drawableBounds = tmpRectF1;
    RectF imageBounds = tmpRectF2;
    drawableBounds.set(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
    imageBounds.set(0, 0, maxImageSize, maxImageSize);
    matrix.setRectToRect(drawableBounds, imageBounds, ScaleToFit.CENTER);

    // Then scale it as requested.
    matrix.postScale(scale, scale, maxImageSize / 2f, maxImageSize / 2f);
  }
}
 
开发者ID:material-components,项目名称:material-components-android,代码行数:17,代码来源:FloatingActionButtonImpl.java

示例3: onLoaded

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
public final void onLoaded(FifeImageView paramFifeImageView, Bitmap paramBitmap)
{
  this.mIsImageLoaded = true;
  if (!this.mIsFrozenInCorpusFill) {
    this.mHeroImageView.setVisibility(0);
  }
  if ((this.mShouldTopAlignImage) && (paramBitmap != null))
  {
    int i = paramBitmap.getWidth();
    int j = paramBitmap.getHeight();
    int k = this.mHeroImageView.getWidth();
    float f = j / i;
    Matrix localMatrix = new Matrix();
    RectF localRectF = new RectF(0.0F, 0.0F, i, j);
    int m = (int)(f * k);
    localMatrix.setRectToRect(localRectF, new RectF(0.0F, 0.0F, k, m), Matrix.ScaleToFit.FILL);
    this.mHeroImageView.setScaleType(ImageView.ScaleType.MATRIX);
    this.mHeroImageView.setImageMatrix(localMatrix);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:21,代码来源:HeroGraphicView.java

示例4: restoreInitialPosition

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
private void restoreInitialPosition() {
    // Will start animation for the image to return in its bounds
    updateDiffRect();
    if (rectMap.width() < getWidth()) {
        rectMapUpdate.offset(-rectMap.centerX() + rectView.centerX(), 0);
    } else if (rectMap.left > 0) {
        rectMapUpdate.offset(-rectMap.left, 0);
    } else if (rectMap.right < getWidth()) {
        rectMapUpdate.offset(getWidth() - rectMap.right, 0);
    }

    if (rectMap.height() < getHeight()) {
        rectMapUpdate.offset(0, -rectMap.centerY() + rectView.centerY());
    } else if (rectMap.top > 0) {
        rectMapUpdate.offset(0, -rectMap.top);
    } else if (rectMap.bottom < getHeight()) {
        rectMapUpdate.offset(0, getHeight() - rectMap.bottom);
    }

    if (!equalsRect(rectMapUpdate, rectMap)) {
        // Create matrix for translation from current rect to new rect
        matrixTranslate.setRectToRect(rectMapOrigin, rectMapUpdate, ScaleToFit.FILL);
        mapScaleAnim = new ZoomScaleAnim(matrix, matrixTranslate, 200);
        startZoomAnimation();
    }
}
 
开发者ID:ncornette,项目名称:ZoomableView,代码行数:27,代码来源:ZoomViewTouchable.java

示例5: onBoundsChange

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    this.mRect.set((float) this.margin, (float) this.margin, (float) (bounds.width() - this.margin), (float) (bounds.height() - this.margin));
    Matrix shaderMatrix = new Matrix();
    shaderMatrix.setRectToRect(this.mBitmapRect, this.mRect, ScaleToFit.FILL);
    this.bitmapShader.setLocalMatrix(shaderMatrix);
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:8,代码来源:RoundedBitmapDisplayer.java

示例6: onBoundsChange

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    this.mRect.set((float) this.margin, (float) this.margin, (float) (bounds.width() -
            this.margin), (float) (bounds.height() - this.margin));
    Matrix shaderMatrix = new Matrix();
    shaderMatrix.setRectToRect(this.mBitmapRect, this.mRect, ScaleToFit.FILL);
    this.bitmapShader.setLocalMatrix(shaderMatrix);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:RoundedBitmapDisplayer.java

示例7: onBoundsChange

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
protected void onBoundsChange(Rect bounds) {
    super.onBoundsChange(bounds);
    this.mRect.set(0.0f, 0.0f, (float) bounds.width(), (float) bounds.height());
    this.radius = (float) (Math.min(bounds.width(), bounds.height()) / 2);
    this.strokeRadius = this.radius - (this.strokeWidth / 2.0f);
    Matrix shaderMatrix = new Matrix();
    shaderMatrix.setRectToRect(this.mBitmapRect, this.mRect, ScaleToFit.FILL);
    this.bitmapShader.setLocalMatrix(shaderMatrix);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:CircleBitmapDisplayer.java

示例8: setFraming

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
public void setFraming(final Rect frame, final RectF framePreview, final int displayRotation,
        final int cameraRotation, final boolean cameraFlip) {
    this.frame = frame;
    matrix.setRectToRect(framePreview, new RectF(frame), ScaleToFit.FILL);
    matrix.postRotate(-displayRotation, frame.exactCenterX(), frame.exactCenterY());
    matrix.postScale(cameraFlip ? -1 : 1, 1, frame.exactCenterX(), frame.exactCenterY());
    matrix.postRotate(cameraRotation, frame.exactCenterX(), frame.exactCenterY());

    invalidate();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:11,代码来源:ScannerView.java

示例9: updateMatrix

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
private void updateMatrix()
{
  Drawable localDrawable = getDrawable();
  float f1 = getWidth();
  float f2 = getHeight();
  if ((localDrawable == null) || (f1 == 0.0F) || (f2 == 0.0F)) {
    return;
  }
  float f3 = localDrawable.getIntrinsicWidth();
  float f4 = localDrawable.getIntrinsicHeight();
  if ((f3 <= 0.0F) || (f4 <= 0.0F)) {
    this.mMatrix.reset();
  }
  for (;;)
  {
    super.setImageMatrix(this.mMatrix);
    return;
    float f5 = Math.max(f1 / f3, f2 / f4);
    float f6 = Math.max(f3 - f1 / f5, 0.0F);
    float f7 = Math.max(f4 - f2 / f5, 0.0F);
    float f8 = f6 * this.mFocusPoint.x;
    float f9 = f6 - f8;
    float f10 = f7 * this.mFocusPoint.y;
    float f11 = f7 - f10;
    float f12 = f3 * (this.mDefaultZoom - 1.0F);
    float f13 = f4 * (this.mDefaultZoom - 1.0F);
    RectF localRectF1 = new RectF(f8 + f12 / 2.0F, f10 + f13 / 2.0F, f3 - f9 - f12 / 2.0F, f4 - f11 - f13 / 2.0F);
    RectF localRectF2 = new RectF(0.0F, 0.0F, f1, f2);
    this.mMatrix.setRectToRect(localRectF1, localRectF2, Matrix.ScaleToFit.FILL);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:32,代码来源:FifeImageView.java

示例10: resetOrigin

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
private void resetOrigin() {
    if (rectView.isEmpty()) {
        matrixOrigin.reset();
    } else {
        matrixOrigin.setRectToRect(rectMapOrigin, rectView, ScaleToFit.CENTER);
        matrixOrigin.getValues(matrixOriginValues);
    }
}
 
开发者ID:ncornette,项目名称:ZoomableView,代码行数:9,代码来源:ZoomView.java

示例11: onCreateThemedView

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
protected final View onCreateThemedView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
{
  View localView = paramLayoutInflater.inflate(this.mRootLayout, paramViewGroup, false);
  this.mMainContent = ((FocusedViewToTopScrollView)localView.findViewById(R.id.main_content));
  this.mTitleImageView = ((FifeNetworkImageView)localView.findViewById(R.id.title_image));
  this.mTopBarView = ((TopBarView)localView.findViewById(R.id.top_bar));
  this.mTitleSeparator = localView.findViewById(R.id.title_separator);
  this.mButtonBar = ((ButtonBar)localView.findViewById(R.id.button_bar));
  this.mButtonBar.setPositiveButtonOnClickListener(this);
  this.mButtonBar.setNegativeButtonOnClickListener(this);
  this.mButtonBar.setExpandButtonOnClickListener(this);
  String str = this.mArguments.getBundle("additionalArgs").getString("com.google.android.wallet.orchestration.TITLE_IMAGE_FIFE_URL");
  if (!TextUtils.isEmpty(str))
  {
    this.mTitleImageView.setOnLoadedListener(new FifeNetworkImageView.OnLoadedListener()
    {
      public final void onLoaded$70e9aa75(Bitmap paramAnonymousBitmap)
      {
        int i;
        int j;
        int k;
        int m;
        float f;
        int n;
        if (paramAnonymousBitmap != null)
        {
          BaseOrchestrationFragment.this.mTitleImageView.setScaleType(ImageView.ScaleType.MATRIX);
          i = BaseOrchestrationFragment.this.mTitleImageView.getWidth();
          j = BaseOrchestrationFragment.this.mTitleImageView.getHeight();
          k = paramAnonymousBitmap.getWidth();
          m = paramAnonymousBitmap.getHeight();
          f = k / m;
          if (!BaseOrchestrationFragment.this.getResources().getBoolean(R.bool.wallet_uic_is_tablet)) {
            break label156;
          }
          n = (int)(f * j);
        }
        for (int i1 = j;; i1 = Math.max(j, (int)(i / f)))
        {
          RectF localRectF1 = new RectF(0.0F, 0.0F, k, m);
          RectF localRectF2 = new RectF(0.0F, 0.0F, n, i1);
          Matrix localMatrix = new Matrix();
          localMatrix.setRectToRect(localRectF1, localRectF2, Matrix.ScaleToFit.FILL);
          BaseOrchestrationFragment.this.mTitleImageView.setImageMatrix(localMatrix);
          return;
          label156:
          n = Math.max(i, (int)(f * j));
        }
      }
    });
    this.mTitleImageView.setVisibility(0);
    this.mTitleImageView.setFadeIn(false);
    this.mTitleImageView.setFifeImageUrl(str, PaymentUtils.getImageLoader(getActivity().getApplicationContext()), ((Boolean)G.images.useWebPForFife.get()).booleanValue());
  }
  this.mTopInfoText = ((ImInfoMessageTextView)localView.findViewById(R.id.top_info_text));
  this.mTopInfoText.setParentUiNode(this);
  this.mTopInfoText.setUrlClickListener(this);
  this.mProgressTopBarView = ((TopBarView)localView.findViewById(R.id.progress_top_bar));
  this.mProgressBar = ((ProgressBar)localView.findViewById(R.id.progress_bar));
  this.mProgressText = ((TextView)localView.findViewById(R.id.progress_text));
  this.mErrorText = ((TextView)localView.findViewById(R.id.message));
  this.mErrorCode = ((TextView)localView.findViewById(R.id.details));
  updateNonSubformPageUi();
  this.mSubFormFragment = ((FormFragment)getChildFragmentManager().findFragmentById(R.id.sub_form_holder));
  if (this.mSubFormFragment == null) {
    updateSubFormFragment();
  }
  for (;;)
  {
    if ((paramBundle != null) && (this.mInlineErrorMessageDetails != null)) {
      updateInlineErrorMessageStateAndVisibility();
    }
    localView.findViewById(R.id.steal_focus_and_hide_keyboard).setOnFocusChangeListener(this);
    return localView;
    configureAutoScrollingForPage();
    constructAndConfigureDependencyGraphManagerForPage();
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:79,代码来源:BaseOrchestrationFragment.java

示例12: c

import android.graphics.Matrix.ScaleToFit; //导入依赖的package包/类
private final void c(int paramInt1, int paramInt2)
{
  int i1 = getPaddingTop();
  int i2 = getPaddingRight();
  int i3 = getPaddingBottom();
  int i4 = getPaddingLeft();
  int i5 = getWidth() - i4 - i2;
  int i6 = getHeight() - i1 - i3;
  float f1 = paramInt1 / paramInt2;
  float f2 = i5 / i6;
  switch (this.w)
  {
  }
  for (;;)
  {
    this.aj.set(this.ag);
    this.ai.set(this.ah);
    this.ak.setRectToRect(this.aj, this.ai, Matrix.ScaleToFit.FILL);
    if (!this.ak.invert(this.al)) {
      this.al.reset();
    }
    return;
    this.ag.set(0, 0, paramInt1, paramInt2);
    if (f1 > f2)
    {
      int i11 = (i6 - (int)(i5 / f1)) / 2;
      this.ah.set(i4, i1 + i11, i5 + i4, i1 + i6 - i11);
    }
    else
    {
      int i10 = (i5 - (int)(f1 * i6)) / 2;
      this.ah.set(i4 + i10, i1, i5 + i4 - i10, i6 + i1);
      continue;
      if (f1 > f2)
      {
        int i9 = (paramInt1 - (int)(f2 * paramInt2)) / 2;
        this.ag.set(i9, 0, paramInt1 - i9, paramInt2);
      }
      for (;;)
      {
        this.ah.set(i4, i1, i5 + i4, i6 + i1);
        break;
        int i7 = (int)(paramInt1 / f2);
        int i8 = Math.max((int)(paramInt2 * this.N) - i7 / 2, 0);
        this.ag.set(0, i8, paramInt1, i7 + i8);
      }
      this.ag.set(0, 0, paramInt1, paramInt2);
      this.ah.set(0, 0, i5, i6);
    }
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:52,代码来源:MediaView.java


注:本文中的android.graphics.Matrix.ScaleToFit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。