[Gretl-devel] About pixmaps and vector images

Allin Cottrell cottrell at wfu.edu
Tue Mar 4 13:28:42 EST 2014


On Tue, 4 Mar 2014, Hélio Guilherme wrote:

> Sorry but I am not still convinced about the dependency. I did not
> installed (don't remember if I did) new required lib. And the code is
> working (gdk_pixbuf_new_from_file exists already).
>
> Here is one example where I load the SVG from file:
> [helio at centos64 gretl]$ cvs diff gui2/gretl.c
> Index: gui2/gretl.c
> ===================================================================
> RCS file: /cvsroot/gretl/./gretl/gui2/gretl.c,v
> retrieving revision 1.809
> diff -r1.809 gretl.c
> 55a56
>> #ifndef USE_SVG
> 56a58
>> #endif
> 2294a2297,2308
>> #ifdef USE_SVG
>>     GdkPixbuf *icon;
>>     GError *tmp_error = NULL;
>>     char tmpfname[MAXLEN];
>>
>> /* VERIFY if OK to use / when using Windows */
>>     sprintf(tmpfname,"%svectorimages/%s",gretl_home(), "gretl.svg");
>>     icon = gdk_pixbuf_new_from_file((const char *) tmpfname, &tmp_error);
>>     if(tmp_error!=NULL) {
>>         fprintf(stderr, "Error creating icon: %s\n", tmp_error->message);
>>     }
>> #else
> 2295a2310,2311
>> #endif

>
> I tried to use ldd to see the libs but it only works with dynamic libs and
> not executables.

Here's the relevant test (assuming a standard GTK installation under 
/usr):

ldd /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so \
  | grep rsvg

When you call gdk_pixbuf_new_from_file(), the gdk_pixbuf library 
determines which dynamic module it needs to handle the task, and attempts 
to load it. In this case it's the svg module that's needed, and I'm 
betting that libpixbufloader-svg.so is linked to librsvg.

If librsvg were not present on the system then the svg module would fail 
to load and gdk_pixbuf couldn't handle the image file.

Allin


More information about the Gretl-devel mailing list