Jump to content

Tablet eraser tool support in MacOS

Recommended Posts

In Affinity Photo, I noticed the eraser feature of the tablets are not supported (compared to Photoshop).
I've tried to look in the tool parameters and preference interfaces but it seems there is no UI to enable that.

Here is the stream of events the tablet is sending (simplified):

  • Pen gets close enough from the tablet: mouse proximity (on, tool = pen or eraser)
  • Pen moves/touches the tablet: mouse/tablet events with position, pressure etc...
  • Pen leaves the tablet proximity: mouse proximity (off)

Here is an excerpt of the code for sending this proximity event that works with Photoshop:

void MouseProximity(CGPoint position, BOOL eraser, BOOL proximity) {
  CGEventRef event = CGEventCreateMouseEvent(nil, kCGEventMouseMoved, position, kCGMouseButtonLeft);
  CGEventSetType(event, kCGEventTabletProximity);
  CGEventSetIntegerValueField(event, kCGTabletProximityEventPointerType, eraser ? NSPointingDeviceTypeEraser : NSPointingDeviceTypePen);
  CGEventSetIntegerValueField(event, kCGTabletProximityEventEnterProximity, proximity);
  CGEventPost(kCGHIDEventTap, event);

It would be great if this could be integrated in Affinity Photo (and Designer if it makes sense).

Thanks for having a look and keep up with the good work :)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now