[comp.sys.sun] imagetool under SunOS 4.0.3

adm@apollo.drexel.edu (Administration) (10/20/89)

We have a system consisting of 3 Sun-3's and 2 SPARCstation-1's, all
running SunOS 4.0.3.   When we obtained the SPARCstations, we copied over
the source code for imagetool and compiled it using the Sun-4 option.
When imagetool was then executed, some problems arose.  Specifically, when
an image was initially read in it would be displayed distorted (appearing
as though, perhaps, the dimensions had not been specified properly).  If
the image was then magnified using 'zoom', the expanded display was
correct, except for a white diagonal stripe or two that would appear
across the image.  We obtained the latest version of the source code from
NCSA, and it turned out to be identical to the source we already had.
There is no special option for compiling on a SPARCstation, so we thought
perhaps that the Sun-4 compilation was not correct for these machines.  To
check it, we recompiled the Sun-3 version of imagetool.  The result: when
imagetool was recompiled on the Sun-3, the same problem occurred.  We have
therefore concluded that this is a problem with compiling imagetool under
the new operating system and is not a machine related problem.  When we
use the old binary for imagetool on the Sun-3's, which was compiled under
SunOS 3.x (probably 3.5, but possibly earlier), everything is fine.  When
we use the new binary, imagetool cannot read images properly.

We have now re-installed the old binary on the Sun-3's, and imagetool is
working fine on these systems, but we cannot use imagetool on the
SPARCstations.

We know that there are changes in the new OS in the way libraries are
linked and in the way sunview is implemented.  The dynamically linked
libraries give a much smaller binary file, but could they also be
responsible for the problem we are seeing?  Sunview might be to blame, of
course, but it really looks like the problem is in reading and/or
manipulating the data from the image file, and not in the graphics
interface.

Does anybody know of a workaround for this problem?  Are there any ideas
as to either the cause or the solution?  Respond in Sun-Spots, or directly
to me and I'll summarize the responses.  Thanks in advance.

adm@artemis.drexel.edu (Administration) (10/24/89)

I would like to thank all of those people who responded to my question
about imagetool under SunOS 4.0.3.  I won't mention them all here, but I
will thank particularly those who supplied me with the first explanation
of what is happening (Henry McGilton from Sun) and the first idiot-useful
translation of that explanation (Thomas Reed at U. of Hawaii).  The
problem stems, apparently, from the difference in the new pixrect library
under 4.x.  According to Mr. McGilton:

The problem you are having is almost certainly due to the new pixrect
library.  In SunOs 4.0, the way that pixrects are done in memory changed
from the 3.x versions.

In 3.x, pixrects were padded to 16 bits always.

In 4.x, pixrects are:

	o  either 16 bits, or,
	o  padded to a multiple of 32 bits.

Also, according to Mr. McGilton, this is documented on page 53 of the new
pixrects manual, although not very well.  Now, all this is fine and good,
but fairly meaningless unless I know how to make it all work.  The
'translation' of this, as provided by Mr. Reed, is as follows:

...The problem lay in the fact that sunview punts if the image x dimension
is not evenly divisible by 4.

This jibes well with the technical explanation, as I knew that under the
old OS (with 16-bit pixrects) the x-dimension had to be divisible by 2.
Now, with 32-bit pixrects, the x-dimension must apparently be divisible by
4!  I tried it, it worked.  Thanks again!