> > 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! > --=20 > Ian
Thanks, I'll look into the RGB approach; we have some code which reads an XWD into an XImage, so perhaps it's reasonable to mangle it further to stuff the RGB appropriately. Thank you for that reference, I hadn't seen that. Had already considered using 'convert' (we have the ImageMagick stuff on most systems here) to change the file to a supported format and then just get on with it. We can use that as a fallback position, but would prefer to have the capability self-contained if possible. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

