gdk_pixbuf_new_from_data... It works, but...




I have a window that displays an image, and the image gets updated from calculations I make.

Currently I'm doing this by setting up a data array (myBuffer), and creating a Pixbuf, which then gets assigned to the window. When I change the image, I load the new data in the buffer, then call the gdk_pixbuf_new_from_data call again.

myPixbuf = gdk_pixbuf_new_from_data(myBuffer,GDK_COLORSPACE_RGB, FALSE, 8, width, height, width*3, NULL, NULL);

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.

I'm new to gtk, so maybe I'm looking at the wrong docs, or just don't know where to look.

Thanks,
Brian


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