imageView.getImageMatrix()
float[] values = new float[9];
matrix.getValues(values);
float mtrans_x = values[Matrix.MTRANS_X];//左上顶点X坐标
float mtrans_y = values[Matrix.MTRANS_Y];//左上顶点Y坐标
float mscale_x = values[Matrix.MSCALE_X] ;//宽度缩放倍数
float mscale_y = values[Matrix.MSCALE_Y] ;//高度缩放位数
Drawable drawable = relativeImageView.getDrawable();
Rect imageBounds = drawable.getBounds();
//original height and width of the bitmap
int intrinsicHeight = drawable.getIntrinsicHeight();
int intrinsicWidth = drawable.getIntrinsicWidth();
Log.i("@@@", "intrins:" + intrinsicHeight + " " + intrinsicWidth);
//height and width of the visible (scaled) image
int scaledHeight = imageBounds.height();
int scaledWidth = imageBounds.width();
Log.i("@@@", "bounds:" + scaledHeight + " " + scaledWidth);
//Find the ratio of the original image to the scaled image
//Should normally be equal unless a disproportionate scaling
//(e.g. fitXY) is used.
float heightRatio = intrinsicHeight / scaledHeight;
float widthRatio = intrinsicWidth / scaledWidth;
Log.i("@@@", "ratio:" + heightRatio + " " + widthRatio);
//do whatever magic to get your touch point
//MotionEvent event;
//get the distance from the left and top of the image bounds
float scaledImageOffsetX = event.getX() - imageBounds.left;
float scaledImageOffsetY = event.getY() - imageBounds.top;
分享到:
相关推荐
Android、Matrix、ImageView、Bitmap结合使用
android 动态旋转图片 Bitmap与Matrix旋转ImageView
Android开发之ImageView通过matrix实现两点缩放和图片拖动,内有较为详细的注释
android demo,imageview的使用的源代码
Android中ImageView实现平铺多张图片Android中实现平铺图片有两种方式:在drawable中定义平铺的Bitmap然后在ImageView中引
android 将Imageview 将view生成图片后保存到本地相册的实现生成图片后保存到本地相册的实现,android 将Imageview生成图片后保存到本地相册的实现 android 将Imageview生成图片后保存到本地相册的实现, 有需要的朋友...
Android源码——ImageView控件缩放和旋转图片源码.zip
android自定义ImageView实现旋转动画
android自定义ImageView,圆角和圆形,抗锯齿.亲测可用。直接拷贝代码就行。
(android控件) ImageView 控件开发效果总结 (多组滤镜效果)源码下载
Android ImageView点击选中后添加边框,详细内容可以到我的博客www.heimizhou.com中了解。
在Android中进行图像旋转需要使用Matrix,它包含了一个3*3的矩阵,专门用于进行图像变换匹配。Matrix ,中文里叫矩阵,高等数学里有介绍,在图像处理方面,主要是用于平面的缩放、平移、旋转等操作。Matrix没有机构...
android 简易圆角ImageView 自带在裁剪
安卓Android源码——imageView.rar
android自定义圆角imageView
android 自定义属性实现 ImageView 透明度渐变效果
ImageView 图片显示样式的几种类型。android:scaleType是控制图片如何resized/moved来匹对ImageView的size。
1.Android的自定义ImageView图标,可以根据自己的需要,设置圆形,椭圆形,长方形,正方形图标; 2.都是需要在导入jar包文件后在xml文件中引入<com.hongye.image.image.CircleImageView/> 圆形 ...
android 园形ImageView 可以描边,工程中使用,很方便。
Android源码——ImageView图片循环跑马灯效果源码_new_08.7z