裁剪使用customView一个ImageView的 [英] Crop a imageView using a customView

查看:126
本文介绍了裁剪使用customView一个ImageView的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做这可以裁剪一个人的照片的应用程序。我还附上图片,以显示我正在做什么。它就像WhatsApp的应用程序。蓝色方块实际上是一个从customView View类扩展。我重写它使用画布绘制正方形的onDraw()函数。我怎样才能捕捉蓝色正方形的面积定义的图像?

I'm making an application which can crop a picture of a person. I have also attached the image to show exactly what I'm making. It is just like WhatsApp application. The blue square is actually a customView extended from View class. I'm overriding onDraw() function which uses canvas to draw the square. How can I capture image defined by area of blue square?

感谢您

推荐答案

让您的蓝色区域的精确坐标,然后用你刚才计算坐标创建从原来的一个位图!

Get the exact coordinates of your blue area and then create a bitmap from the original one using the coordinates you just calculated!

Bitmap newBitmap = Bitmap.createBitmap(mBitmap,x,y,width,height);

这篇关于裁剪使用customView一个ImageView的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆