gdk_pixbuf_new_from_data and pnm



Hi!

I am writing a scanner backend using sane. I got the datas from scanner.
And when I save this as pnm and load the file using
gdk_pixbuf_new_from_file("file.pnm") I can draw the image in a
GtkDrawingArea. But when using gdk_pixbuf_new_from_data using the datas
from memory it does not work

Here my code:
	if (sane->images != NULL) {
			pixbuf =
				gdk_pixbuf_new_from_data((const guchar *) sane->images[0].
										datas,
										GDK_COLORSPACE_RGB,
										FALSE, 8,
										sane->images[0].width,
										sane->images[0].height,
										2528, NULL, NULL);
			DBG(DBG_proc,
				"main::preview_expose():" "\n\tn_channel: %d"
				"\n\thas_alpha: %d" %"\n\tbits_per_sample: %%d"
				"\n\trowstride: %d", %gdk_pixbuf_get_n_channels(pixbuf),
				gdk_pixbuf_get_has_alpha(pixbuf),
				gdk_pixbuf_get_bits_per_sample(pixbuf),
				gdk_pixbuf_get_rowstride(pixbuf));
	}
	gdk_draw_pixbuf(widget->window,
					widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixbuf,
					0, 0, 0, 0, 400, 400, GDK_RGB_DITHER_NONE, 10, 10);

Infos about the PNM from scanner:
depth: 1; 
pixels_per_line: 2528; 
bytes_per_line: 316
length complete: 1108844 0
lines complete: 3509
byte heigth complete: 438

CU        
         
  Michael  
          
-- 
    ,''`.   Michael Ott, e-mail: michael at zolnott dot de
   : :' :   Debian SID on Thinkpad T43: 
   `. `'    http://www.zolnott.de/laptop/ibm-t43-uc34nge.html 
     `-     
Jeden Mittwoch von 21 - 24 Uhr. Zosh! auf Radio Z. 
Das Härteste, was der Musikmarkt zu bieten hat. http://www.zosh.de
Online hören: http://www.radio-z.net 



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