Re: XForms: blitting images

Steve Lamont (spl@szechuan.ucsd.edu)
Fri, 9 Apr 99 08:46:18 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> I've got a 320x240 image in raw rgb values that I want to display. Is
> there anyway to do this directly without first converting it to
> something like a pixmap? ...

Unless you use some other API such as OpenGL, you probably do need to
use a Pixmap. You can, of course, write the image directly to the
Window with XPutImage, which will take as the Drawable arguement
either a Pixmap or a Window XID, but then you'll have to handle any
Expose events to redraw the image if part of the Window is obscured
and later exposed. Since this means a trip to the server each time,
it's better to use the Pixmap since Pixmaps are handled in the server
itself.

One word of warning -- if you want your code to be portable to other
systems, you should query the allowable depths and Pixmap formats with
XListDepths() and XListPixmapFormats(). On some machines an RGB
pixels is 4 bytes rather than three (to allow for an Alpha channel,
for instance).

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/