Re: gdk_pixbuf_new_from_data... It works, but...




On Sep 1, 2004, at 2:16 PM, Tristan Van Berkom wrote:

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


Indeed, I would not like to have them lying around.
It turns out that I can change the buffer that I feed to the pixbuf, and it automagically updates the image. No need to delete them after all.

groooovy.

bc




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