在Android层实现触摸屏校验
2010-05-31 14:35:00 来源:WEB开发网Log.i("XXW prop", prop);
Log.i("XXW", "prop.equalsIgnoreCase done");
readCalibrate();
SystemProperties.set("ts.config.calibrate", "end");
}else{
Log.i("XXW prop", prop);
Log.i("XXW", "prop.equalsIgnoreCase else");
}
//edit ends
float scaledX = x;
float scaledY = y;
float temp;
float scaledPressure = 1.0f;
float scaledSize = 0;
int edgeFlags = 0;
if (isAbs) {
int w = display.getWidth()-1;
int h = display.getHeight()-1;
if (orientation == Surface.ROTATION_90
|| orientation == Surface.ROTATION_270) {
int tmp = w;
w = h;
h = tmp;
}
if (device.absX != null) {
//once edit
if (device.tInfo != null){
scaledX = (device.tInfo.x1 * x + device.tInfo.y1 * y + device.tInfo.z1)/ device.tInfo.s;
Log.i("XXW","x: "+x);
Log.i("XXW","trans x: "+scaledX);
}
else
//edit ends
scaledX = ((scaledX-device.absX.minValue)
/ device.absX.range) * w;
}
if (device.absY != null) {
//once edit
if (device.tInfo != null){
scaledY = (device.tInfo.x2 * x + device.tInfo.y2 * y + device.tInfo.z2) / device.tInfo.s;
Log.i("XXW","y: "+y);
Log.i("XXW","trans y: "+scaledY);
}
else
//edit ends
scaledY = ((scaledY-device.absY.minValue)
/ device.absY.range) * h;
}
if (device.absPressure != null) {
scaledPressure =
((pressure-device.absPressure.minValue)
/ (float)device.absPressure.range);
}
if (device.absSize != null) {
scaledSize =
((size-device.absSize.minValue)
更多精彩
赞助商链接