Re : [gtk-list] GdkImlibImage --> GtkImage





  Hello,

Dirk-Jan C. Binnema:
> > I read the Imlib tutorial, and it's really easy to show some image as as
> > GdkImlibImage. However, I'd like to embed such an image in a Gtk+ app. I
> > think the way to do this is to convert the GdkImlibImage into a GtkImage.
> > 
> > Now, my question is: how to do this conversion GdkImlibImage --> GtkImage?

Havoc: 
> I don't think that's what you want; you want to get a GdkPixmap from the
> GdkImlibImage like this:
> 
> pixmap = gdk_imlib_move_image(imlib_image);

  and I think that then, you may (should? I am not sure)  put the
GdkPixmap in a Widget using 


GtkWidget* gtk_pixmap_new     (GdkPixmap  *pixmap,
                               GdkBitmap  *mask);


  the "mask" arg comes from :

  mask = gdk_imlib_move_mask(imlib_image);


  I think it can be NULL, but since I use the perl bindings, I am not
sure what it is in C.

  You may change the GdkPixmap in the widget by doing


void       gtk_pixmap_set        (GtkPixmap  *pixmap,
                                  GdkPixmap  *val,
                                  GdkBitmap  *mask);


  I hope that helps.  


  Etienne


ps: If I said nonsense, please let us know : I use (the perl bindings
     of) these functions, but without really knowing why it works.



pps: My impression is that 

   GdkPixmap          *gdk_imlib_move_image(GdkImlibImage * image);

"gives" the memory allocated for the GdkImlibImage to the GdkPixmap,
whereas 

   GdkPixmap          *gdk_imlib_copy_image(GdkImlibImage * image);

does a copy.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]