FastTouch 0.1.0 [ALPHA-2026-05-23] β Ultra-Fast Native Windows Touchscreen & Multi-Touch Engine for Java
β‘ High-speed Win32 WM_POINTER multi-touch digitizer interception, pressure tracking, and contact bounding-box geometry for Java.
FastTouch provides hardware-level touchscreen and multi-touch digitizer access directly from the Win32 Pointer API (WM_POINTER), bypassing the single-cursor mouse emulation limitations of standard AWT and Swing. Track 10+ simultaneous fingers, variable pressure force (0..255), and exact physical contact patch dimensions with minimal latency.
import fasttouch.FastTouch;
import javax.swing.JFrame;
public class Demo {
public static void main(String[] args) {
JFrame frame = new JFrame("FastTouch Demo");
frame.setSize(1280, 800);
frame.setVisible(true);
// 1. Initialize native touch interception on the target window
FastTouch touch = FastTouch.create(frame);
// 2. Add high-rate multi-touch listener
touch.addListener(point -> {
System.out.printf("[TOUCH] ID=%d Pos=(%d,%d) Pressure=%d Size=%dx%d Phase=%s\n",
point.id, point.x, point.y, point.pressure, point.width, point.height, point.state);
});
// 3. Start background polling thread (~120 Hz)
touch.start();
}
}- Quick Start
- Why FastTouch?
- Key Features
- Real-World Use Cases
- Performance Benchmarks
- API Quick Reference
- Technical Demos & Benchmarks
- Installation
- Documentation
- Platform Support
- Related Projects
- License
Standard Java input subsystems (AWT MouseListener, JavaFX, Swing) fundamentally treat touchscreens as simulated single-point mouse cursors:
- Single-Cursor Emulation: Standard AWT collapses multiple finger touches into a single cursor, discarding all concurrent multi-touch points and gestures.
- Missing Contact Geometry: Physical force levels (
0..255) and contact area bounding boxes (widthΓheight) are completely lost in pure Java. - Event Queue Latency: Synthesized mouse events are queued through the Event Dispatch Thread (EDT), creating noticeable tactile lag during rapid multi-finger gestures.
- Complex External Daemons: Alternative solutions rely on external TUIO daemons or legacy
WM_TOUCHwrappers that suffer from socket jitter and dropped events.
FastTouch bridges directly to the modern Win32 WM_POINTER subsystem:
- Simultaneous Multi-Touch: Distinguishes 10+ independent physical touch contacts simultaneously with unique pointer IDs.
- Hardware Force & Contact Geometry: Provides true normalized pressure (
0..255) and contact patch pixel dimensions (widthΓheight). - Low-Latency Polling Pipeline: Native window subclassing captures pointer messages before the standard Java window procedure.
- Zero-GC Polling: High-speed circular event structures eliminate memory churn during continuous 120 Hz gesture streams.
| Feature | Java AWT / Swing | Legacy TUIO / WM_TOUCH Wrappers | FastTouch |
|---|---|---|---|
| Multi-Touch Contacts | Single cursor emulation | 2β5 points (Driver dependent) | 10+ simultaneous points |
| Input Subsystem | Synthesized WM_MOUSEMOVE |
Legacy WM_TOUCH / UDP socket |
Native Win32 WM_POINTER |
| Pressure Tracking | β None (Binary 0/1) | β Normalized 0β255 pressure force | |
| Contact Geometry | β Lost (Single coordinate) | β
Exact bounding box (width Γ height) |
|
| Dispatch Latency | 15β30 ms (EDT queue lag) | 5β15 ms (Network/socket lag) | < 0.1 ms (Direct subclassing) |
| Event Pipeline Overhead | High EDT event churn | Network daemon overhead | Zero GC allocations in loop |
- ποΈ True Multi-Touch Interception β Track 10+ concurrent fingers with individual touch IDs.
- π― Pressure Sensitivity β Normalized 0β255 contact pressure force directly from the digitizer driver.
- π Contact Geometry β Real physical width and height bounding boxes per touch point.
- β‘ Native Win32 WM_POINTER Hook β Fast, direct Windows 8/10/11 pointer pipeline.
- π¦ Zero-Copy Native Pipeline β Minimized JNI overhead and zero GC pressure in the event loop.
- π¨ Digital Whiteboards & Canvas Apps: Multi-finger drawing, simultaneous collaborative markup, and pressure-sensitive sketching.
- π± Interactive Kiosk & POS Terminals: Responsive multi-touch navigation, pinch-to-zoom, and multi-user kiosks.
- ποΈ Audio & DJ Control Surfaces: Multi-slider and multi-dial tactile touch controllers requiring concurrent multi-point tracking.
- π€ Touch Telemetry & Automation: High-rate gesture and touch telemetry capture for automated UI testing and recording.
FastTouch is measured using JMH (Java Microbenchmark Harness) to ensure zero-overhead event processing:
| Benchmark / Operation | Score (ops/ms) | Ops per Second |
|---|---|---|
benchmarkTouchPointAllocation |
~18,200 ops/ms | > 18.2 Million |
benchmarkTouchPointFormatting |
~1,450 ops/ms | > 1.45 Million |
| Native Polling Loop Rate | ~120 Hz | Smooth Real-time Tracking |
Measured on Windows 11 (x64), JDK 17+.
| Method | Return Type | Description | Docs |
|---|---|---|---|
FastTouch.create(frame) |
FastTouch |
Resolves window HWND and installs native WM_POINTER subclass hook. |
Reference |
addListener(listener) |
void |
Registers a callback for real-time touch point dispatch. | Reference |
removeListener(listener) |
void |
Unregisters a previously registered touch listener. | Reference |
start() |
void |
Launches the dedicated background touch polling thread (~120 Hz). | Reference |
stop() |
void |
Halts the background touch polling loop. | Reference |
poll() |
void |
Executes a single polling iteration and dispatches touch events. | Reference |
FastTouch.isTouchAvailable() |
boolean |
Queries if a physical touchscreen or multi-touch digitizer is present. | Reference |
FastTouch.getMaxTouchPoints() |
int |
Returns maximum simultaneous touch points supported by hardware. | Reference |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Interactive Multi-Touch Canvas | Demo.java | run-demo.bat |
Real-time multi-touch visualization displaying contact rings, pressure levels, and coordinates. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
Microbenchmark suite profiling touch point allocation and formatting throughput. |
Add the JitPack repository and the dependency to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- FastTouch Library -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastTouch</artifactId>
<version>0.1.0</version>
</dependency>
<!-- Required Native JNI loader -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastCore</artifactId>
<version>0.1.0</version>
</dependency>
</dependencies>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.andrestubbe:FastTouch:0.1.0'
implementation 'com.github.andrestubbe:FastCore:0.1.0'
}Download the latest JARs directly to add them to your classpath:
- π¦ FastTouch-0.1.0.jar (The Core Library with embedded native DLL)
- βοΈ fastcore-0.1.0.jar (The Mandatory Native Loader)
Important
All JARs must be in your classpath for the JNI calls to function correctly.
- COMPILE.md: Full compilation guide (MSVC C++17 build chain + JNI Setup).
- REFERENCE.md: Comprehensive API specification, contact point fields, and hook lifecycle.
- PHILOSOPHY.md: The engineering rationale for hardware-native touch interception.
- ROADMAP.md: Planned milestone features and performance extensions.
- CHANGELOG.md: Complete version history and release notes.
| Platform | Architecture | Status | Driver / Subsystem |
|---|---|---|---|
| Windows 10 / 11 | x64 | β Fully Supported | Native Win32 WM_POINTER Subsystem |
| Linux | x64 / AArch64 | π§ Planned | libinput / evdev Multi-Touch Slots |
| macOS | Apple Silicon / x64 | π§ Planned | NSEvent & MultitouchSupport Framework |
FastCoreβ Native Library Loader & JNI Utilities for JavaFastStylusβ Native Pen & Stylus Pressure API for JavaFastMouseβ Ultra-Low Latency Native RawInput Mouse EngineFastKeyboardβ Ultra-Fast Native RawInput Keyboard EngineFastHotkeyβ Low-Latency Global Hotkey API for JavaFastVulkanβ High-Performance Native Vulkan 2D Rendering Engine
MIT License β See LICENSE file for details.
Part of the FastJava Ecosystem β Making the JVM faster. π
