[comp.windows.x] picture display under X

jmm@LAGUNA.JPL.NASA.GOV (Jan Martin) (08/16/90)

A request for help:

I am using OpenWindows(X11) on a SparcStation 1+ and I'd like to display a 512x512 picture with 8-bit pixel values, but I can't find any X function which will do the trick.  Setting the color map is easy, but how do you display a row or region of pixels which is stored as, say, a char array?
It seems like using either an image or pixmap would be required, but the documentation on the formats is unclear -- if XYPixmap really requires separating all the bits out into bitplanes, that seems rather cumbersome and inefficient.

Perhaps this is a trivial question with an obvious answer.  If so, please excuse my ignorance--any help would be gratefully received.

Thanks,
Jan Martin
Jet Propulsion Lab

mouse@LARRY.MCRCIM.MCGILL.EDU (08/29/90)

> I am using OpenWindows(X11) on a SparcStation 1+ and I'd like to
> display a 512x512 picture with 8-bit pixel values, but I can't find
> any X function which will do the trick.  Setting the color map is
> easy, but how do you display a row or region of pixels which is
> stored as, say, a char array?  It seems like using either an image or
> pixmap would be required, but the documentation on the formats is
> unclear -- if XYPixmap really requires separating all the bits out
> into bitplanes, that seems rather cumbersome and inefficient.

Right; that's what ZPixmap format is for.

I would suggest creating an XImage structure pointing to your data and
using XPutImage (either directly to a window or to a pixmap which you
then XCopyArea to the window - trading speed for server-side memory).

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

jimf@SABER.COM (08/29/90)

> I am using OpenWindows(X11) on a SparcStation 1+ and I'd like to
> display a 512x512 picture with 8-bit pixel values, but I can't find
> any X function which will do the trick.

Code to do this from an arbitrary-depth image to an arbitrary-depth
display (except TrueColor and DirectColor visuals) can be had from
send.c in xloadimage 1.06, available by anonymous ftp from
expo.lcs.mit.edu in /contrib/xloadimage.1.06.tar.Z.  This code works
fine under OpenWindows.

Happy hacking,

jim frost
saber software
jimf@saber.com

raveling@unify.com (Paul Raveling) (08/31/90)

In article <9008291521.AA14077@armory>, jimf@SABER.COM writes:
> > I am using OpenWindows(X11) on a SparcStation 1+ and I'd like to
> > display a 512x512 picture with 8-bit pixel values, but I can't find
> > any X function which will do the trick.
> 
> Code to do this ... can be had from
> send.c in xloadimage 1.06, ...

	Since shifting to a (yuch) monochrome SPARCstation 1 I've
	ironed out a couple minor bugs in the Img Software Set that
	sabotaged it on monochrome Suns.  I'm now displaying assorted
	1-deep, 8-deep, and 24-deep images in glorious black & white.
	Resolution sucks due to color getting compressed to gray scale,
	then dithered, but so be it.  Having 1 plane is a hardware problem.

	Would there be enough interest in this copy to warrant trying
	to make it available?  We don't have ftp access.


------------------
Paul Raveling
Raveling@unify.com

	P.S.:  My wish list for R5 is:

	Simplicity.