๐ค The high-performance alternative to java.awt.Robot โ sub-millisecond native input injection, microsecond pixel probing, and zero-allocation FastImage & FastScreen bridge.
FastRobot is the native automation, input injection, and bot-control substrate of the FastJava ecosystem. Where standard Java Robot introduces severe AWT Event Dispatch Thread (EDT) jitter, slow synchronous GDI locks, and garbage collection stalls, FastRobot communicates directly with the Windows OS input subsystem via native Win32 SendInput.
For vision-guided automation, FastRobot seamlessly bridges with FastImage for zero-allocation SIMD image processing and partners with FastScreenโthe dedicated 240โ2000 FPS DirectX DXGI desktop duplication engineโto provide a complete, ultra-fast robotics and automation stack.
import fastrobot.FastRobot;
import fastimage.FastImage;
import java.awt.Rectangle;
public class Demo {
public static void main(String[] args) {
FastRobot robot = new FastRobot();
// 1. Direct Low-Latency Mouse Movement & Click (bypasses AWT EDT queue)
robot.mouseMove(500, 300);
robot.mousePress(1); // Left Button Down
robot.mouseRelease(1); // Left Button Up
// 2. Ultra-Fast Single Pixel Color Probe (direct Win32 GetPixel without screen dumps)
int rgb = robot.getPixelColor(100, 100);
System.out.printf("Pixel at (100, 100) RGB: #%06X%n", (rgb & 0xFFFFFF));
// 3. FastImage Bridge: Capture directly to off-heap SIMD image (zero heap GC)
FastImage targetArea = robot.captureImage(0, 0, 400, 300);
if (targetArea != null) {
System.out.println("Captured FastImage bounds: " + targetArea.getWidth() + "x" + targetArea.getHeight());
targetArea.dispose();
}
// NOTE: For dedicated 240-2000 FPS desktop streaming with DXGI hardware acceleration,
// use FastRobot's companion module: FastScreen!
}
}- Why FastRobot?
- Ecosystem Architecture (FastRobot + FastScreen + FastImage)
- Quick Start
- Key Features
- Real-World Use Cases
- Performance Benchmarks
- API Quick Reference
- Technical Demos & Benchmarks
- Installation
- Documentation
- Platform Support
- License
- Related Projects
Standard Java java.awt.Robot was designed in the late 1990s and has severe limitations for modern robotics, high-FPS automation, and vision applications:
- AWT Event Queue Bottlenecks: Input events (
mouseMove,keyPress) are dispatched through the AWT Event Dispatch Thread (EDT) and OS message queues with noticeable latency (5โ15 ms jitter). - Massive GC Stalls on Screen Dumps:
createScreenCapture()copies GDI bitmaps onto the Java heap (~8 MB per 1080p frame), triggering frequent Garbage Collection pauses that freeze automation loops. - No Direct Hardware Injection: AWT lacks direct Win32
SendInputhardware simulation, leading to dropped or desynchronized inputs in fast-paced scenarios.
FastRobot redefines Java automation by focusing on what matters:
- Sub-Millisecond Input Latency: Direct native Win32
SendInputcalls bypass the JVM AWT event queue entirely (<0.1 ms execution). - FastImage Ecosystem Bridge: Native screen captures can be delivered directly into off-heap
FastImagebuffers (captureImage(),getFrameImage()) with zero heap churn. - Microsecond Color Probing:
getPixelColor()queries screen pixels up to 2ร faster than AWT Robot without locking or copying full screen surfaces. - Clean Decoupling with FastScreen: While FastRobot provides built-in GDI capture convenience, high-throughput DirectX 11 / DXGI Desktop Duplication (240โ2000 FPS) is delegated to FastScreen, giving you the fastest possible screen-reading pipeline in the JVM.
FastRobot works harmoniously with the FastJava perception and manipulation modules:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Autonomous Bot / Vision Agent โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโ
โ 1. Decision & Input Actions โ 2. Visual Feedback
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastRobot โ โ FastScreen โ
โ โข Win32 SendInput (<0.1ms) โ โ โข DXGI 1.2 Desktop Dup โ
โ โข Instant getPixelColor() โ โ โข 240โ2000 FPS Zero-Copy โ
โ โข Mouse / Keyboard Injection โ โ โข Window Mirror Exclusion โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโ
โ โ Native Frame Addr
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Windows OS Subsystem โ โ FastImage โ
โ (Hardware Input / Message) โ โ โข SIMD Resizing & Filtering โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ โข Zero-GC Off-Heap Container โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- โก Ultra-Low Latency Input โ Direct Win32
SendInputmouse and keyboard injection (<0.1 ms latency). - ๐ผ๏ธ FastImage Bridge โ Capture directly into off-heap
FastImageinstances (captureImage(),getFrameImage()) with zero JVM heap churn. - ๐ฏ High-Speed Pixel Probing โ Blazing fast
getPixelColor(x, y)running at >27,000 queries/second. - ๐ฅ๏ธ Integrated Screen Convenience โ Built-in fast region capture for lightweight checks; seamlessly links with
FastScreenfor continuous 240+ FPS streams. - ๐ Zero GC Stalls โ Avoids Java heap allocations in hot automation paths.
- ๐ FastCore Integration โ Automated zero-dependency native DLL extraction and loading.
- ๐ค Autonomous RPA & Desktop Agents: Drive desktop automation with sub-millisecond mouse and keyboard responsiveness.
- ๐ฎ Game Bots & Vision-Guided AI: Process screen state via
FastScreen/FastImageand inject precision inputs viaFastRobotwithout detection jitter. - ๐งช High-Speed UI Regression Testing: Accelerate massive GUI test suites by cutting out AWT event queue delays.
- ๐๏ธ Instant Color & State Verification: Poll UI elements and trigger buttons using native
getPixelColor()at over 27,000 checks/sec.
Measured on official JMH Benchmark (Throughput in ops/ms):
Benchmark Mode Cnt Score Error Units
Benchmark.benchmarkFastRobotGetPixelColor thrpt 3 27.021 ops/ms
Benchmark.benchmarkAwtRobotGetPixelColor thrpt 3 13.973 ops/ms
Benchmark.benchmarkFastRobotGetMousePosition thrpt 3 2218.287 ops/ms
Benchmark.benchmarkFastRobotScreenDimensions thrpt 3 18872.366 ops/ms
Note
Environment & Setup: Measured on Windows 11 (x64), JDK 21. FastRobot.getPixelColor runs at ~27,000 queries/sec, roughly 93% faster than java.awt.Robot (13,973 ops/ms), while cursor position tracking achieves over 2.2 million queries/sec.
| Method | Return Type | Description | Docs |
|---|---|---|---|
mouseMove(x, y) |
void |
Moves mouse cursor via native SendInput. |
Reference |
mousePress(btn) / mouseRelease(btn) |
void |
Injects mouse button click events. | Reference |
keyPress(code) / keyRelease(code) |
void |
Injects keyboard scancodes. | Reference |
getPixelColor(x, y) |
int |
High-speed single pixel RGB query without full screen capture. | Reference |
captureImage(rect) |
FastImage |
FastImage Bridge: Capture region directly to off-heap FastImage. |
Reference |
captureImage(x, y, w, h) |
FastImage |
FastImage Bridge: Capture with primitive coordinates to FastImage. |
Reference |
getFrameImage() |
FastImage |
FastImage Bridge: Wraps streaming frame into FastImage. |
Reference |
createScreenCapture(rect) |
BufferedImage |
Native screen capture to standard BufferedImage. |
Reference |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Interactive Desktop Stream | Demo.java | run-demo.bat |
Real-time high-FPS streaming desktop view and automation harness. |
| JMH Microbenchmark Suite | Benchmark.java | run-benchmark.bat |
Microbenchmark suite measuring pixel color query throughput vs java.awt.Robot. |
Add the JitPack repository and the dependencies to your pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- FastRobot - Low-Latency Native Input & Bot Automation -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastRobot</artifactId>
<version>0.1.1</version>
</dependency>
<!-- FastScreen - Dedicated High-FPS DXGI Screen Capture Engine (Optional / Companion) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastScreen</artifactId>
<version>0.1.4</version>
</dependency>
<!-- FastImage - Zero-Copy Frame Container & SIMD Processing -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>FastImage</artifactId>
<version>0.1.2</version>
</dependency>
<!-- FastCore - Required Native 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:FastRobot:0.1.1'
implementation 'com.github.andrestubbe:FastScreen:0.1.4'
implementation 'com.github.andrestubbe:FastImage:0.1.2'
implementation 'com.github.andrestubbe:FastCore:0.1.0'
}Download the latest JARs directly to add them to your classpath:
- ๐ฆ FastRobot-0.1.1.jar (The Core Automation Library)
- ๐ฅ๏ธ FastScreen-0.1.4.jar (Dedicated 240โ2000 FPS Screen Capture)
- โก FastImage-0.1.2.jar (The SIMD Image Engine)
- โ๏ธ FastCore-0.1.0.jar (The Mandatory Native Loader)
- COMPILE.md: Full compilation guide (MSVC C++17 build chain + JNI Setup).
- REFERENCE.md: Comprehensive API specification, robotics control, and pixel capture methods.
- PHILOSOPHY.md: The engineering rationale for zero-allocation automation performance.
- 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 SendInput & DXGI Desktop Duplication |
| Linux | x64 / AArch64 | ๐ง Planned | uinput / XTest & PipeWire / Wayland Portal |
| macOS | Apple Silicon / x64 | ๐ง Planned | CGEventCreate & ScreenCaptureKit / CoreGraphics |
MIT License โ See LICENSE file for details.
FastCoreโ Native Library Loader & JNI Utilities for JavaFastScreenโ High-Performance Native DXGI Screen Capture for Java (240โ2000 FPS)FastImageโ Ultra-Fast Native SIMD Image Processing for JavaFastMouseโ Ultra-Low Latency Native RawInput Mouse EngineFastKeyboardโ Ultra-Fast Native RawInput Keyboard EngineFastHotkeyโ Low-Latency Global Hotkey API for JavaFastOCRโ Ultra-Fast Native OCR for Java
Part of the FastJava Ecosystem โ Making the JVM faster. ๐
