gtkD load images

Johnson Jones via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 5 06:23:47 PDT 2017


On Saturday, 5 August 2017 at 12:51:13 UTC, Mike Wey wrote:
> On 03-08-17 21:56, Johnson Jones wrote:
>> If I do something like
>> 
>> import gdkpixbuf.Pixbuf;
>> Pixbuf.newFromResource("C:\\a.jpg");
>
> There are two issues here, you need to properly escape the 
> slash: "C:\\\\a.jpg".
>
> And a.jpg is not a resource file, so you would use the Pixbuf 
> constuctor to load an image file.
>
> ```
> Pixbuf p = new Pixbuf(r"C:\\a.jpg");
> ```

Thanks. Why do I need 4 slashes? Is that standard with gtk 
because strings are interpreted twice or something? Seemed to 
work though.




More information about the Digitalmars-d-learn mailing list