gurkenlabs / litiengine

LITIENGINE 🕹 The pure 2D java game engine.
https://litiengine.com/
MIT License
725 stars 93 forks source link

Scaling images down looks horrible. #471

Closed nightm4re94 closed 1 year ago

nightm4re94 commented 1 year ago

Describe the bug Using Imaging.scale(...) to downsize images results in aliased edges and looks terrible.

To Reproduce Use Imaging.scale(...) to scale an image to a smaller size.

Expected behavior For HUD elements, I would expect the scaled images to stay crisp and without flaky edges. Therefore, we should introduce another overload for Imaging.scale(...) that passes the AffineTransformOp type as argument. Currently, we only use AffineTransformOp.TYPE_NEAREST_NEIGHBOR.

Screenshots image Left example is downscaled using imgscalr-lib with Method.ULTRA_QUALITY, right example uses LITIENGINE's standard Imaging.scale() (AffineTransformOp.TYPE_NEAREST_NEIGHBOR). image The example above uses LITIENGINE's Imaging.scale(), but with AffineTransformOp.TYPE_BILINEAR image The example above uses LITIENGINE's Imaging.scale(), but with AffineTransformOp.TYPE_BICUBIC