Bug 423778

Summary: Limited value range when painting with tangential pressure
Product: [Applications] krita Reporter: ollewellyn
Component: Tablets (tablet issues are only very rarely bugs in Krita!)Assignee: Krita Bugs <krita-bugs-null>
Status: REPORTED ---    
Severity: normal CC: tamtamy.tymona
Priority: NOR Keywords: triaged
Version First Reported In: 4.3.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description ollewellyn 2020-07-02 02:56:10 UTC
SUMMARY
The value range for tangential pressure is halved regardless of curve settings when painting with a Wacom Airbrush pen.

STEPS TO REPRODUCE
Enable tangential pressure for any brush option (hue, value, etc) and paint using the pen wheel.

OBSERVED RESULT
The value range goes from 0 to 0.5

EXPECTED RESULT
The value range should go from 0 to 1


SOFTWARE/OS VERSIONS
Windows: Windows 10 Pro version 1903
Comment 1 Tiar 2020-08-01 17:28:27 UTC
Ok, so it looks like there is a little bug that mouse gets the value "0.0" instead of "0.5" like my tablet pen that doesn't support this type of pressure.

However from the code, I cannot see how this bug is there.
Qt's documentation: https://doc.qt.io/archives/qt-4.8/qtabletevent.html#tangentialPressure , so it returns a value in range (-1, 1)
Then Krita in https://invent.kde.org/graphics/krita/-/blob/master/libs/flake/KoPointerEvent.cpp#L179 (KoPointerEvent::tangentialPressure()) returns a value:
fmod( (x+1)/2 , 2), which is in range (0,1), with -1 => 0, 1 => 1. (0, being the neutral one, is converted to 0.5).

However Qt's documentation says: "Current airbrushes can only move in the positive direction from the neutrual position."
That could explain half of the range... but if it was the half (0.5,1.0), not (0,0.5).