-- --PART-BOUNDARY=.19710231307.ZM20748.dehavilland.ca Content-Type: text/plain; charset=us-asciiOn Oct 23, 3:46pm, Christian Faraoni wrote: > Hello, i have a simple question. > > I'm working wtih a visual true colors and 16 bpp. > > is it possible to get a grays scale with 256 levels??? > > thanks in advanced and excuse me for my english. > > -- > Faraoni Cristian >-- End of excerpt from Christian Faraoni
Check /xforms/contrib/grayimage. It is set for 8bpp. Couldn't you adapt it to your specific case?
I've attached it in case you don't have it.
-- * * ** ***** * *** *** * * * * * * * * * * * * ** * * * * * ******* ****** **** * * * * * * ** * * * * * * * * * * * * * * * * * ***** * *** *** John Prinos Aircraft Performance Bombardier DeHavilland (416) 375-3574 <jprinos@dehavilland.ca>--PART-BOUNDARY=.19710231307.ZM20748.dehavilland.ca X-Zm-Content-Name: grayimage Content-Description: Text Content-Type: text/plain ; name="grayimage" ; charset=us-ascii ; x-irix-type=AsciiTextFile
This is contributed by Christophe Fiorio (fiorio@lirmm.fr)
It outlines a method you can use to to display an image in a form:
GC fl_get_form_gc(FL_FORM *); Window fl_get_form_window(FL_FORM *);
unsigned char *abuffer; /* this is an array containing the pixels of * the image */ int imagewidth,imageheight;
XImage *xi; GC drawgc; XColor col[256]; Colormap colormap; Window window; Display *display; int i;
static FL_FORM *theinimage = NULL;
#define X_MAX_COLOR 65535
theinimage = fl_bgn_form(FL_NO_BOX,imagewidth,imageheight); fl_end_form(); fl_show_form(theinimage,FL_PLACE_MOUSE,FL_TRANSIENT,NULL); for(i = 0; i < 256; i++) { col[i].pixel = i; col[i].flags = DoRed | DoGreen | DoBlue; col[i].red = (unsigned short)(i * X_MAX_COLOR/256); col[i].green = (unsigned short)(i * X_MAX_COLOR/256 ); col[i].blue = (unsigned short)(i * X_MAX_COLOR/256 ); } drawgc = fl_state[fl_get_form_vclass(theinimage)].gc[0]; window = theinimage->window; display = FL_FormDisplay(theinimage); colormap = XCreateColormap(display,window,DefaultVisual(display,DefaultScreen(display)), AllocAll); XStoreColors(display,colormap,col,256); XSetWindowColormap(display,window,colormap);
xi = XCreateImage(display,DefaultVisual(display,DefaultScreen(display)),8, ZPixmap,0,abuffer,width,height,XBitmapPad(display),width); XPutImage(display,window,drawgc,xi,0,0,0,0,xi->width,xi->height); XFree((char *)xi);
--PART-BOUNDARY=.19710231307.ZM20748.dehavilland.ca--
_________________________________________________ To unsubscribe, send the message "unsubscribe" to xforms-request@bob.usuf2.usuhs.mil or see http://bob.usuf2.usuhs.mil/mailserv/xforms.html Xforms Home Page: http://bragg.phys.uwm.edu/xforms List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/