Re: GdkPixmap and GdkPixbuf
- From: y g <odysseus lost gmail com>
- To: "David Necas (Yeti)" <yeti physics muni cz>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GdkPixmap and GdkPixbuf
- Date: Mon, 6 Jun 2005 16:21:33 +0100
On 6/6/05, David Necas (Yeti) <yeti physics muni cz> wrote:
On Mon, Jun 06, 2005 at 03:52:32PM +0100, y g wrote:
I already did as I realised that neither is a child of the other as
you say. But I am still get seg fault with the following:
static void
save_image(GtkWidget* widget, gpointer user_data)
{
GdkPixbuf* pixbuf;
g_print("Saving image...\n");
//gdk_pixbuf_save(gdk_pixbuf_get_from_drawable(NULL,
GDK_DRAWABLE(pixmap), NULL, 0, 0, 0, 0, 600, 400), "temp.bmp", "bmp",
NULL);
gdk_pixbuf_get_from_drawable(pixbuf, GDK_DRAWABLE(pixmap), NULL, 0,
Here you pass an uninitialized pointer as pixbuf...
you are referring to pixbuf... yes it is unitiliased and this line
gives me the following when i run it
(canvas:8829): Gdk-CRITICAL **: gdk_pixbuf_get_from_drawable:
assertion `dest->n_channels == 3 || dest->n_channels == 4' failed
if i change the
GdkPixbuf* pixbuf;
to
GdkPixbuf* pixbuf=NULL;
I get no warning but still the seg fault.
If I use
gdk_pixbuf_save(gdk_pixbuf_get_from_drawable(NULL,
GDK_DRAWABLE(pixmap), NULL, 0, 0, 0, 0, 600, 400), "temp.bmp", "bmp",
NULL);
i get again a seg fault. The documentation says: "Destination pixbuf,
or NULL if a new pixbuf should be created." for arg 1.
I also tried to pass a value for colormap with
gdk_drawable_get_colormap(GDK_DRAWABLE(pixmap)) which I dont think it
really matters even if it is NULL.
gdk_pixbuf_save(pixbuf, "temp.bmp", "bmp", NULL);
This one gives me the seg fault.
...and again. Don't you get any CRITICAL messages to
console?
see above
pixbuf = gdk_pixbuf_get_from_drawable(NULL, drawable, ...);
gdk_pixbuf_save(pixbuf, ...);
g_object_unref(pixbuf);
ok i see what you mean... but the following still seg faults... no
warnings this time...
static void
save_image(GtkWidget* widget, gpointer user_data)
{
GdkPixbuf* pixbuf;
g_print("Saving image...\n");
//gdk_pixbuf_save(gdk_pixbuf_get_from_drawable(NULL,
GDK_DRAWABLE(pixmap), NULL, 0, 0, 0, 0, 600, 400), "temp.bmp", "bmp",
NULL);
pixbuf = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE(pixmap),
gdk_drawable_get_colormap(GDK_DRAWABLE(pixmap)), 0, 0, 0, 0, 600,
400);
gdk_pixbuf_save(pixbuf, "temp.bmp", "bmp", NULL);
g_object_unref(pixbuf);
}
btw thanks for all your help :)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]