Clojure2D/clojure2d

Add support and write example for hidpi screens

jedahan opened this issue · 5 comments

I ported a quil sketch to clojure2d, and noticed the fonts are a lot fuzzier/hard to read:

quil

quil

clojure2d

clojure2d

Wondering how to make it sharper / render at 2x the resolution.

Source is https://github.com/jedahan/calendar/blob/clojure2d/src/calendar.clj

This works, but I feel like its hacky?

jedahan/calendar@a1d8e1f

I checked processing implementation of pixelDensity() function. It does the following:

  • creates canvas twice bigger
  • calls scale(pixelDensity) to have proper virtual size of canvas

You can make the same. Scaling (interpolation) with :high (or :highest) rendering hints is bicubic.

trying to figure out why result is uglier in clojure2d...

@tsulej I got very close to the same quality with https://github.com/jedahan/calendar - check it out, I think rendering at 2x, setting font sizes to 2x, and then window to '1x' looks a lot sharper

Found a bug related to jframe/awt.canvas creation... nasty. Size of jframe panel was 10pixels bigger than expected. That's why everything wasn't sharp. Everything was scaled up. Today's snapshot fix it.