gio icon indicating copy to clipboard operation
gio copied to clipboard

widget: add ImageSequences and GIF support

Open inkeliz opened this issue 3 years ago • 3 comments

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]

inkeliz avatar Mar 06 '22 07:03 inkeliz

Cool feature, but I'm not sure it belongs in core. @whereswaldon, thoughts?

eliasnaur avatar Mar 07 '22 11:03 eliasnaur

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".

whereswaldon avatar Mar 08 '22 14:03 whereswaldon

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 

eliasnaur avatar Mar 10 '22 08:03 eliasnaur