gurkenlabs / litiengine

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

Allow for custom interpolation algorithms #761

Closed Gamebuster19901 closed 1 year ago

Gamebuster19901 commented 1 year ago

PR goal:

Allow developers to use custom interpolation algorithms with LitiEngine's Imaging API. (Relates to #471)

The implementation:

Caveats and issues this current implementation

  1. Literally untested
Gamebuster19901 commented 1 year ago

I'm leaning towards removing the registration system in this pr and just making a getInterpolation(int type) method in AWTInterpolation if users need to convert an int representing an JDK operation type into an interpolation type.

nightm4re94 commented 1 year ago

Oh wow, I've been working on this the past days too, documenting the entire Imaging class while I was at it. Was planning to push today 😅 My approach was more simplistic, only allowing to pass an int to the scaling method that represents one of the AffineTransformOp.TYPE_XXX values. Do you think that customized interpolations are really a requirement? I really respect the effort, but so far I'm not quite seeing the benefit for 99% of our users here. Also, I haven't tested your implementation yet. I'll raise a PR with my proposed changes for comparison and ping you when that's ready.

Gamebuster19901 commented 1 year ago

Oh wow, I've been working on this the past days too, documenting the entire Imaging class while I was at it. Was planning to push today sweat_smile My approach was more simplistic, only allowing to pass an int to the scaling method that represents one of the AffineTransformOp.TYPE_XXX values. Do you think that customized interpolations are really a requirement? I really respect the effort, but so far I'm not quite seeing the benefit for 99% of our users here. Also, I haven't tested your implementation yet. I'll raise a PR with my proposed changes for comparison and ping you when that's ready.

It's definitely something only for advanced users who either want to use custom interpolation, or want to use an interpolation from a library (such as that image scaling library you mentioned in #471 )

Just a note, I'm going to remove the registration system in this PR when I get off work, I don't see any benefits for it.

nightm4re94 commented 1 year ago

Thank you very much for the proposed changes! I've reviewed them now and come to the conclusion that your proposal introduces a level of complexity that most of our users will neither fully understand nor use. For now, I prefer the straightforward way of simply using overloads with AffineTransformOp to scale images with interpolation. My implementation is now ready and will be pushed later for comparison. Sorry we've been working on this at the same time, that was an unlucky coincidence and I hope it doesn't discourage further help - we really appreciate your support!