Windows Ink or Wacom Stylus Support

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Windows Ink or Wacom Stylus Support

Andre Stubbe
Hello Folks,

It seems that MouseEvent.PointerType.Pen is currently only available for Android. Are there any plans to integrate support for Windows Ink or Wacom stylus features, such as pressure sensitivity, tilt, rotation, and the use of three buttons, into NEWT?

I haven’t checked the Wacom API yet, but I know it exists. I'll experiment with it soon.

I’ve found several generic APIs for Java, like lectureStudio/stylus and JPen, but none of them have worked so far.

Cheers,
Andre
I am a Robot
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

gouessej
Administrator
Hello

In my humble opinion, use Windows Touch Gestures API rather than Wacom API so that it just works with other manufacturers too. Feel free to contribute, this isn't a trivial task.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

Andre Stubbe
Thanks, this is going to be a horror show. I’ll contribute if I succeed.
I am a Robot
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

gouessej
Administrator
I advise you to try to use the API with something easy to use  at a first step, JNA or java.lang.foreign. Then, look at the way events are managed in NEWT under Windows and replicate the logic of your blueprint in NEWT this time.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

Andre Stubbe
Thanks! I really envy your knowledge. The thought of needing to learn JNA and C#/C++ gives me chills. Brrrr…
I am a Robot
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

gouessej
Administrator
That's why I suggest to use java.lang.foreign but I admit that it's still not trivial, it helps not to have to write in C/C++.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

Andre Stubbe
I am currently experimenting with Windows Ink in C++. Thanks to a bot, I have gotten the values. Now I wonder if I can use the NEWT MouseEvents while transferring the pressure, tilt, and rotation from a JNA library to Java by using the same screen space. I’m still not there. Soon, I’ll give it a longer try.
I am a Robot
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

gouessej
Administrator
Why would you prefer JNA over java.lang.foreign?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

Andre Stubbe
Good question. i dont know. i'll try both. It is a jungle, any weapon will do. I just need that. in c# or c++ it works fine so far. (Windows SDK10). i am not smart enough yet to judge thouse bridges. If foreign does it, could not get it yet ... , ill take that with a kiss hand.
I am a Robot
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

Andre Stubbe
This post was updated on .
Tried JNA first, had some trouble.... chatbot helped. Worked on foreign afterwards, bot again, needed JDK21 or higher. None of both worked so far, i have got the connection but no values that represent pressure yet. ill check JNI too. :( Analysing https://github.com/lectureStudio/stylus . i'll need that to complete my brush in an illustration software. Help!



I am a Robot
Reply | Threaded
Open this post in threaded view
|

Re: Windows Ink or Wacom Stylus Support

Andre Stubbe
This post was updated on .
In reply to this post by gouessej
Hello everyone,

after quite a while of experimenting I finally have stylus input working on Windows.
I’m using JNI for the native event access (mainly for speed and full pen‑data support).

If anyone wants to look into it or test it for their own projects, the code is available on GitHub. It currently provides pressure, tilt, rotation and related metadata:

https://github.com/andrestubbe/FastStylus

Important note:
I could only test this on a Surface Pro 8 together with a Wacom Bamboo Ink stylus, since I don’t have access to other devices. So feedback from different hardware would be very welcome.

I’m also preparing a small demo to visualize the data.
I haven’t tested it with NEWT yet, but that’s planned.

If anyone has experience integrating stylus events into JOGL, I’d be interested in your insights.

Finally happy again! (Das tat voll weh.)
I am a Robot