Drawing Tablet C++ API ?

Are there any C++ API's for dealing with pen tablets? Such as the XP-Pen Deco Pro Drawing Tablet ( https://www.xp-pen.com ) ?

For instance if I wanted to access the pen and properties such as how much pressure is being applied to the pen, or where on the tablet it is writing. I know that the drivers that come with the tablets usually make windows think it is a mouse, but I have not found a way to access a few properties, such as the 'pressure' being applied to the end of a pen.

Is there a generic API for doing this for all graphics tablets?
Last edited on
Windows? RealTimeStylus is what you are looking for.

This shows an example using
https://backworlds.com/under-pressure/
Hi, I don't have the product in your post, but in Windows many drawing tablets use WinTab. My tablet uses WinTab, but not every tablet does, so YMMV.
According to https://images-eu.ssl-images-amazon.com/images/I/C156VCpfzUS.pdf your model family also uses Wintab, so this is most likely what you need.

Wacom does provide WinTab examples, and I've had some luck with Japanese documentation webpage archives.
https://developer-docs.wacom.com/display/DevDocs/Windows+Wintab+Documentation
https://developer-docs.wacom.com/display/DevDocs/Wintab+Sample+Code+Downloads
(Note: You don't need a Wacom tablet to get the examples to work, but they do require WinTab-compatible drivers AFAIK)

Check out the pressure test example. I actually have a C++ program that should be able to detect tablet pressure, if it's using WinTab, but not with me right now. If you can't get Wacom's C++ to compile (it's a bit dated), I can try to make a minimal example for you later.

________________________________________

poteto's link for RTS sounds like it might be the more modern solution, but if you can't get that to work, then fall back on Wintab.

My guess is that if you want to support the most devices possible on Windows, you will need both Wintab and RTS interfaces. I haven't used RTS, but I thank poteto for the link because that might be what my friend's tablet uses, which would explain why I couldn't get my program to work with his tablet.

________________________________________

If not Windows, you're going to need to search harder. I suggest poking around open-source projects that can interact with drawing tablet drivers, maybe Krita or Inkscape? [Qt in Krita has its own tablet API]

Edit: It looks like Wacom also provides helpful documentation for Mac, but I don't have a Mac so I can't verify this.
https://developer-docs.wacom.com/display/DevDocs/macOS+Developer%27s+Guide+to+the+Wacom+Tablet
Tablets are full-fledged citizens in MacOS X with their own events defined in CarbonEvents.h. This makes it easy to implement most of the features of the tablet without having to worry about opening / attaching to a driver. Normally, these tablet events are embedded inside of mouse events. Thus, all you have to do is to check if the mouse event has tablet data associated with it. If so, use it. If not, then the user is using a mouse and not a tablet device.

...that paragraph alone makes me want to use a mac.
Last edited on
Topic archived. No new replies allowed.