Image missdisplayed using GdkPixmap



Image is not well written ...
lines seems to be mixed ... Alignement is incorrect ..
I suppose this is due to a wrong usage of dithering/depth parameters ...
data is pointing to a rgb buffer ...
the same call was working fine when writing directly to a windows instead of
a newly created
pixmap.
Image may not be loaded from a file as it is received from network, that's
while it's stored in a buffer.

cnx->pixmap is a GtkPixmap*
cnx->window is a TOPLEVEL window GtkWidget*


  1.   cnx->pixmap = gdk_pixmap_new(0, cnx->data.header.width,
  2.                                cnx->data.header.height, 16);
  3.
  4.
  5.   gdk_draw_rgb_image(cnx->pixmap,
  6.                      cnx->window->style->fg_gc[GTK_STATE_NORMAL],
  7.                      0, 0,
  8.                      cnx->data.header.width,
  9.                      cnx->data.header.height,
  10.                      GDK_RGB_DITHER_NORMAL, cnx->data.data,
  11.                      cnx->data.header.width * 3);
  12.
  13.   cnx->draw_area = gtk_image_new_from_pixmap(cnx->pixmap, NULL);


libgtk2.0-dev  2.8.20-1



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