Re: [gtk-list] gdk_pixmap_create_from_data



>    fp = fopen ("akiyosy.sby", "r");
>    fread (buf, 352*288, 1, fp);
>    fclose (fp);
>  
>    pixmap = gdk_pixmap_create_from_data (drawing_area->window, buf,
>  					352, 288, 8,
>  					&drawing_area->style->black,
>  					&drawing_area->style->white);
>  
>  it fails with this error:
>  
>  ** ERROR **: BadValue (integer parameter out of range for operation)
>    serial 258 error_code 2 request_code 53 minor_code 0

gdk_pixmap_create_from_data() takes a pointer to data in XImage
format, which may not be what you need.  Also, the depth parameter
must match the drawable's depth.

For what you want to do, I think it is better to use gdk_imlib.  You
would use gdk_imlib_create_image_from_data(), which takes a pointer to
an 24-bit RGB buffer and an optional 8-bit alpha buffer.  If your data
is 8-bit grayscale, I guess you'll have to make it RGB first.

Or you can use a grayscale GtkPreview, fill it with the data, and
later put it to a pixmap with gtk_preview_put().

  Federico



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