On Thursday, 3 August 2017 at 13:12:03 UTC, Mengu wrote:
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-[1;33mWARNING[0m **: 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.
no, they are not... I haven't tried though, but there seems to be
a problem with the pixbuf not having loaders for any images.
using a gtk Image widget does not load the image and complains
about the image format.
If I do something like
import gdkpixbuf.Pixbuf;
Pixbuf.newFromResource("C:\\a.jpg");
Unhandled exception: glib.GException.GException The resource at
'C:\a.jpg' does not exist at generated\gtkd\glib\GException.d(40)
occurred
which doesn't seem to make much sense.
The resource exists where I say it is and not sure if this is
related to the missing pixbuf loaders.