Re: Gdk::Pixbuf::create_from_data strange behaviour
- From: Paul Davis <pjdavis engineering uiowa edu>
- Cc: gtkmm list <gtkmm-list gnome org>
- Subject: Re: Gdk::Pixbuf::create_from_data strange behaviour
- Date: Wed, 10 May 2006 13:37:03 -0500
Paul Davis wrote:
Aurélien KAMEL wrote:
Hello,
I'm creating a pixbuf from a pixel array like this :
Glib::RefPtr<Gdk::Pixbuf> =
Gdk::Pixbuf::create_from_data(array,Gdk::COLORSPACE_RGB,false,
8,sizeX,sizeY,sizeX*3);
The problem is that if after this call to create_from_data() I do a
free() on the pixel array then the program crash when I try to use
the Pixbuf... If I don't free() the pixel array then I can use my
Pixbuf normally, display it etc.
It sure doesn't. Which in some cases is a good thing.
If you're worried about freeing the memmory, you can use this form:
file:///usr/share/doc/libgtkmm-2.4-doc/reference/html/classGdk_1_1Pixbuf.html#e3
It'd help if I referenced the online docs:
http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGdk_1_1Pixbuf.html#526129d481ff04e8953c18b0b12c4c55
and pass it a functor to delete the data when the pixbuf dies.
So, create_from_data() don't copy the pixel array in the Pixbuf ?
And, I see that there is a create_from_inline() which take as
argument a bool copy_pixels ? Can I use this function (how?) so that
I can free() the pixel array after Pixbuf was created ?
Judging from the docs, this is meant for use with things like XPM
data. The actual image data gets compiled into the program. Which
chances are is not what you want.
Thanks for your help :)
Aurelien
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]