On 8 Nov 2012, at 19:53, K.C. Babb wrote: > I work on an application that has a need to use XWD files created via a > variety of external tools, in an FLTK GUI. Basically I need for XWD the > types of capabilities which are currently provided by the Fl_*_Image classes > (e.g. draw()) for other file formats such as PNG. Is there a utility (or > code available) to convert an XImage to some usable type of an Fl_Image in > some fashion? Or is there an Fl_XWD_Image in the works? Thank you!
If it were me (and I hope it never is!) then I'd pass the file through (for example) xwdtopnm and then, um, well, maybe pnmtopng, then load it. OK, looks a bit rubbish as a process. Sorry. Maybe something else. I'm assuming you want to do this in the app as it runs, then? Not in the file system, where converting to png is tedious but trivial? If so, I guess what I'd really do is read in the XWD file and create an RGB representation of it in RAM in the fltk format, then just assign that buffer to my display widget. Reading in the XWD file is left as an (unnecessarily painful) exercise for the reader (but time spent studying the XWD header should make it clear how to unpack the XWD into actual RGB values...) On this Mac the header is /usr/X11/include/X11/XWDFile.h so I guess it is similar on an actual X11 box too! Anyway, once you have your RGB buffer, see this howto and you're good to go: http://www.fltk.org/articles.php?L468 Exactly *why* the XWD data is not just some RGB map anyway I do not know, but that's where we are... Hope that was some help! -- Ian _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

