Touch writing delay, is a very core parameter of the touch screen. From the user in the touch screen touch operation to the equipment to respond to the time difference between the delay will affect the rapid response to the application of the scene use such as whiteboard writing, playing games.
The main factors affecting touch latency are: touch frame reporting rate, software framework delay (for touch data reception, thread switching), and software business logic processing.
Here we introduce the touch frame report rate Touch Report Rate, the number of times per second the touch screen reports touch data (Hz), will vary according to the type of equipment
Touch operation TouchMove (StylusMove) is timed to report once and will report 1-N points at a time.
1 private void MainWindow_OnStylusMove(object sender, StylusEventArgs e) 2 { 3 var currentPointsCount = (this).Count; 4 }
Different screen timer touch reporting time is different, we can collect through the Stylus event to see
1 private void MainWindow_OnStylusDown(object sender, StylusDownEventArgs e) 2 { 3 _stylusDown = true; 4 _startTick = ; 5 _stylusEntryCount++; 6 _distinctPoints.AddRange((this).Distinct()); 7 } 8 9 private void MainWindow_OnStylusMove(object sender, StylusEventArgs e) 10 { 11 if (!_stylusDown) 12 { 13 return; 14 } 15 _stylusEntryCount++; 16 _distinctPoints.AddRange((this).Distinct()); 17 }
Enter the average interval: var stylusEntryTime = ( - _startTick) / (double)_stylusEntryCount
Dell Touch Screen
I am used daily to develop touch screens for the development of intermodulation of touch-related functions.Touch Data for Dell Touchscreen Dell-P2418HT 1080P:
1. WPF applies StylusMove input and gets an interval of 33ms, i.e. 30 frames
2. One input contains 1-7 points
3. The average interval between further points is 16.7 ms -- this data is also meaningful and can be used to assess the performance improvement that can be achieved by writing a similar prediction of 1 point.
Using BusHold, let's look at the real point input interval:
BusHold 4th column data, 01 is the Down/Move event, 00 is the end of the Up operation. We see that the Move operation input interval is basically 16-17ms, indicating that the real reporting interval of the touch frame is about 17ms, i.e. 60 frames.
Above WPF listens to Stylus event and gets the touch operation input interval is 33ms. why the touch data frame rate that the application layer gets is lower than the touch frame?
Let's try StylusPlugin (StylusPlugin program can get touch data in advance, can be used for touch writing acceleration program, enhancement) to take the touch of the touch thread touch data, as well as WPF routing touch event data comparison:
Same 7 points as BusHold.
Touch Thread EventsIt's just that the 2 points are merged into a single touch input event. So the merging of these 2 points is not handled within the routing event, nor by the WPF framework, but in the Windows Input Manager which is limited to 30 frames depending on the hardware configuration, reducing the number of events passed to the application.
UI Routing EventsIf we look at the console output above, the Move event reports an input event about 30ms apart, and there are 4 points in the last Move event. Here 4 points of input, merged 1 + 2 + 1 above the touch thread event of the three input, so WPF routing event management also has a queue of touch messages, will merge touch points
So is it possible to reduce the merging of touch data and keep a consistent frame rate with the touch box? The answer is yes, you can turn on Point messages in WPF as in UWP:
1 public partial class App : Application 2 { 3 public App() 4 { 5 ("", true); 6 } 7 }
After adding EnablePointerSupport, we listen to the TouchMove event:
The touch movement event trigger interval is then reduced by 16-17ms, to the same frame rate as the touch box reporting rate, GOOD!
Open Pointer more content can be seen in the blog of Duchess MVP!How to enable support for Pointer messages in WPF dotnet core ()But there are a lot of pitfalls to turning on Pointers as wellPitfalls with WPF Open Pointer messages ()Use caution, everyone.
large touch screen
Look again.Currently on the market interactive touch screen used by Futron, Hua Xin mainstream touch frame productsRoute touch data:
The input interval is about 15.6ms, and the average interval between touch points is about 7ms, i.e., more than 140 frames of touch frame reporting points and 60 frames of application layer touch data.
Recently there have beenAn improved version of the Fulton Touch G-frame, we also collect data down by the app side:
The input interval is also about 15.6ms, and the average interval between touch points is 4.5ms, that is, the touch frame reports about 220 frames, and the application layer touch data is still 60 frames. It means that this touch frame improves its own reporting rate, but the application layer limits the touch reporting to 60 frames according to the hardware conditions.
The touch data frame rate limit here is related to the screen refresh rate, generally the screen refresh rate is 60Hz.
In short, understanding the touch reporting rate is the only way to really go about getting the writing performance as well as the writing smoothing piece right.