private void setupBitmap(ImageView imageView, float width, float height) {
Drawable drawable = imageView.getDrawable();
if (drawable == null) {
return;
}
try {
bitmap = (drawable instanceof BitmapDrawable) ?
((BitmapDrawable) drawable).getBitmap() :
Bitmap.createBitmap(drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
} catch (Exception e) {
e.printStackTrace();
}
if (bitmap == null) {
imageView.invalidate();
return;
}
paint = new Paint(ANTI_ALIAS_FLAG);
bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
paint.setShader(bitmapShader);
if (imageView.getScaleType() != ImageView.ScaleType.CENTER_CROP && imageView.getScaleType() != ImageView.ScaleType.FIT_XY) {
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
}
bitmapShader.setLocalMatrix(setUpScaleType(bitmap, imageView, width, height));
imageView.invalidate();
}
ObliqueView.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:Oblique
作者:
评论列表
文章目录