-
-
Notifications
You must be signed in to change notification settings - Fork 185
Add image.load_animation
#3372
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
Add image.load_animation
#3372
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, LGTM 👍 I've tested the animation locally and it all looks good to me. I like the simple API - not much to argue about but easy for people to expand on further (as they do already when loading animations frame by frame).
For some reason github is having a moment with downloading pygame and breaking the MSYS build but other than that it all looks good to merge. I'll leave it for a bit longer to give everyone a chance to have a look at the API as it's new.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, checked the code, looks immaculate and well explained, awesome New API sauce, thanks!
Not going to press the shiny green merge button either at the moment
I would like to weigh in before this is merged, thank you. |
I've been consistently pushing for load_animation -> AnimatedSurface. But I'm okay with this approach instead, given that you and others support it. It doesn't let perfect be the enemy of the good. |
I think if/when we are adding
This is more pythonic IMO, even if we wanted to discard this PR and go with the class only approach. |
In a similar vein, what do you think about bringing image things into the Surface class overall?
|
Love that idea as well. The same would go for |
Tested with the iconic animation from the last April fools' event, there is some issue with webp. Presumably this would be fixed by an update to https://github.com/libsdl-org/SDL_image/releases/tag/release-2.8.5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good to go in now, although SDL image should be handled before next release.
Will there ever be support for saving animations? |
@LeWolfYT Very unlikely, as SDL doesn't support it. |
@LeWolfYT you could technically request this in the SDL library, which would make the chances of us adding it a lot higher (if you do, make sure to follow lib-sdl's posting rules and check for duplicates before) |
My take on the PR #2218
fixes #1054
While that PR did some nice work and set the base up for this work, I believe the general consensus was that
image.load_animation
should just be pretty barebones in terms of the API, just returning a python list of the frames, closely wrapping the underlying SDL function.If we have a builtin
AnimatedSurface
API in pygame-ce, it could now be implemented in pure python and use this function internally, and that should be decoupled from image entirely.Here is a simple example of how a GIF player would look like
Here is the example file being used: