Skip to content
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

Correct implementation of NewPixbufFromData via gdk_pixbuf_new_from_data #334

Merged
merged 3 commits into from
Jul 29, 2017

Conversation

gdm85
Copy link
Contributor

@gdm85 gdm85 commented Jul 29, 2017

The current implementation of NewPixbufFromData seems using some assumptions about how gdk_pixbuf_loader_write should work, and anyway does not document properly how to use it. (we probably should have tests for these functions).

After some struggles I individuated in gdk_pixbuf_new_from_data the correct API counterpart for it.

This PR uses gdk_pixbuf_new_from_data instead of gdk_pixbuf_loader_write and additionally defines a PixbufData struct for embedding/inlining of pixbuf data from files; additionally, a CLI tool (to be used with //go:generate) is provided in tools/ to generate such pixbuf data automatically.

Inspiration for the embedding/inlining approach: https://github.com/krh/gtk/blob/master/gdk-pixbuf/make-inline-pixbuf.c

Upstream documentation: https://developer.gnome.org/gdk-pixbuf/stable/gdk-pixbuf-Image-Data-in-Memory.html#gdk-pixbuf-new-from-data

@mattn mattn merged commit f546757 into mattn:master Jul 29, 2017
@mattn
Copy link
Owner

mattn commented Jul 29, 2017

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants