user3838784
user3838784

Reputation:

How do I handle multi-resolution images for various levels of HiDPI scaling in JavaFX?

There are many scaling factors out there for HiDPI screens (1.25x, 1.5x, 2x, 3x, etc). The most straight-forward solution would be to provide multiple versions of the same image in JavaFX, which seems to be possible in Swing using things like @125pct for 1.25x or @2x for 2x. Does this also work in JavaFX? If it doesn't, how should I load images to make sure they look crisp regardless of the HiDPI screen?

I have read here and there that JavaFX supports @2x but I haven't found any official piece of documentation actually stating it.

(As a side note, I would rather not use SVG images due to unrelated issues with Batik and the insane amount of dependencies this would pull in)

Upvotes: 2

Views: 317

Answers (1)

tomsontom
tomsontom

Reputation: 5887

JavaFX-8 (as well as JavaFX-11) only supports @2x - found by inspecting the code (search for ImageStorage in your IDE)

Upvotes: 2

Related Questions