home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
progm
/
grafx.zip
/
GRAFX.DOC
< prev
next >
Wrap
Text File
|
1989-05-09
|
19KB
|
449 lines
FORTRAN GRAPHIC EXTENSION LIBRARY FOR FORTRAN 77
(C) Copyright 1988, 1989 by Jim Farrell All Rights Reserved.
The GRAFX library consists of over 50 routines, which extend ANSI standard
FORTRAN 77 to access the PC's video display graphics capabilities and SELECTED
DOS services from FORTRAN programs. These routines are used extensively in
scientific and engineering applications, including:
o CARTOGRAPHY
o ORBITAL MECHANICS
o AERODYNAMICS
o STATISTICS
o OPERATIONS RESEARCH
o SIGNAL PROCESSING
Emphasis is on ease of use and rapid presentation of numerical data. The GRAFX
library has proven to of great value in visual validation of numerical
software algorithms and tools. Hardcopy paper plots can be made on a graphics
printer by invoking the DOS GRAPHICS command, then using the SHIFT and PRINT
SCREEN keys when a copy of the screen is desired.
GRAFX is EASY to use! If you use FORTRAN, you can take advantage of your PC's
video graphics capabilities. The top level routines were designed to be easy
to use and avoid features which would add complexity. No training or
instruction is required to use GRAFX. The library and included examples
provide everything you need to start using your PC's graphic capabilities.
GRAFX's simplicity makes it ideal for research & development, engineering
prototyping, teaching of numerical applications, or as part of a numerical
laboratory.
GRAFX is compact! While the entire library is only about 30K bytes, the low
level graphic primitive routines take only about one kilobyte. Since GRAFX is
distributed in library (.LIB) format, only the required routines are
selectively linked with your application.
GRAFX is fast! Display memory is directly manipulated, rather than using the
slower DOS and BIOS calls to light pixels. Line and shape drawing algorithms
were selected to maximize graphic performance.
The GRAFX design includes tri-level access to the PC's graphic display. At the
highest level, no knowledge of PC hardware or graphic techniques is required.
At the middle level, powerful routines allow creation of custom displays. At
the bottom level, direct access to display hardware maximizes performance. The
following sections describe each level in detail.
TOP LEVEL. At the highest level, the GRAFX library presently provides several
routines for producing plots. These routines are implemented in FORTRAN and
are hardware independent. These include:
XYPLT - Produces a x-y plot of data. The data is automatically
scaled and displayed. The maximum and minimum values are
listed. X & Y are passed as real arrays. Up to three plots may
be displayed on the screen by successive calls with iv=1..3. Ip
determines the display type: ip=0, plots points; ip=1, plots
histogram like lines from y=minimum to y(i); ip=2, plots
histogram like lines from y=0 to y(i); ip=3, plots from (0,0)
to (x,y); ip=4, plots a connected line. A WARNING is issued if
the data range seems inappropriate for the selected ip. The
usage is:
CALL XYPLT(X,Y,N,IV,IP)
TPLOT - Produces plots similar to XYPLT for equally spaced
data. Only the extreme values of the x range need be provided.
TPLOT is useful for time series data. The usage is:
CALL TPLOT(XMIN,XMAX,Y,N,IV,IP)
FCNTPLT - Produces plots similar to XYPLT for a function
y=fcn(x). Only the extreme values of the x range and the number
of points required need be provided. FCNTPLT is useful for
examining the shape of special functions. The function must be
declared intrinsic or external in the calling program. The
usage is:
CALL FCNPLT(XMIN,XMAX,FCN,N,IV,IP)
EXTERNAL FCN
or
INTRINSIC FCN
MULPLT - Sets a problem space window and permits overlayed
display of multiple data sets through successive calls. The
first call sets the plot limits.
CALL MULPLT0(XMIN,YMIN,XMAX,YMAX)
The second and successive calls pass the arrays to be plotted,
the number of points and specify the line style. IP determines
the display type ip=0, plot a point; ip=1, plot a histogram
like line from y=minimum to y(i); ip=2, plot a histogram like
line from y=0 to y(i); ip=3, plot from (0,0) to (x,y); ip=4,
plot a connected line.
CALL MULPLT(X,Y,N,IP)
HIST - Computes and displays a histogram of the distribution
of x. The n occurrences of x are counted in 100 equally spaced
bins and the maximum occurrence is listed. The usage is:
CALL HIST(X,N)
A typical sequence for using these routines is:
CALL GSET ! enter graphics mode
CALL XYPLT(X,Y,N,0,4) ! draw the plot
CALL PAUSE('MESSAGE') ! review plot
CALL ASET ! return to alpha mode
As this illustrates, no knowledge of the inner workings and hidden mechanisms
of PC graphic hardware is required. One loads data into arrays X & Y, switches
to graphic mode and invokes the routine. The call to PAUSE puts the 'message'
on the bottom line of the display and waits until a key is depressed,
permitting time to review the plot(s). Returning to alpha mode clears the
screen. The example programs included on the installation diskette contains
examples of the usage of each of the top level routines.
MID-LEVEL. The middle level GRAFX functions are invoked by the high level
routines. After setting the problem space window and display space viewport,
the routines are called using problem space units. Scaling and conversion to
the display space viewport is automatic. The mid-level routines are written in
FORTRAN. Two key mid-level routines are:
CALL WINDOW(XPMIN,YPMIN,XPMAX,YPMAX) - Sets the problem space
window. Units are the extremes of the problem at hand: altitude
in feet, time in seconds, etc. The origin is at the lower left.
The default range is 0.0 to 1.0 in both x and y. Another way to
visualize these limits is: CALL WINDOW(LEFT,BOTTOM,RIGHT,TOP).
CALL VIEW((IXDMIN,IYDMIN,IXDMAX,IYDMAX) - set the display space
viewport. Units are pixels with the origin at the lower left.
The defaults are: x ordinate, 0 to 639; y ordinate, 0 to 199.
The use of WINDOW and VIEW to create multiple displays on the screen is
illustrated by the example program VEIW9 included on the distribution
diskette.
The following two mid-level routines convert from problem units to display
units and invoke low level routines to light points and draw lines.
CALL POINT(X,Y) ! DRAW A POINT
CALL LINE(X1,Y1,X2,Y2) ! DRAW A LINE
LINE is called in turn by the following geometrical shape generators which
work in problem units.
CALL CIRCLE(X,Y,R) ! DRAW A CIRCLE
CALL ARC(X,Y,R,AB,AE) ! DRAW AN ARC
CALL BOX(X1,Y1,X2,Y2) ! DRAW A BOX
CALL ELLIPSE(X,Y,A,B,ANGLE) ! DRAW AN ELLIPSE
Several auxiliary routines are included to annotate and control the display.
PAUSE, ERROR, and WARN output a message on the bottom line and wait for a
keystroke. INFO outputs an advisory message on the bottom line and continues.
The usages are:
CALL CURSOR(ROW,COLUMN) ! POSITION THE CURSOR
CALL PUTSTR(ROW,COLUMN,'TEXT') ! OUTPUT A STRING
CALL PAUSE('MESSAGE') ! WAITS FOR A KEYSTROKE
CALL ERROR('MESSAGE') ! WAITS FOR A KEYSTROKE
CALL WARN('MESSAGE') ! WAITS FOR A KEYSTROKE
CALL INFO('MESSAGE') ! DOES NOT WAIT FOR A KEYSTROKE
The middle level GRAFX routines provide the tools to create custom plots for
specific applications. Limit checking of points and clipping of lines is not
done. It is assumed that the user has defined appropriate problem space
limits. A clipping routine is provided in the library for applications
requiring clipping.
LOW LEVEL. At the lowest level GRAFX consists of subroutines implemented in
INTEL 8086/88 assembly language. These routines provide the FORTRAN/assembly
language interface, invoke DOS and BIOS services, perform vector to raster
conversion, and directly draw points and lines in the graphic display memory.
These routines use sixteen bit arguments (INTEGER*2) and IBM screen coordinate
conventions. Their use requires a fairly detailed understanding of the PC.
CALL GSET ! enter graphic mode
CALL GCLS ! clear graphic memory
CALL ASET ! enter alpha mode
CALL ACLS ! clear alpha memory
CALL PSET(X,Y) ! turn on the pixel at x,y
CALL PCLR(X,Y) ! turn off the pixel at x,y
PTST(X,Y) ! test the pixel at x,y
CALL PLINE(X1,Y1,X2,Y2) ! draw line
CALL PCURSO(ROW,COLUMN) ! position the cursor
CALL PUTCH(CH) ! put a character
CALL BEEP ! beep the speaker
CALL REPLY ! wait for a keyboard entry
CALL LCLR ! clear to end of line
MISCELLANEOUS ROUTINES. Many miscellaneous routines are included in the
library. These provide bit level access, shift, and logical (AND, OR, NOT,
EOR) operations required by some applications. A standard pseudo-random number
generator is included in the GRAFX library to support the examples. Routines
to get time-of-day, time in seconds, and date are included. A vector clipping
routine is included which can be used to clip a problem space vector before
calling LINE. If you really want to get down to the bits and bytes PEEK & POKE
routines are included to access any location in the 8086 address space.
Programmer notes provide the details on how to use each routine in the GRAFX
library, recommendations on preferred usage, and warnings on pitfalls to
avoid. GRAFX programmer notes are in the file NOTES.DOC on the distribution
diskette.
COMPATIBILITY. GRAFX uses the IBM CGA "high-resolution" 640 X 200 pixel
monochrome graphics (mode 6). CGA is the most widely available graphics mode
on the PC. While CGA graphics has several design limitations, including a non-
square pixel/aspect ratio, lack of a scalable graphic character set, and a low
vertical resolution, GRAFX compensates by generating shapes in problem space.
The (optional) use of a 8087 numeric coprocessor makes the conversion to
display space efficient (about 20X faster). Further line drawing speed is
achieved through the use of assembly language routines to perform vector to
raster conversion and directly manipulate display memory instead of using BIOS
& DOS INT services. These routines have been tested with the IBM PC/XT/AT,
clones and compatibles with and without numeric coprocessors.
GRAFX is a FORTRAN extension that can save you time and money in solving
problems and communicating results. GRAFX is ideal for academic computing
where programming the incidental means to an end (e.g. teaching numerical
methods) and for prototyping of engineering systems. Several complete examples
are included. Additional library routines are available which support
geographic displays, numerical analysis, orbital mechanics,and numerical
simulations. For further details, custom requirements, and source code
availability; contact:
Jim Farrell
Ridge Technology
1867 Park Road, N.W.
Washington, D.C. 20010
(202) 232-1441
GRAFX DISTRIBUTION POLICY
(C) Copyright 1988, 1989 by Jim Farrell All Rights Reserved.
GRAFX is the property of Jim Farrell and is distributed by RIDGE TECHNOLOGY.
Individuals are granted a limited license to use GRAFX, and to copy and
distribute it, provided that the following conditions are met:
1) No fee may be charged, except a nominal fee to cover duplication
and mailing costs.
2) The GRAFX library and documentation files may ONLY be
distributed in their original, unmodified state.
3) GRAFX may not be distributed, in whole or in part, as part of
any commercial or government product or service without the express
written permission of Jim Farrell.
If you use this program on a regular basis register your copy. By registering
your copy, you will:
o Receive a CURRENT copy of the distribution diskette
o Get one year of technical support - by phone or written
o Be notified of updates & new products
o Provide input and ideas to help shape future products
o Help to keep software prices down, by supporting a
distribution method which doesn't rely on expensive
advertising campaigns.
GRAFX is user supported software. This means that you may copy it freely and
give the copies to anyone you wish, at no cost. They, in turn, are also
requested to register their copy if they decide to use it.
The user supported software concept (often referred to as shareware) is an
attempt to provide wide distribution of software at a low cost. It reduces the
cost of offering a new product, and hence permits many independent authors and
small companies to develop and promote products to meet the many needs of PC
owners. User supported software is a new marketing channel, where products can
be introduced at low cost.
With user supported software, everyone benefits. The user benefits by having
access to quality products at low cost, and is able to "test drive" software
thoroughly before purchasing it. The author benefits by being able to enter
the commercial software arena without first needing large sources of venture
capital.
The method only works with your support. Not just for this product, but all
user supported software. If you obtain a user supported program from a friend
or colleague, and are still using it after a couple of weeks, it is obviously
worth something to you, and it should be registered.
SITE LICENSE AGREEMENTS
Commercial and government users must obtain a site license for the use of
GRAFX. Use the order form in this manual to obtain a site license. Site
licenses are granted as of when we receive your payment. Enclosed is a site
license agreement, which should be signed and sent with your payment when
ordering a government or commercial site license. A site license does not
include additional copies of the GRAFX program disk and the GRAFX manual.
Instead, you make your own copies of the disk and manual as you need them. If
you wish, you can order additional program disks from us. See the order form
included for more details.
PROGRAM SITE LICENSE AGREEMENT
Jim Farrell provides this program and licenses its use. You assume
responsibility for the selection of the program to achieve your intended
results, and for the installation, use and the results obtained from the
program. The use of GRAFX in a commercial environment or government
organization is granted under the following terms:
1. Payment of the license fee must be made to Jim Farrell. The fee
is based on the number of computers on which GRAFX will be used, as
follows:
1 to 9 computers $35 each
10 to 24 computers $25 each
25 to 49 computers $20 each
50 to 99 computers $15 each
over 99 computers $1500 one time fee
2. You may use GRAFX on the number of computers included in the
license fee. If you have paid the fee for over 99 computers, then
you may use GRAFX on any number of computers within your
organization.
3. You may make copies of the program and documentation, in their
original, unmodified form, without restriction. You may distribute
these copies without restriction.
4. If these copies are distributed outside of your organization,
you have no obligation to control the use of those copies which are
outside of your organization.
5. You may not modify the program or charge a fee for copying or
distributing the program or its documentation.
6. It is your responsibility to make the necessary copies and to
deliver them to the computers which they will be used on. If you
wish, you can order additional GRAFX distribution diskettes.
I agree to abide by the terms and conditions of this license.
_____________________________ _________________
Signature Date
_____________________________
Name (please print or type)
_____________________________
Title
_____________________________
Company
ORDER FORM
Check which items you wish to purchase:
[] Non-commercial license for the use of GRAFX at $29.95.
[] Commercial license for the use of GRAFX on ___ computers (see
attached price schedule and terms).
[] Distribution disk with documentation (only on orders of
$50.00 or more, not counting maintenance contracts).
[] ____ additional disks at $10.00 per disk.
[] One year maintenance agreement at $50.00 per year.
[] Payment of $ ____.__ is enclosed (check or money order).
_________________________________________
Name
__________________________________________
Address
_______________________ _____ __________
City State Zip
Mail this completed form with payment to:
Jim Farrell
RIDGE TECHNOLOGY
1867 Park Road, N.W.
Washington, D.C. 20010
Phone: (202) 232-1441
For program disk orders outside the U.S., please add an
additional $5, and enclose an international money order payable
in U.S. currency.
For commercial site license orders, please enclose a signed copy
of the site license agreement.