iPhone触摸形状或原始数据 [英] iphone touch shape or raw data
问题描述
有人知道是否还可以检测触摸形状吗?也许通过获取原始的触摸屏数据?
Anyone know if it is yet possible to detect the touch shape? Maybe through getting the raw touchscreen data?
我在这里找到了这个问题/答案:如何获取原始触摸屏数据?
I found this question/answer here: How to get raw touchscreen data?
上面提到了GSEvent,但是它已经很老了。
That mentions GSEvent, but it is quite old.
我想尝试通过形状/区域来粗略计算触摸的压力,但是UITouch当然只给出一个计算点。
I'd like to try to get a rough calculation of the pressure of the touch by its shape/area, but of course UITouch only gives a calculated point.
推荐答案
是的,原始触摸数据包含在 GSEventRecord
对象中,特别是您正在寻找的是 GSPathInfo
上的 pathMajorRadius
属性,该属性可提供主要半径。这是对压力的粗略估算,但要考虑到大/小手指也要采取不同的措施。
Yes, raw touch data is contained in the GSEventRecord
object, particularly what you are looking for is the pathMajorRadius
property on GSPathInfo
, which gives the major radious on the tap. This is a rough estimate of the pressure, but take into account big/small fingers give also different measures.
请注意 pathPressure
GSPathInfo
中的code>属性也不包含压力。它始终包含1个电容式屏幕(例如iPad或iPhone)根本无法测量压力。
Watch out for the pathPressure
property also in GSPathInfo
, it does NOT contain the pressure. It always contains 1, capacitive screens (like the iPad's or IPhone's) do not measure pressure at all.
如果您打算在应用商店中提交应用,您将赢得如果您包括对私有框架的访问权限(例如在这种情况下, GraphicServices $ c $中的
GSEvent.h
c>框架)。但是您需要做的是捕获子类 UIApplication的
,然后使用 sendEvent
方法中的每个 UIEvent
https://github.com/kennytm/iphone-private-frameworks/blob/master/GraphicsServices/GSEvent.h
来获取GSEvent的信息。
If you are planning submitting your app in the app store, you won't be able to do it if you include access to private frameworks (like in this case, GSEvent.h
in the GraphicServices
framework). But what you need to do is catch every UIEvent
in the sendEvent
method of your subclassed UIApplication
, then use the methods in
https://github.com/kennytm/iphone-private-frameworks/blob/master/GraphicsServices/GSEvent.h
to get the information of the GSEvent.
这篇关于iPhone触摸形状或原始数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!