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


Java ImageView.getImageMatrix方法代码示例

本文整理汇总了Java中android.widget.ImageView.getImageMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getImageMatrix方法的具体用法?Java ImageView.getImageMatrix怎么用?Java ImageView.getImageMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


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

示例1: Builder

import android.widget.ImageView; //导入方法依赖的package包/类
public Builder(ImageView imageView) {
    viewRef = new WeakReference<>(imageView);
    if (imageView.getScaleType() != ImageView.ScaleType.MATRIX) {
        throw new IllegalStateException("the image scaleType must be ScaleType.MATRIX");
    }

    Drawable d = imageView.getDrawable();
    if (d != null) {
        animCenterX = d.getIntrinsicWidth() / 2;
        animCenterY = d.getIntrinsicHeight() / 2;
    }

    Matrix matrix = new Matrix(imageView.getImageMatrix());
    fromDegrees = toDegrees = MatrixUtils.getMatrixAngle(matrix);
    fromScaleX = toScaleX = getMatrixScaleX(matrix);
    fromScaleY = toScaleY = getMatrixScaleY(matrix);

    float[] txty = calculateTxTy();
    fromTranslateX = toTranslateX = txty[0];
    fromTranslateY = toTranslateY = txty[1];

}
 
开发者ID:xyzxqs,项目名称:XphotoView,代码行数:23,代码来源:ImageMatrixAnimator.java

示例2: onAnimationUpdate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    ImageMatrixCorrector corrector = getCorrector();
    ImageView imageView = corrector.getImageView();
    Matrix matrix = imageView.getImageMatrix();
    float[] values = getValues();
    matrix.getValues(values);

    float dx = (float) animation.getAnimatedValue(PROPERTY_TRANSLATE_X);
    dx = corrector.correctAbsolute(Matrix.MTRANS_X, dx) - values[Matrix.MTRANS_X];

    float dy = (float) animation.getAnimatedValue(PROPERTY_TRANSLATE_Y);
    dy = corrector.correctAbsolute(Matrix.MTRANS_Y, dy) - values[Matrix.MTRANS_Y];

    matrix.postTranslate(dx, dy);
    imageView.invalidate();
}
 
开发者ID:martinwithaar,项目名称:PinchToZoom,代码行数:18,代码来源:FlingAnimatorHandler.java

示例3: onAnimationUpdate

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onAnimationUpdate(ValueAnimator animation) {
    ImageMatrixCorrector corrector = getCorrector();
    ImageView imageView = corrector.getImageView();
    if(imageView.getDrawable() != null) {
        Matrix matrix = imageView.getImageMatrix();
        float[] values = getValues();
        matrix.getValues(values);

        float sx = (float) animation.getAnimatedValue();
        sx = corrector.correctAbsolute(Matrix.MSCALE_X, sx) / values[Matrix.MSCALE_X];

        if (translate) {
            matrix.postScale(sx, sx, px, py);
        } else {
            matrix.postScale(sx, sx);
        }
        corrector.performAbsoluteCorrections();
        imageView.invalidate();
    }
}
 
开发者ID:martinwithaar,项目名称:PinchToZoom,代码行数:22,代码来源:ScaleAnimatorHandler.java

示例4: canScroll

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if(v instanceof ImageView) {
        ImageView iv = (ImageView) v;
        Drawable drawable = iv.getDrawable();
        if(drawable != null) {
            float vw = iv.getWidth();
            float vh = iv.getHeight();
            float dw = drawable.getIntrinsicWidth();
            float dh = drawable.getIntrinsicHeight();

            Matrix matrix = iv.getImageMatrix();
            matrix.getValues(VALUES);
            float tx = VALUES[Matrix.MTRANS_X] + dx;
            float sdw = dw * VALUES[Matrix.MSCALE_X];

            //Log.d(TAG, "sdw: " + sdw + " vw: " + vw);

            return VALUES[Matrix.MSCALE_X] / centerInsideScale(vw, vh, dw, dh) > scaleThreshold && !translationExceedsBoundary(tx, vw, sdw) && sdw > vw && pointerCount == 1; // Assumes x-y scales are equal
        }
    }
    return super.canScroll(v, checkV, dx, x, y);
}
 
开发者ID:martinwithaar,项目名称:PinchToZoom,代码行数:24,代码来源:ImageViewPager.java

示例5: updateImageViewMatrix

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 *
 * @param imageView
 * @param width
 * @param height
 */
public static final void updateImageViewMatrix(ImageView imageView, float width, float height) {
    Drawable drawable = imageView.getDrawable();
    if(drawable == null) {
        throw new NullPointerException("ImageView drawable is null");
    }
    Matrix matrix = imageView.getImageMatrix();
    if(!matrix.isIdentity()) {
        float[] values = new float[9];
        matrix.getValues(values);

        RectF src = new RectF();
        src.left = 0;
        src.top = 0;
        src.right = width;
        src.bottom = height;

        RectF dst = new RectF();
        dst.left = values[Matrix.MTRANS_X];
        dst.top = values[Matrix.MTRANS_Y];
        dst.right = dst.left + (drawable.getIntrinsicWidth() * values[Matrix.MSCALE_X]);
        dst.bottom = dst.top + (drawable.getIntrinsicHeight() * values[Matrix.MSCALE_Y]);

        matrix.setRectToRect(src, dst, Matrix.ScaleToFit.CENTER);
    }
}
 
开发者ID:martinwithaar,项目名称:PinchToZoom,代码行数:32,代码来源:ImageViewUtils.java

示例6: get

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public Matrix get(ImageView object) {
    return object.getImageMatrix();
}
 
开发者ID:unixzii,项目名称:android-source-codes,代码行数:5,代码来源:ImageTransitionActivity.java


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