[PATCH v3 wayland-protocols] Add the tablet protocol

Jason Gerecke killertofu at gmail.com
Tue Feb 2 22:37:51 UTC 2016


On Tue, Feb 2, 2016 at 1:12 PM, Bill Spitzak <spitzak at gmail.com> wrote:
>
>
> On Mon, Feb 1, 2016 at 6:38 PM, Jason Gerecke <killertofu at gmail.com> wrote:
>>
>>
>> Ultimately, the tilt information is almost universally used by
>> applications to set brush orientation. To do that, you have to use
>> some trig to transform the X and Y tilt values into something like
>> Alt-Az form. Tilt on a scale of 0-1 is fine for calculating the
>> azimuth, but you can't calculate the altitude angle without knowing
>> what 100% physically corresponds to. You can guess (e.g. assume it
>> corresponds to the reasonable physical limit of +-90 degrees), get a
>> horribly wrong answer (since the hardware limit is actually +-64
>> degrees), and then either ignore the discrepancy or fudge other bits
>> of the brush engine to not do nonsensical things. Actually, to be
>> fair, that's exactly how GIMP does things right now :P
>
>
> I think a lot of software treats the tilt information as actually the
> position of a point some distance up the pen relative to the tip. I would

That's certainly true for GIMP and Krita at least (see [1] and [2]).
Its incorrect, but its "close enough" that nobody seems to complain
(though I've been tempted to in the past ;))

> guess the hardware produces this directly (by reusing the proximity hardware
> for a different point higher up in the pen). To get a projection of the pen
> onto the tablet surface, these values can be fed to atan2.
>
> If they were actual angles, they must be the angle of the projection of the
> pen onto the two vertical planes of the x and y axis. This is really noisy
> when the pen is near one of the axis, and I would think the hardware/driver
> could not produce this except by calculating atan2 of a more linear value.
>
> Therefore I would be very suspicious of any claim that the values being
> produced are angles. The current api reporting them as normalized values
> seems better.
>

I've been down this road before a few years back. Does the hardware
measure and report true angles or does it measure a projection? If its
a projection, does it report them directly, or does it calculate
sin^-1 to transform it into an angle?

In the end, the specs from the firmware guys say to interpret the data
as measured in degrees, so that's what we do.

[1]: https://git.gnome.org/browse/gimp/tree/app/core/gimpdynamicsoutput.c#n548
[2]: https://github.com/KDE/krita/blob/master/libs/image/brushengine/kis_paint_information.cc#L507

Jason
---
Now instead of four in the eights place /
you’ve got three, ‘Cause you added one  /
(That is to say, eight) to the two,     /
But you can’t take seven from three,    /
So you look at the sixty-fours....


More information about the wayland-devel mailing list