WeChatImageClipping Save

仿微信IM图片剪裁

Project README

WeChatImageClipping

现在IM(包括第三方的环信、融云等)都在仿微信,我也是遇到这种需求之后,写的这个图片剪裁,效果如下:

![image] (https://github.com/nicewarm/WeChatImageClipping/blob/master/image/clipping.png)

主要代码如下:

   Bitmap roundConcerImage = Bitmap.createBitmap(500,500, Config.ARGB_8888);
   Canvas canvas = new Canvas(roundConcerImage);
   Paint paint = new Paint();
   Rect rect = new Rect(0,0,500,500);
   Rect rectF = new Rect(0, 0, bitmap_in.getWidth(), bitmap_in.getHeight());
   paint.setAntiAlias(true);
   NinePatch patch = new NinePatch(bitmap_bg, bitmap_bg.getNinePatchChunk(), null);
   patch.draw(canvas, rect);
   paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
   canvas.drawBitmap(bitmap_in, rectF, rect, paint);
Open Source Agenda is not affiliated with "WeChatImageClipping" Project. README Source: nicewarm/WeChatImageClipping
Stars
138
Open Issues
0
Last Commit
9 years ago

Open Source Agenda Badge

Open Source Agenda Rating