Brian Clark wrote:
[...]
It works, but Is this the best way to do it? If I understand it
right, I'm allocating memory each time I call this. It seems like
I'm going to get piles of discarded pixbufs clogging up my memory.
It's also got to be slower than just reusing the allocated memory.
But I can't find a call to just replace the data in a pixbuf with
data from an array... something like a "gdk_pixbuf_replace_with_data"
call.
To free a GdkPixbuf, do `g_object_unref(G_OBJECT(pixbuf));'
(this is the valid way of freeing/destroying/"finalizing" any
object that is a derivitive of the GObject).
In contrast with the amount of memory free'd/allocated per "reload"
I'd say that the GdkPixbuf object is negligable (in the sence that
you might as well instantiate a new GdkPixbuf along with your new
image).
As for `gdk_pixbuf_replace_with_data()', you can use
`gdk_pixbuf_copy_area()'
if your source is another GdkPixbuf.
Why would you want to have a bunch of pointers to raw pixel data lying
around
anyway ?
Cheers,
-Tristan