Re: GdkPixmap and GdkPixbuf

On Mon, Jun 06, 2005 at 03:22:51PM +0100, y g wrote:
after following the scribble example on the Gtk tutorial I try to save
the image produced. Looking on the documentation of GdkPixbuf I found
I could use the following which however gives me a segmentation fault
in my program.

static GdkPixmap *pixmap = NULL;
gdk_pixbuf_save(GDK_PIXBUF(pixmap), "temp.bmp", "bmp", NULL);

I know that pixmap is of type of GdkPixmap and that arg 1 of the
function must be a GDK_PIXBUF and hence the cast. But as I said I am
getting a segmentation fault. Any clues why?

No matter the bad typecast, you are trying to save a NULL
pointer.  So what else you can expect than a segfault?

And to the bad typecast.  Neither of GdkPixbuf, GdkPixmap is
a child of the other.  See gdk_pixbuf_get_from_drawable()
for how to get a GdkPixbuf from a drawable.


A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

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