canvas教程

android 圆形头型 bitmap toRoundBitmap

字号+ 作者:H5之家 来源:H5之家 2017-09-20 11:12 我要评论( )

android 圆形头型 bitmap toRoundBitmap


ImageView image = (ImageView) findViewById(R.id.image);
bitmapDrawable bitmapDrawable = (BitmapDrawable) this.getResources().getDrawable(R.drawable.image);
Bitmap bitmap = bitmapDrawable.getBitmap();
image.setImageBitmap(BitmapUtil.toRoundBitmap(bitmap));

public class BitmapUtil {
public static Bitmap toRoundBitmap(Bitmap bitmap) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
float roundPx;
float left, top, right, bottom, dst_left, dst_top, dst_right, dst_bottom;
if (width

 

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

相关文章
  • [Android FrameWork 6.0源码学习] View的重绘过程之Draw

    [Android FrameWork 6.0源码学习] View的重绘过程之Draw

    2017-09-19 08:27

  • canvas 详细的android画图学习资料和总结 联合开发网

    canvas 详细的android画图学习资料和总结 联合开发网

    2017-09-18 12:01

  • Android 绘制圆弧(1)

    Android 绘制圆弧(1)

    2017-09-18 09:04

  • Android实现界面实时更新

    Android实现界面实时更新

    2017-09-17 18:19

网友点评