gio
gio copied to clipboard
widget: add ImageSequences and GIF support
That patch adds a easy way to use GIF (or any other kind of images sequences). That patch adds a new function NewGIF, which is similar to NewIcon, and adds a ImageSequences similar to the existing Image.
Fixes: https://todo.sr.ht/~eliasnaur/gio/368
Signed-off-by: Inkeliz [email protected]
Cool feature, but I'm not sure it belongs in core. @whereswaldon, thoughts?
I suspect that many applications will want this feature (the ability to display animated images). It's common across media applications, games, social applications, and more. I can see the argument that we should put it in x to try to get the API right, but I don't strongly feel that we need to. I think it probably does eventually belong in core. Maybe it's more a question of "when".
This may end up in core, but it also feels more "util"-like than the fundamental widgets in package widget: it is built entirely on top of widget.Image and it takes an io.Reader (by necessity) instead of an image.Image.
Regardless of where it ends up, I suggest a video or media package that can accept anything through its New constructor:
package media
type Image struct {
// Maybe Fit and Position and Scale.
}
// New constructs a new Image from its contents.
// Supported image formats: JPEG, GIF, PNG, ... (maybe short .avi/.vp9/... clips in future)
func New(io.Reader) (Image, error)
func (img *Image) Layout(gtx C) D