From: MAHAN@GRUBNIK.TGV.COM
Newsgroups: comp.os.vms
Subject: Re: XImage display problem
Date: 10 Apr 92 19:01:32 GMT
Organization: The Internet

In article <57179@cup.portal.com> you write:
	[omitted]
#
#   After two days of racking my brains I've managed to write an application
#that reads a high-resolution 24-bit image, samples it down to "display 
#resolution," places the resulting data in a ZPixmap-type Ximage, and 
#XPutImage()-es it to a window.  Alas, after trying every conceivable 
#combination of arguments to XCreateImage() and XPutImage(), the best I
#have been able to achieve is a horizontally-"sliced-and-shuffled"-looking
#attempt at the desired image.  I.e. I can see that the image is THERE,
#but the scanlines seem to be interleaved AND the first dozen or so don't
#appear AT ALL -- just solid background-pixel where those lines ought to
#be.  24-bit COLOR seems to be working -- the sliced images have the right
#colors in the right general areas -- but I've been racking my brains and 
#can't get the STRUCTURE together.
#

This is due to the fact that you are not correctly building the XImage
structure.  The X Server doesn't support 24 bit boundaries which is what
I believe is causing you problems.  Try setting the XImage fields to the
following values:

	.byte_order	= LSBFirst;
	.bitmap_unit	= 32;
	.bitmap_unit_order = LSBFirst;
	.bitmap_pad	= 8;
	.red_mask	= 8;
	.green_mask	= 8;
	.blue_mask	= 8;

You will then need to build the image data to be units of 32 bits (not
24)  Load the RGB values into the lower 24 bits and set the upper 8 bits
to 0.  Also, check the infomation returned (use the X11R4 version of
xdyinfo) to determine the proper rgb mask to set.

#
#   It's highly possible that with the right manuals I could work this out,
#but we don't have any DECwindows programming documentation (to say nothing
#of Motif, another animal about which I/we know even LESS) and no budget
#to even consider ordering same.  I don't have C so am writing in Macro
#assembly against the "VAX bindings."  Nonetheless, based on a combination
#of C source code (from this Net and elsewhere), SYS$SHARE:DECW$*.MAR files,
#a terse "Xwindows Programming Reference" book, and notes from Digital's
#own DECwindows Programming courses (I and II) which I took in 1990, I've
#managed to cobble together a few feeble (but working) DECwindows applica-
#tions.  What I LACK is mostly the "big picture," of how it all fits to-
#gether.  I've got a book that lists all the routines and their arguments, 
#but nothing that says what those routines DO and what the arguments (data
#structures and their fields, e.g.) MEAN, and how they all INTERACT.  I've
#really shaken the bushes just to get this far.
#

If you can get the book X Window System by Robert Scheifler, et al.  It 
is published by Digital Press.  It can be found in most bookstores and
sells for around $30 to $40 dollars.  You really need this book as it
is considered the BIBLE of X Windows system.

#   I'd appreciate any input from anyone familiar with the behavior of 
#XCreateImage() (aka X$CREATE_IMAGE), particularly the "pad" and "quantum"
#arguments, and with XPutImage(), and with DECwindows/Motif behavior 
#with a "TrueColor" visual class.  Post and/or mail, I read this group 
#religiously!
#

My examples relate to C but could easily translate into Macro.

--
Patrick L. Mahan

--- TGV Window Washer ------------------------------- Mahan@TGV.COM ---------

Waking a person unnecessarily should not be considered  - Lazarus Long
a capital crime.  For a first offense, that is            From the Notebooks of
							  Lazarus Long