[gtkmm] How to modify Gdk::Pixbuf data



I need to read an image from the disk, display it, do some image
processing on it (filtering, edge detection, etc.) and then display again
the results.

So I use a Gdk::Pixbuf for that, which is a protected member in some
class. First I do

Glib::RefPtr<Gdk::Pixbuf> pixbuf_ = creat_from_file("imagefile");

Then I get the data from the pixbuf_

u_char * pixbufdata_=pixbuf_->get_data();

and I copy it to a buffer (u_char * data) in memory, in a for loop.
I do the processing I need to do on my data, then I need to put it back in
the pixbuf.

My question is how to do this. Is it ok to call create_from_data()? My
guess is that every time I call this function, new space will be
allocated. Can someone confirm this? If so, how do I put the data back
into the pixbuf, without memory leaks?

Thanks!






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