a-sit / PDF-Over

https://technology.a-sit.at/en/pdf-over/
European Union Public License 1.2
17 stars 4 forks source link

Smoother rendering via rendering hints #112

Open thomaslienbacher opened 7 months ago

thomaslienbacher commented 7 months ago

In the signture panel where the pdf page and the signature preview is painted, I added antialiasing and bicubic interpolation rendering hints so the scaled images don't look as jagged and much smoother. Specifically I added bicubic filtering, anti aliasing and setting the preferred rendering to the quality setting. I also added a constant for the magic value that was used to downscale the signature preview image in SignaturePanel.setSignaturePlaceholder(...). It was used because when we request a signature preview from PdfAs.generateVisibleSignaturePreview(...) we upscaled the resolution by that factor. I guess downscaling to get better image quality was already an idea. I reduced the scaling from 4 to 2 because this seemed to give nicer results.

I tested that it compiles with mvn -U install.

In the future I might add a setting to modify the filtering settings, because somebody out there might be running this on weak hardware and prefers speed over looks.

I included two screenshots of the difference in rendering so one can easily compare them, I think it looks better ;) jagged_without_hints smooth_with_hints

thomaslienbacher commented 7 months ago

Hey @iaik-jheher, I saw that you merged #111 today, I fixed the resulting merge conflicts and now it should be good again. I was also wondering, do you think it would have been better to rebase and force push on my branch? It would have made the history more linear but it might have messed with anybody thats trying to work on the branch.

iaik-jheher commented 7 months ago

Rebase/force push is fine, but not required, we'll squash merge eventually anyway.

iaik-jheher commented 6 months ago

Just so I don't leave you hanging indefinitely without update: this is very much still on my radar, but we've run into some internal concerns about (re-)licensability of external contributions, which is what's blocking me from reviewing this right now. I'll let you know once I know more.