Re: Using a Gdk::Pixbuf setted at compile time



On Fri, 2007-05-04 at 15:08 +0200, Sergio Perticone wrote:

> Window::Window()
> {
> 	// Glib::RefPtr<Gdk::Pixbuf>  refPixbuf;
>          refPixbuf->create_from_inline(-1, raw_image, false); 

This doesn't do what you think it does.

Gdk::Pixbuf::create_from_inline() is a static function that returns a
Glib::RefPtr<>.  You are using the reference pointer you declared to
call the static function, which returns the pixbuf you're interested in.
You don't do anything with the return value though, and the pointer
through which you called the static isn't changed ...

Record the result from the call instead:

refPixbuf = Gdk::Pixbuf::create_from_inline(-1, raw_image, false);

If you don't need the pixbuf anywhere else, you can just pass the result
from create_from_inline() to the image and forget about it:

image.set(Gdk::Pixbuf::create_from_inline(-1, raw_image, false));




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