vnc自适应屏的触摸,坐标计算
//服务器的纵横坐标比
float serverf = (float) getImageHeight() / (float) getImageWidth();
// float fh = (float)(getImageHeight() - (float)getWidth() /
// serverf) / 2f;
//客户端与服务器的横坐标比
float fsxx = (float) getWidth() /(float) getImageWidth();
//客户端与服务器的纵坐标比
float fsyy = (float) getHeight() /(float) getImageHeight();
// // 客户端的纵横坐标比
float clientf = (float) getHeight() / (float) getWidth();
//实际的纵坐标
float fy = getWidth() * serverf;
// 纵向空隙
float fffy = (getHeight() - fy) / 2f;
//实际的横坐标
float fx = getHeight() / serverf;
// 横向空隙
float fffx = (getWidth() - fx) / 2f;
//计算横纵坐标的实际位置,mouseX,mouseY为发到服务器的实际坐标触摸点
if (serverf > clientf) {
mouseX = (int) ((x - fffx) / fsyy);
mouseY = (int) (y / fsyy);
} else if (serverf < clientf) {
mouseX = (int) (x / fsxx);
mouseY = (int) ((y - fffy) / fsxx);
} else {
mouseX = (int) (x / fsxx);
mouseY = (int) (y / fsyy);
}