home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
580a.lha
/
HDFView_v3.01
/
hdfview.doc.pp
/
hdfview.doc
Wrap
Text File
|
1991-12-05
|
11KB
|
282 lines
ImageView v3.0
: A Utility for viewing HDF image files.
(c) 1991 Richard A. Gerber
This program is freely distributable. Do with it whatever you wish.
However, be warned, this program is not meant to be more that a quick
and dirty way to view NCSA image files on the Amiga. Hopefully, this
viewer will produce a good representation of the image and be nice
to the Amiga system, but I make no guarantees. (I am not, after all,
a programmer.)
(NOTE: This program is in no way associated with the National
Center for Supercomputing Applications (NCSA), although the HDF
routines are theirs. Direct all complaints to me.)
All that said, I wanted to be able to view NCSA HDF image files on my
Amiga. Since I had already ported most of the HDF library, the only
problem was that HDF RIS8 images use 256 colors from a
palette of (256)^3 colors. My solution: HAM-E by Black Belt Systems.
The HAM-E unit produces a very nice rendering of the HDF image files,
the main disadvantage being its resolution limit of 320x400.
This program now demands AmigaOS 2.04 (probably it can get away with
any 2.0x). I have no documentation for 2.0, however, so it will still
be a while until I get a handle on all the available screen sizes and
resolutions. (What is this autoscrolling feature?). In any case, images
large than the screen resolution will be truncated, ie. no scrolling.
However, in principle, you can save the image as an IFF file and then
use a viewer (like Mostra) to scroll around in the picture. (I have found
a slight bug in the iff.library routines that save some screen
sizes incorrectly).
You can start HDFView from either the Workbench or Shell
NOTES:
You need iff.library (included) to be in your libs: directory.
You need hame.library in your libs: directory if you want to use
the HAM-E modes.
I've tested this only on my A2000 w/GVP 68030/68882. The binaries
have been compiled for any 68xxx processor. As there are virtually no
floating point operations in the current version, I have not included
any 68030/68882 version.
No attempt is made to preserve aspect ratios, etc. (However, aspect
ratios in the postscript output file should be correct.) One pixel is
drawn for every entry in the image array. Therefore a 250x250 image
will be 250x250 pixels.
PROGRAM OPERATION:
When you start the program from either the Workbench or from the CLI
the program opens two screens: one where the images will be rendered
and a second screen with gadgets to control the program. The title screen
(if available) is shown on the image screen.
Once you have both screens open you can use the right mouse button (RMB)
to send them to the front/back. Click the RMB anywhere on the gadget screen
to make it go away. Click the RMB anywhere in the image screen to make
the gadget screen reappear. You can slide the screens around by using
the 2.0 keypress/left mouse button trick.
There is one (kind of) wierd thing about the way the HDF library
operates: If you try to open a file (be it an image or a palette) twice
in a row, the function call to open it a second time will fail. Remember
this if you open a palette, fiddle with it, then try to reload it again.
You will have to load a different palette, then reload the original
one.
Further interaction with the program takes place via the gadgets, which
are described below:
QUIT:
Quits.
INFO:
Gives me credit. Also shows image size and free memory.
Use the close gadget on the window to continue.
FILE:
Presents you with 5 new gadgets:
Open:
Brings up a file requester for you to choose an image
file. By default, only files with an .hdf extension are
shown. To see all files, rub out the #?.hdf pattern
in the file requester. If the open call is successful
the image will be rendered using the palette (if
available) stored with the image.
Next:
Loads and displays the next image in an hdf file.
If there are no more images in the file, you are informed
of this by a requester and the Next gadget is then ghosted.
SaveIFF:
Brings up a file requester to allow you to save whatever's
on the image screen to an IFF file. I am using the
PD iff.library. It usually seems to work well, but I
have noticed a few screen sizes that it saves incorrectly.
SavePS:
Brings up a file requester to allow you to save whatever
image you have loaded as a 256-gray shade postscript
image. I haven't included any bells and whistles here,
but try this option if you have a postscript printer. You
can always edit the postscript file yourself if you want
more control over the output.
Main:
Takes you back to the main deck of gadgets.
Palette:
Takes you to a another deck of gadgets.
Show:
Shows the current palette in a window on the image screen.
Clicking Show again removes the window.
You can drag the palette window around. However, if you have
a HAM-E screen open this can cause problems in two ways.
(1) If you place the window on an odd pixel it will display
incorrectly. The program will fix this problem itself if
you activate any window other than the palette window.
(2) It's possible that you could place the window such
that the HAM-E unit will turn off. HAM-E turns itself off
if it detects a full scan line of color 0. The fix for
this is to try to move the palette window such that there
never is a full line of color 0. Usually this can be
accomplished by moving the window away from the left
hand edge of the screen.
Load:
Brings up a file requester for you to load an HDF palette
file. By default the requester looks for the file extension
.pal. The program will only load HDF files that contain
palettes. It seems that many NCSA HDF utility programs like
to produce 768-byte raw palettes. If you have one of these
use the utility "paltohdf" to convert them to HDF files.
Save:
I haven't implemented this yet. Sorry.
Next there are three slider gadgets to show you the color levels and
let you fiddle with them. The three gadgets represent the
standard RGB color levels. If you click anywhere in the image
screen, the color underneath the pointer will be reported by
these gadgets. If you are using standard Amiga screens, the
Color Level values will range from 0-15 or 0-31 depending on the
screen resolution. The intensity, reported to the right of each
RGB gadget, ranges from 0-15.
If you are using HAM-E the Color Level will range from 0-255. The
intensity will range from 0-255 for each of R,G,B.
Once you have chosen a color level by clicking on the image screen
you can change the colors by using the slider gadgets.
Main:
Takes you back to the main deck of gadgets.
Screen:
Takes you to another deck of gadgets from which you choose
screen resolutions.
LORES:
A 32-color low-resolution Amiga screen.
LACE:
A 32-color low-resolution interlaced Amiga screen.
HIRES:
A 16-color high-resolution Amiga screen.
HILACE:
A 16-color high-resolution interlaced Amiga screen.
Ham-E:
A 256-color low-resolution HAM-E screen. You won't see
this gadget unless you have hame.library in your LIBS:
directory.
HELACE:
A 256-color low-resolution interlaced HAM-E screen.
You won't seen this one either unless you have
hame.library.
Main:
Back to the main deck of gadgets.
ERROR MESSAGES:
I've tried to do adequate error checking in the program. If
the program won't run, it should tell you what the problem is.
KNOWN BUGS:
* Some PS files will not print on our Apple Personal LaserWriter. These
files print OK, however, on a SparcPrinter and the PD program Post
shows the source to be OK. I think it's a memory management problem
with the printer, but since it does not have an interactive mode
and Apple tries to hide the inner workings of everything they make,
I don't know what is going on.
FUTURE:
* Color postscript printing
* Background printing
* Animations
* User aborts of print and drawing jobs while in progress
* Saving of palettes
* Contour plots (including color)
* Ability to print contour plots
* Preferences printer support
* Screen scaling to preserve aspect ratio
* Screen scrolling
* User definable scaling
MORE NOTES:
Please let me know if something about the program doesn't work. Also
let me hear any suggestions you may have as to how to improve the
program. I have made a very consious effort to conform to Amiga programming
guidelines with the program.
The source code is available if you want it. Just ask (see address
below). The source code for the HDF routines is available from NCSA
by anonymous ftp at ftp.ncsa.uiuc.edu. The Amiga-ized (SAS/C v5.10a)
HDF source is available either from NCSA or me. I also have available
the compiled HDF library for the Amiga.
Regards,
Richard Gerber
Physics grad student
University of Illinos at Urbana-Champaign
gerber@rigel.astro.uiuc.edu
u12696@u2.ncsa.uiuc.edu
Revision History:
v1.01
* Fixed bug that crashed system if non-HDF chosen from file requester.
* Fixed bug that crashed system if file requester chosen while info
window was open.
* Fixed bug that didn't return 40 bytes of memory on error exit.
v1.02
* Fixed another nasty bug that crashed machine if a non-HDF image file
was chosen from file requester.
* Added interlace option for 256 and 32 color screens.
* Reduced drawing time a bit for some images.
v1.03
* Added contour window
* Initial screen is now 32-color lo-res.
v1.04
* Added postscript greyscale printing support
v1.04a
* Sped up postscript file writing routine
v1.04b
* Made postscript output look nicer
* Added menu item to read next image from a file
* Fixed bug that crashed system if invalid postscript filename given
v1.05
* Added ability to read scaling info if accompanied by SDS min/max info.
* Added scale to postscript output
* Generally cleaned a few things up
v1.06
* Fixed bug in postscript dump routine that couldn't handle images
that weren't integral multiples of 256.
v2.0
* Added HAM-E support.
- Removed menus and added gadgets.
- created two separate screens.
* Removed contour plot option (use hdfcontour program)
v2.01
* Added support for HDF palettes.
* Added gadgets to manipulate colors.
v2.02
* Added support to save images as IFF files.
* Deleted command-line options and filename passing.
v3.0
* Updated program to use 2.04 functions.
- standard file requesters
- new window look
* Now writes error messages to requesters rather to stderr.
* Creates screens as large as the images (unfortunately I don't know
how to implement the autoscroll feature of 2.0 yet).
v3.01
* Fixed bug that fouled up system upon exit when started from interlaced screen
and using HAM-E.
* Fixed font problem related to color gadgets
* Removed enforcer hits when click LMB on HAM-E "cookie"