Injection Pressure Values ​​in Windows

I am creating an application in which a user can use their Android tablet as a graphic tablet, for example https://play.google.com/store/search?q=gfxtablet

My server program is in Java, and I was able to send stylus coordinates and pressure values ​​to the server from my tablet via UDP and is able to draw applications like Paint, Photoshop, etc.

Problem:

I can not find a way to enter these pressure values ​​in Windows (draw thick and thin lines depending on the pressure of the stylus). I know that this can easily be done on Linux, but I cannot find a way for Windows.

I even tried the JNA library for Java, but it also does not have a suitable method for entering pressure values. I know that there are JPEN and JTABLET libraries, but they do not allow you to paint Paint, Photoshop, GIMP, etc.

+6
source share
1 answer

You can try using the Robot class in java to simulate input events of the source system. Then store local variables to verify input and trigger these events through the Robot class.

Basically, for Windows Paint, when your pressure is greater than the previous pressure, fire the Robot event, which sends the CTRL and + keys to increase the width of the brush.

If you also check which application is open, you can create a separate section of code to determine which key combination to send (because keybind has [and] in Photoshop) or there is a section that allows you to specify what their binding is.

While the current iteration uses awt, the Robot is added to JavaFX / Lombard in version 3.0.

I am sure there are better solutions, but this is what I would do until I did something better. :)

0
source

All Articles