在imageView上获取位图的中心点 [英] get Centerpoint of Bitmap on an imageView
本文介绍了在imageView上获取位图的中心点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在ImageView(和其他一些东西)上绘制了一个位图. 我不知道这个问题是否太微不足道,但是我仍然没有找到解决我的问题的方法.
I draw an Bitmap on an ImageView (and some other stuff). I don't know if this problem is too trivial, but I did nothing found solving my problem,yet.
所以: 操作完位图后,我需要获取该位图的中心点. 因此,位图被旋转,移动和缩放.
So: I need to get the Centerpoint auf the Bitmap after I manipulated it. So the Bitmap is rotated,moved and scaled.
如何仍然使用x/y坐标在屏幕上获取BitMap的中心点?
How can I still get the CenterPoint of the BitMap on the Screen with an x/y coordinate?
推荐答案
尝试以下操作,
int width=Bitmap.getWidth();
int height=Bitmap.getHeight();
int centerX=width/2;
int centerY=height/2;
然后,centerX和centerY将成为位图的中心.
then centerX and centerY will be the center of the bitmap.
这篇关于在imageView上获取位图的中心点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文