Bug 437401 - Jagged freehand annotations when using a high-resolution stylus
Summary: Jagged freehand annotations when using a high-resolution stylus
Status: REPORTED
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 20.12.2
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
: 447651 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-05-20 10:32 UTC by ramon diaz-uriarte
Modified: 2024-04-11 12:17 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Annotations shown in Okular for Window. On left, annotation done with Xodo with same stylus and same device. (33.57 KB, image/png)
2021-05-20 10:32 UTC, ramon diaz-uriarte
Details
Annotations shown in Xodo (same device as previous screenshot). (47.88 KB, image/png)
2021-05-20 10:34 UTC, ramon diaz-uriarte
Details
screecapture, high zoom, 1 (24.76 KB, image/png)
2021-06-05 12:41 UTC, ramon diaz-uriarte
Details
screencapture, high zoom, 2 (25.47 KB, image/png)
2021-06-05 12:42 UTC, ramon diaz-uriarte
Details
Screenshot of freehand annotation, stylus-handwritten text (473.41 KB, image/png)
2021-09-08 12:24 UTC, Didier M.
Details
Screenshot of freehand annotation, stylus-handwritten text (400% zoom) (318.95 KB, image/png)
2021-09-08 12:25 UTC, Didier M.
Details
Screenshot of freehand annotation, mouse-drawn curves (zoomed) (142.51 KB, image/png)
2021-09-08 12:34 UTC, Didier M.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ramon diaz-uriarte 2021-05-20 10:32:25 UTC
Created attachment 138592 [details]
Annotations shown in Okular for Window. On left, annotation done with Xodo with same stylus and same device.

SUMMARY

 In Windows 10 (Okular version 20.12.2) freehand annotations with stylus are       jagged.

STEPS TO REPRODUCE
1. Open PDF in Okular
2. Click on freehand annotation and use stylus
 

OBSERVED RESULT
 - When the annotation is taken, it looks very jagged.

 - That same annotation, displayed in another PDF viewer, does not look as jagged, but it is more jagged than annotations done with other apps (e.g., Xodo or Adobe Acrobat Reader DC).

  - Displaying that PDF in Okular for Linux also shows the freehand annotations as jagged.

EXPECTED RESULT
- Annotation is reasonably smooth.

SOFTWARE/OS VERSIONS
Windows: Windows 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

 - This might be related to https://bugs.kde.org/show_bug.cgi?id=410723 ? But that is solved.
Comment 1 ramon diaz-uriarte 2021-05-20 10:34:41 UTC
Created attachment 138593 [details]
Annotations shown in Xodo (same device as previous screenshot).

Annotations done in Okular look more jagged, but less than when they are shown in Okular itself.
Comment 2 Laura David Hurka 2021-05-21 21:19:53 UTC
I think that is just your stylus, and other applications realize (or not) that your stylus is jagging and apply a smoothing algorithm to the annotation.

Bug 410723 was caused by processing both stylus and mouse cursor events, which were systematically a bit off, which caused the caracteristic comb-like jitter. In your case, the jitter looks pretty random. Can you please make a screenshot of this jitter at a high zoom scale?
Comment 3 Bug Janitor Service 2021-06-05 04:33:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 ramon diaz-uriarte 2021-06-05 12:41:41 UTC
Created attachment 139019 [details]
screecapture, high zoom, 1
Comment 5 ramon diaz-uriarte 2021-06-05 12:42:09 UTC
Created attachment 139020 [details]
screencapture, high zoom, 2
Comment 6 ramon diaz-uriarte 2021-06-05 12:43:26 UTC
(In reply to David Hurka from comment #2)
> I think that is just your stylus, and other applications realize (or not)
> that your stylus is jagging and apply a smoothing algorithm to the
> annotation.
> 
> Bug 410723 was caused by processing both stylus and mouse cursor events,
> which were systematically a bit off, which caused the caracteristic
> comb-like jitter. In your case, the jitter looks pretty random. Can you
> please make a screenshot of this jitter at a high zoom scale?

Added two screenshots at high zoom from Okular.

Unfortunately, I do not (yet) have another stylus to test. Will try to get another one, and report.
Comment 7 Laura David Hurka 2021-06-05 22:21:31 UTC
Thanks. I don’t think these screenshots indicate a systematic jitter, but just the natural jitter of a physical object.

After reading this more carefully:

> - That same annotation, displayed in another PDF viewer, does not
>   look as jagged, but it is more jagged than annotations done
>   with other apps (e.g., Xodo or Adobe Acrobat Reader DC).

I think that Poppler (Okular’s backend) renders the annotation with miter-join line style, while other renderers use round-join. Round-join can not make spikes.

>   but it is more jagged than annotations done
>   with other apps (e.g., Xodo or Adobe Acrobat Reader DC).

Other apps maybe ignore points that are very close to each other, which additionally reduces jitter.

You can test that by slowly drawing a diagonal line with the mouse. My Okular creates a staircase line instead of one smooth diagonal line, which means that all points of my mouse movement are included. (One pixel up, one pixel right, one pixel up, ...)
Comment 8 ramon diaz-uriarte 2021-06-20 14:16:09 UTC
Thanks. I haven't been able to test with another stylus, but things are OK (much smoother) with the mouse, so I guess this is a stylus issue as you suggested.

I guess we can close this, so I am setting status to "resolved", "not a bug". Apologies for the noise with this report.


(In reply to David Hurka from comment #7)
> Thanks. I don’t think these screenshots indicate a systematic jitter, but
> just the natural jitter of a physical object.
> 
> After reading this more carefully:
> 
> > - That same annotation, displayed in another PDF viewer, does not
> >   look as jagged, but it is more jagged than annotations done
> >   with other apps (e.g., Xodo or Adobe Acrobat Reader DC).
> 
> I think that Poppler (Okular’s backend) renders the annotation with
> miter-join line style, while other renderers use round-join. Round-join can
> not make spikes.
> 
> >   but it is more jagged than annotations done
> >   with other apps (e.g., Xodo or Adobe Acrobat Reader DC).
> 
> Other apps maybe ignore points that are very close to each other, which
> additionally reduces jitter.
> 
> You can test that by slowly drawing a diagonal line with the mouse. My
> Okular creates a staircase line instead of one smooth diagonal line, which
> means that all points of my mouse movement are included. (One pixel up, one
> pixel right, one pixel up, ...)
Comment 9 Laura David Hurka 2021-06-21 10:38:20 UTC
I didn’t mean that the problem is on your side or with your stylus. I consider this a bug of Okular. The tablet events in Qt are intended for higher precision, so we should be able to process this higher precision.

No need to worry about making noise. Discussing a bug report is fine. :)
Comment 10 gbell_spamless 2021-06-25 23:23:28 UTC
I see the same on Ubuntu 20.04, Okular 19.12.3, Genius EasyPen F610E. Other apps (GIMP, PowerPoint) render smooth lines.

Can I just take two lines to GUSH about Okular? The annotation features are best in class and life changing. I take notes on PDFs like I did books. Thanks devs!
Comment 11 ramon diaz-uriarte 2021-06-30 19:02:42 UTC
:) Thanks!

(And I do second gbell's comment: Okular's annotation features and general design are best in class).


(In reply to David Hurka from comment #9)
> I didn’t mean that the problem is on your side or with your stylus. I
> consider this a bug of Okular. The tablet events in Qt are intended for
> higher precision, so we should be able to process this higher precision.
> 
> No need to worry about making noise. Discussing a bug report is fine. :)
Comment 12 Didier M. 2021-09-08 12:20:40 UTC
The extensive annotation features of Okular are differentiating it from the other PDF viewers.

Nevertheless, note-taking is impaired by :
- the jaggedness when handwriting (using an EMR stylus on a tablet), an issue which does not occur with e.g. Xournal++ on the same hardware.
- the absolute value of the "Width" parameter, independent of the zoom level.

One would expect to reduce jaggedness by zooming in, writing text, and zooming out, but line width and jaggies are applied independent of the zoom level.

(see attached screenshots)
Comment 13 Didier M. 2021-09-08 12:24:35 UTC
Created attachment 141384 [details]
Screenshot of freehand annotation, stylus-handwritten text
Comment 14 Didier M. 2021-09-08 12:25:03 UTC
Created attachment 141385 [details]
Screenshot of freehand annotation, stylus-handwritten text (400% zoom)
Comment 15 Didier M. 2021-09-08 12:34:16 UTC
Created attachment 141386 [details]
Screenshot of freehand annotation, mouse-drawn curves (zoomed)

To provide some additional information, illustrating the issue from another POV (pun intended) :

These curves ae drawn on PC using a mouse.
Notice that, due to lack of interpolation (?), curvature is lost (this would render any handwritten text more or less illegible).
Comment 16 Laura David Hurka 2022-01-14 21:37:40 UTC
*** Bug 447651 has been marked as a duplicate of this bug. ***
Comment 17 Thomas Bertels 2024-04-11 12:17:08 UTC
Probably related to bug 456225, Okular doesn't use interpolation for text and images.