[gtkmm] Pixbuf memory management
- From: Jussi Pakkanen <jpakkane yahoo com>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Pixbuf memory management
- Date: Mon, 28 Oct 2002 11:52:32 -0800 (PST)
Hi
I have been porting a program to gtkmm2. So far
everything has been nice. However when I tried to use
pixbufs I ran into some trouble.
The lifetime issues of pixbufs is very murky, both in
Gtk+'s and gtkmm's documentation. In my case, I have
several small images in a nonstandard format. These
images need to be shown occasionally. I think that the
best way to do this is to code a function that
transforms the images to a temporary RGB pixel array.
Then I create a pixbuf using
Gdk::Pixbuf::create_from_data().
The problem is this: when and who should free the
temporary array of RGB values I constructed? The
documentation seems to implicate that creating the
pixbuf does not make a copy of the data. This seems a
little counterintuitive. I just want to create a
pixbuf from my temporary data and then delete it
without affecting the pixbuf.
Does create_from_data() make a copy of the image data
or not? If not, is there a more elegant way around
this than making a pixbuf without a destroyer
function, duplicating it with copy() and then deleting
the first pixbuf and the temporary array?
PS I assume that create_from_data() expects the data
to be in the format R,G,B,R,G,B,R,G,B... without alpha
channel and R,G,B,A,R,G,B,A,R,G,B,A... with it. Is
this correct?
__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]