我想裁剪我在ImageView上显示的图像。 我想要的是,我希望在图像上显示一个可调整大小的矩形。 该矩形将具有可移动的角(我可以通过触摸拖动)来增加/减小其大小。 下图说明了我想要开发的一些演示。
PS我不太确定如何表达我的问题。 我想要的是: http : //imageshack.us/photo/my-images/832/customcropbox.jpg/
I want to crop my image which is being displayed on an ImageView. How I want to go about it is that I want a re-sizable rectangle to be displayed on the image. That rectangle will have moveable corners (which I can drag around with touch) to increase/decrease its size. The image below illustrates a demo of something I would like to develop.
P. S. I am not quite sure how to phrase my question. What I want: http://imageshack.us/photo/my-images/832/customcropbox.jpg/
最满意答案
经过充分研究后,我想出的最终解决方案是:
扩展ImageView以创建我自己的自定义视图。
@Override onDraw方法并在该方法中进行自定义绘制。
在视图上实现onTouchListener以获取触摸事件并根据其位置处理它们。
例如
我检查了触摸是否在锚点圆的半径中我画了我在覆盖onDraw方法中绘制的可移动矩形。
编辑:我很抱歉,我不再拥有那段代码了,我很长一段时间来到这里,否则本来很想帮助你。
心痛。
The final solution I came up with after ample research was:
Extend ImageView to make my own custom view.
@Override onDraw method and do my custom drawing there in that method.
Implement onTouchListener on the view to get the touch events and process them according to their position.
e. g.
I checked whether the touch was in the radius of the anchor point circle I drew around the movable rectangle that I was drawing in my overriden onDraw method.
Edit: I am sorry guys I don't have that piece of code anymore, I came here after a very long time otherwise would have loved to help you out.
Heartache.
更多推荐
发布评论