Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smoother rendering via rendering hints #112

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thomaslienbacher
Copy link

@thomaslienbacher thomaslienbacher commented Jan 16, 2024

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

In the signture panel when the pdf document and the signature preview is
rendered, we add antialiasing and bicubic interpolation, so the scaled
images dont look jagged and much smoother. I also added constant for a
magic value that was used to upscale the signature preview image.
@iaik-jheher iaik-jheher self-assigned this Jan 16, 2024
@thomaslienbacher
Copy link
Author

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
Copy link
Contributor

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

@iaik-jheher
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants