Hi guys,

Before anything, I admit that probably my question is not an specifically
Gtkmm question... but nevertheless I think you may know how Gdk::Pixbuf is
done...

Having the following,

Glib::RefPtr<Gdk::Pixbuf> ref_orig = Gdk::Pixbuf::create_from_file
("./file.png");

I'm trying to temporary store (because I need so) the image data into a
std::string object. It seems that get_pixels() could solve the problem,
getting a pointer of type guint8.
So, I wrote as follows,

std::string image_pixels (reinterpret_cast<const char
*>(ref_orig->get_pixels()), ref_orig->get_rowstride());

Glib::RefPtr<Gdk::Pixbuf> ref_dest = Gdk::Pixbuf::create_from_data (
reinterpret_cast<const guint8*>(image_pixels.c_str()),
Gdk::COLORSPACE_RGB, ref_orig->get_has_alpha(),
ref_orig->get_bits_per_sample(), ....);

But, unfortunatelly the ref_dest image does not remain the same as
ref_orig... Why ?

Could help ?

Glus
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to