Re: Creating Gdk::Pixbuf from string data



Unfortunately, it won't work. When I tested to_string() on a Gdk::Pixbuf, it returned an empty string.

I agree that the documentation is unclear. I checked the source code of the underlying C classes, GdkPixbuf and GIcon. GdkPixbuf implements the GIcon interface, but it only implements part of the interface. It does not implement the virtual functions to_tokens() and from_tokens(), and therefore a GdkPixbuf can't be serialized to a string. Nor can it be created from a string.

Kjell

2013-01-14 17:20, Glus Xof skrev:
Hi guys,

I write you again 'cause the reference is not so clear for me at this point...

It's clear that for to create a reference pointer to a Gdk::Pixbuf
using a file data could be done like as follows,

Glib::RefPtr<Gdk::Pixbuf> refPixbuf = Gdk::Pixbuf::create_from_file (filename);

But once here,
1) Is it possible to store the image data to a string var? Is the
method to_string() conceived to do so ?

std::string strPixbuf = refPixbuf->to_string();

2) If the step 1 is well reasoned... Is it possible to create a
reference pointer to a new Gdk::Pixbuf object using the last strPixbuf
data ??

Glus




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