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


Java ScaleType.MATRIX属性代码示例

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


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

示例1: checkImageViewScaleType

private void checkImageViewScaleType() {
	ImageView imageView = getImageView();

	/**
	 * PhotoView's getScaleType() will just divert to this.getScaleType() so
	 * only call if we're not attached to a PhotoView.
	 */
	if (null != imageView && !(imageView instanceof PhotoView)) {
		if (imageView.getScaleType() != ScaleType.MATRIX) {
			throw new IllegalStateException(
					"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
		}
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:PhotoViewAttacher.java

示例2: getResizeMode

private ScaleType getResizeMode(String resizeMode) {
    ScaleType scaleType = ScaleType.FIT_XY;
    if (TextUtils.isEmpty(resizeMode)) {
        return scaleType;
    }

    if (resizeMode.equals("cover")) {
        scaleType = ScaleType.CENTER_CROP;
    } else if (resizeMode.equals("contain")) {
        scaleType = ScaleType.FIT_CENTER;
    } else if (resizeMode.equals("stretch")) {
        scaleType = ScaleType.FIT_XY;
    } else if (resizeMode.equals("center")) {
        scaleType = ScaleType.CENTER;
    } else if (resizeMode.equals("start")) {
        scaleType = ScaleType.MATRIX;
    } else if (resizeMode.equals("end")) {
        scaleType = ScaleType.FIT_END;
    }
    return scaleType;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:21,代码来源:WXImage.java

示例3: checkImageViewScaleType

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof PhotoView)) {
        if (imageView.getScaleType() != ScaleType.MATRIX) {
            throw new IllegalStateException("The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
        }
    }
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:13,代码来源:PhotoViewAttacher.java

示例4: checkImageViewScaleType

private void checkImageViewScaleType() {
	ImageView imageView = getImageView();

	/**
	 * PhotoView's getScaleType() will just divert to this.getScaleType() so
	 * only call if we're not attached to a PhotoView.
	 */
	if (null != imageView && !(imageView instanceof EasePhotoView)) {
		if (imageView.getScaleType() != ScaleType.MATRIX) {
			throw new IllegalStateException(
					"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
		}
	}
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:14,代码来源:PhotoViewAttacher.java

示例5: configureBounds

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,代码行数:23,代码来源:SelectableRoundedImageView.java

示例6: adjustCanvasForBorder

private void adjustCanvasForBorder(Canvas canvas) {
    float[] values = new float[9];
    canvas.getMatrix().getValues(values);
    float scaleFactorX = values[0];
    float scaleFactorY = values[4];
    float translateX = values[2];
    float translateY = values[5];
    float newScaleX = this.mBounds.width() / ((this.mBounds.width() + this.mBorderWidth)
            + this.mBorderWidth);
    float newScaleY = this.mBounds.height() / ((this.mBounds.height() + this
            .mBorderWidth) + this.mBorderWidth);
    canvas.scale(newScaleX, newScaleY);
    if (ScaleType.FIT_START == this.mScaleType || ScaleType.FIT_END == this.mScaleType ||
            ScaleType.FIT_XY == this.mScaleType || ScaleType.FIT_CENTER == this
            .mScaleType || ScaleType.CENTER_INSIDE == this.mScaleType || ScaleType.MATRIX
            == this.mScaleType) {
        canvas.translate(this.mBorderWidth, this.mBorderWidth);
    } else if (ScaleType.CENTER == this.mScaleType || ScaleType.CENTER_CROP == this
            .mScaleType) {
        canvas.translate((-translateX) / (newScaleX * scaleFactorX), (-translateY) /
                (newScaleY * scaleFactorY));
        canvas.translate(-(this.mBounds.left - this.mBorderWidth), -(this.mBounds.top -
                this.mBorderWidth));
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:SelectableRoundedImageView.java

示例7: checkImageViewScaleType

private void checkImageViewScaleType() {
    ImageView imageView = getImageView();

    /**
     * PhotoView's getScaleType() will just divert to this.getScaleType() so
     * only call if we're not attached to a PhotoView.
     */
    if (null != imageView && !(imageView instanceof EasePhotoView)) {
        if (imageView.getScaleType() != ScaleType.MATRIX) {
            throw new IllegalStateException(
                    "The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
        }
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:14,代码来源:PhotoViewAttacher.java

示例8: onCaptureSharedElementSnapshot

public Parcelable onCaptureSharedElementSnapshot(View sharedElement, Matrix viewToGlobalMatrix, RectF screenBounds) {
    Bitmap bitmap;
    if (sharedElement instanceof ImageView) {
        ImageView imageView = (ImageView) sharedElement;
        Drawable d = imageView.getDrawable();
        Drawable bg = imageView.getBackground();
        if (d != null && bg == null) {
            bitmap = createDrawableBitmap(d);
            if (bitmap != null) {
                Bundle bundle = new Bundle();
                bundle.putParcelable(BUNDLE_SNAPSHOT_BITMAP, bitmap);
                bundle.putString(BUNDLE_SNAPSHOT_IMAGE_SCALETYPE, imageView.getScaleType().toString());
                if (imageView.getScaleType() != ScaleType.MATRIX) {
                    return bundle;
                }
                float[] values = new float[9];
                imageView.getImageMatrix().getValues(values);
                bundle.putFloatArray(BUNDLE_SNAPSHOT_IMAGE_MATRIX, values);
                return bundle;
            }
        }
    }
    int bitmapWidth = Math.round(screenBounds.width());
    int bitmapHeight = Math.round(screenBounds.height());
    bitmap = null;
    if (bitmapWidth > 0 && bitmapHeight > 0) {
        float scale = Math.min(1.0f, ((float) MAX_IMAGE_SIZE) / ((float) (bitmapWidth * bitmapHeight)));
        bitmapWidth = (int) (((float) bitmapWidth) * scale);
        bitmapHeight = (int) (((float) bitmapHeight) * scale);
        if (this.mTempMatrix == null) {
            this.mTempMatrix = new Matrix();
        }
        this.mTempMatrix.set(viewToGlobalMatrix);
        this.mTempMatrix.postTranslate(-screenBounds.left, -screenBounds.top);
        this.mTempMatrix.postScale(scale, scale);
        bitmap = Bitmap.createBitmap(bitmapWidth, bitmapHeight, Config.ARGB_8888);
        Canvas canvas = new Canvas(bitmap);
        canvas.concat(this.mTempMatrix);
        sharedElement.draw(canvas);
    }
    return bitmap;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:42,代码来源:SharedElementCallback.java

示例9: setScaleType

public void setScaleType(ScaleType scaleType) {
    if (scaleType == ScaleType.MATRIX) {
        super.setScaleType(scaleType);
    } else {
        Log.w(TAG, "Invalid ScaleType. Only ScaleType.MATRIX can be used");
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:TransformImageView.java

示例10: setScaleType

public void setScaleType(ScaleType type) {
    if (type == ScaleType.FIT_START || type == ScaleType.FIT_END) {
        throw new UnsupportedOperationException("TouchImageView does not support FIT_START or" +
                " FIT_END");
    } else if (type == ScaleType.MATRIX) {
        super.setScaleType(ScaleType.MATRIX);
    } else {
        this.mScaleType = type;
        if (this.onDrawReady) {
            setZoom(this);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:TouchImageView.java

示例11: PhotoView

public PhotoView(Context context, AttributeSet attr, int defStyle) {
    super(context, attr, defStyle);
    super.setScaleType(ScaleType.MATRIX);
    this.mAttacher = new PhotoViewAttacher(this);
    if (this.mPendingScaleType != null) {
        setScaleType(this.mPendingScaleType);
        this.mPendingScaleType = null;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:PhotoView.java


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