In the C++ version of Me TV I used resources for the XML and PNG data. So far I have used string imports for the XML data in the D version of Me TV. However I suspect this will not work for Pixbuf and image data, where resources seem to be emphasised for the case where files are avoided. Is there a resource compiler that generated a D module – so as to avoid having to compile a C file into the D application. Alternatively is there a known way of creating a Pixbuf from a string imported PNG file?
I hacked it with:
auto loader = new PixbufLoader();
loader.write(to!(char[])(import("images/me-tv.png")));
loader.close();
about.setLogo(loader.getPixbuf());
which works, but whether it is the right way to do this I am uncertain.
On 09-11-17 12:30, Russel Winder wrote:
In the C++ version of Me TV I used resources for the XML and PNG data. So far I have used string imports for the XML data in the D version of Me TV. However I suspect this will not work for Pixbuf and image data, where resources seem to be emphasised for the case where files are avoided. Is there a resource compiler that generated a D module – so as to avoid having to compile a C file into the D application. Alternatively is there a known way of creating a Pixbuf from a string imported PNG file?
Like glib-compile-resources
but with dlang output? Not as far as i know.
As for the import you can cast it to byte if the contents is not utf8.
On Thu, 9 Nov 2017 22:16:46 +0100, Mike Wey wrote:
[…]
Like
glib-compile-resources
but with dlang output? Not as far as i know.
Might this be something worth creating?
As for the import you can cast it to byte if the contents is not utf8.
As far as I am aware the file is UTF-8 data but that didn't seem to be enough.