canvas画布中视图操作

来源:互联网 发布:php final 编辑:程序博客网 时间:2024/06/15 00:15

Bitmap.createScaledBitmap ( Bitmap  src, int dstWidth, int dstHeight, boolean filter);

src The source bitmap.

dstWidth The new bitmap's desired width.

dstHeight The new bitmap's desired height.

filter true if the source should be filtered.

src 用来构建子集的源位图

 

dstWidth   新位图期望的宽度

 

dstHeight  新位图期望的高度

 

返回值

 

       一个新的按比例变化的位图。

 

Canvas canvas = new Canvas(bitmap1);  

  

paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));  

  

canvas.drawBitmap(mask, 0f, 0f, paint);   

就是在图片bitmap1上面绘制图片mask时 处理两者相交时候显示的问题

canvas原有的图片 可以理解为背景 就是dst
新画上去的图片可以理解为前景就是src


Mode的值 如下图

 


 

原创粉丝点击