On Thursday, 3 August 2017 at 03:59:40 UTC, Johnson Jones wrote:
How can be use gtkD to load images, I assume through gdkpixbuf? While I am getting errors loading images through glade's image:

(test.exe:8188): Gtk-WARNING **: Could not load image 'a.jpg': Couldn't recognize the image file format for file 'test\a.jpg'

(loads fine in glade)

which needs to be resolved, I'd also like to be able to use gdkpixbuf to load images programmatically. There seems to be no demos on the gtkD github page that deals with image loading.

I've tried to do something like

import gtkc.gdkpixbuf;
auto x = c_gdk_pixbuf_get_formats().data;

but I don't know how to interpret x.

Also something like

                import gtkc.gdkpixbuf;
                void* x;
                auto p = c_gdk_pixbuf_get_formats();
                for(int i = 0; i < 10; i++)
                {                       
                        x = p.data;
                        p = p.next;
                }

which doesn't offer any help.


Aside: How can we call the gtk functions directly using gtkD? Seems it uses stuff like

Linker.link(gdk_pixbuf_get_formats, "gdk_pixbuf_get_formats", LIBRARY_GDKPIXBUF);

It does seem to alias to these function but something is off and I'm not sure what.

hi

- is the gtk.Image class not working for you? https://api.gtkd.org/gtkd/gtk/Image.html

- there's also a gdkpixbuf.Pixbuf that you can use. https://api.gtkd.org/gtkd/gdkpixbuf/Pixbuf.html

- you can import those functions from gdkpixbuf.c.functions.



Reply via email to