Depending on which operating system or environment you are in there are different APIs. More here: Pen APIs.
PenInspector - https://github.com/borco/peninspector
XPPen Tablet SDK - https://www.xp-pen.com/developer
Huion SDK - Huion does not publish an SDK.
There are two conversations to be had:
Which API you as a normal user should be using in the tablet driver and in your applications
Which API you as a developer should use to create a pen-aware application on windows
By default I recommend you use Windows Ink unless something forces you to use WinTab. And if you use WinTab I suggest you only use it for a specific application.
Remember that in windows you have to configure windows ink in the driver AND in the application. These have to match settings. More here: Windows Ink
Wacom published a page with frequently asked questions about WinTab:
()
Here's a small snippet of the relevant section of the doc
Please read the document for the full details.
But here are a few things that stand out to me:
It is a well understood and stable API
There are wrappers or many languages (C#, Rust, Python) that let you talk to the APIs.
You can find many projects that use WinTab
It has been difficult for me to find clear examples of how to use the Windows Ink API. Most of the code is heavily focused on the inking features - which is great but not on what I need which is a way to get the pen position, pressure, tilt data, etc.
So at the moment, I intend to continue to use WinTab until I find an easy way to consume the Windows Ink APIs.
I had a relatively simple time incorporating it into my test drawing app called .
Windows Third-party: WinTab https://developer-support.wacom.com/hc/en-us/articles/12844524637975-Wintab This is the older but still heavily used API. Even though the API is defined by Wacom, other graphics tablet manufacturers use this same API. More here WinTab API.
Windows Built-in APIs (aka. Windows Ink)
WIN32 - GetPointerPenInfo
WPF - StylusPointProperties
UWP - PointerPointProperties
WinUI3 - UNKNOWN (As of Aug 2024 I do not think WINUI3 supports pens)
Windows resources:
Linux
GTK - GdkDevice
Qt - QTabletEvent
Web
Python
cgikit.wintab - As part of the Python Computer Graphics kit, the wintab module allows you to use Pyhon to get pen data via the WinTab interface.
.NET
WinTabControl - A demo app showing using the WinTabDN nuget package with a Windows application to show current poition pressure, tilt, etc. Uses .NET Framework 4.7.2
https://github.com/Apostolique/Apos.WintabDN - Uses .NET Standard 2.0
Windows
https://github.com/perlfu/WintabEmulator - drop-in replacement for WINTAB.DLL that emulates the WinTab API but uses Windows Ink under-the-covers
Rust
https://github.com/thehappycheese/wintab_lite - use WinTab API from Rust
Utilities
https://github.com/jchv/wintab-interposer - logs all WINTAB API calls
Sandbox apps
https://github.com/TheSevenPens/WinTabPainter - a primitive "paint" app to prototype and explore ideas for drawing tablets.
With the 7P Tablet Tester browser-based tool you can test out the basic features of your tablet. This is useful for troubleshooting.
Click this link to try the tool: 7P Tablet Tester
This tool collects no data, uses no cookies, and does not save your images.
Can draw with pen, mouse, and touch (if your tablet supports touch)
Pen drawing features
Pressure affects size of brush
Tilt - Not yet implemented
Show current numeric values for position, pressure, tilt, etc. - Not yet implemented
Save canvas as PNG file
Clear canvas
Windows
Pen API:
Needs Windows Ink to be enabled in the tablet driver.
If using WinTab, no pressure is supported.
Chrome - WORKS
Firefox - WORKS
MacOS
Safari - yet to be tested
Chrome - WORKS
Linux
Chrome - WORKS
Firefox
Wayland - WORKS
X11 -
use env MOZ_USE_XINPUT2=1 firefox
to make it work
more info on what's going on with the X11 issue:
iPadOS
Safari - WORKS
Android
Chrome - WORKS
The entire source code is on the github repo (https://github.com/TheSevenPens/HtmlTabletTester). I encourage you to look through it and fork and modify it for your needs.