saving bixbuf with imlib, image distortion



I am still trying to save a pixbuf with the help of imlib. I cut/past
the the method below.  Once I save the pixbuf, I still get a distorted
image, everything is screwed 90 degrees. I read in one of the replies to
my earlier posts about the different pixbufs that either include alpha
or don't.  I am confused about this since the description that comes
with imlib on using the structure GdkImlibImage is the following:

"These are the image data structures. You may read all these data
members, and you may edit the data that rgb_data and alpha_data point
to. Remember that if you modify this data to call
Imlib_apply_modifiers_to_rgb or gdk_imlib_apply_modifiers_to_rgb to
dirty the pixmaps in the cache. You may not free this data or change the
pointer. Currently the alpha_data member is unused and will remain NULL.
Setting it to anything else may produce unexpected results."

They seem to say, go ahead and change alpha_data in one sentence and
then they say that the alpha_data member is unused???

Can someone tell what I am doing wrong here.  Thank you very much for
all your help.

void
FileSave::export_white_board(char *filename,
                                                            GtkWidget *
drawing_area,
                                                            GdkPixbuf
*pix_buf,
                                                            GdkPixmap
*pix_map) {

   GdkImlibImage image;
   GdkPixbuf *pixbuf;
   GdkColormap* cmp;
   GdkImlibSaveInfo info;
   int return_value = 0;

   // getting the colormap
   cmp = gdk_rgb_get_cmap();

   pixbuf = gdk_pixbuf_get_from_drawable(NULL,
                                         pix_map,
                                         cmp,
                                         0,
                                         0,
                                         0,
                                         0,
                                         drawing_area->allocation.width,


drawing_area->allocation.height);

   image.rgb_width = drawing_area->allocation.width;
   image.rgb_height = drawing_area->allocation.height;
   image.rgb_data = gdk_pixbuf_get_pixels(pixbuf);
   image.alpha_data = NULL;

   info.quality = 100;

   return_value = gdk_imlib_save_image(&image, filename, &info);

   gdk_colormap_unref(cmp);
   gdk_pixbuf_unref(pixbuf);
}

--
Thomas Amsler

"Imagination is more important than knowledge."
        --Albert Einstein







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