home *** CD-ROM | disk | FTP | other *** search
- Contents of DRAWFILE library 8 Dec 91
-
- ************************************************************************
-
- C O P Y R I G H T N O T I C E
-
- Copyright D.J & K.M. Crennell,
- P.O. Box 64, Didcot, Oxon, OX11 0TH.
-
- This software is in the Public Domain and may not be sold or included in any
- program that will be sold, without written permission from the authors.
-
- The authors must be given credit in any publications using this software.
-
- The software may be copied and distributed as long as no changes are made
- and this copyright notice is included. Please send any suggested
- improvements to the authors.
-
- In no circumstances shall the authors be liable for any damage, loss of
- profits, or any indirect or consequential loss arising out of the use of
- this software or inability to use this software, even if they have been
- advised of the possibility of such loss.
-
- The authors do their best to ensure that this library is distributed virus
- free.
- ************************************************************************
-
- This library is in Fortran77 and the source is stored in f77.DrawF
-
- **** Warning this library is still being developed. Routines prefixed
- with a * have not been tested. ****
-
-
- All routines in this library begin with the prefix DR
-
- To make a Draw File, call the steering routine DRFILE. This will then call
- the user routines, one for each type of object.
-
-
- SUBROUTINE DRFILE(PSIZE,FNAME,IER)
- Control routine, calls the user routines to make the co-ordinate pairs for
- path objects, the characters for text objects etc. and writes the
- Drawfile FNAME. IER is returned zero for a good write, otherwise contains
- the error number. PSIZE is a character *3 page size, allowed types are:
- Flag value character size
- 0 blank that of the largest object
- 1 A4L 297,210 mm
- 2 A4P 210,297 mm
- 3 A5L 210,148 mm
- 4 A5P 148,210 mm
- IER returns 5 if object too big for page requested
-
- There is an internal labelled common
-
- COMMON/DR/LP,SCALE,MINPX,MINPY,MAXPX,MAXPY,
- 1 MINBOX,MINBOY,MAXBOX,MAXBOY,LBUF(1024)
- LP is page size flag in table above
- SCALE is 1mm in internal Draw units (PRM p1489) SCALE=180*256/25.4
- MINPX,MAXPX etc are bounding box for whole picture (A4 by default)
- MINBOX,MAXBOX etc are bounding box for the current object
- LBUF is buffer for storing the constructed of DrawFile object in memory
-
- User Routines
-
- There is a routine for each draw object type which should be written by the
- user for each type needed. They each return a count of points or
- characters; on the first call, this count is zero on entry. They return the
- count 0 or negative when there are no more objects to be converted.
-
- SUBROUTINE DRPOL(ARRAY,MAXPR,NPTS,L1,L2,L3,L4,IER)
-
- Sets up a polyline.
- Defines lines for a 'Path Object' as NPTS co-ordinate pairs in the
- 2 dimensional array, ARRAY(2,MAXPR). NPTS is returned.
- The user should check that <= MAXPR pairs are stored in ARRAY.
- The Ith x,y pair is stored in ARRAY(1,I),ARRAY(2,I).
-
- To make a polygon, make the first and last points the same.
-
- The units are mm, which are scaled to 'Draw' units within the package before writing out.
-
- L1,L2,L3 are the 1st three words of a Path object (se PRM p 1793)
-
- L1 = -1 if not filled, otherwise = colour of fill as Red Green Blue
- e.g=?IBBGGRR00 where BB= hex value for amount of blue required
-
- L2 = colour of outline (0=black)
-
- L3 = line width 0=minimum width
-
- L4 = is related to the fourth word, the joint specification is fixed,
- there are 5 line styles, corresponding to the ones in Draw
- 0 solid line (default set on entry)
- 1,2,3 dashes/spaces increasing size
- 4 dash dot pattern
-
- On the first call, on entry these are set to the defaults above; on other
- calls they are unchanged.
-
- IER = error return, user should set this to 99 when one of their error
- conditions is found
-
- SUBROUTINE DRCHAR(CHARAY,MAXCHR,NCHARS,L1,L2,L3,L4,XL,YL,IER)
- User subroutine which puts NCHARS ( NCHARS < MAXCHR) characters into
- array CHARAY, and sets up lower left corner of start of text.
-
- L1 = text colour (0) (specified as in DRPOL above)
- L2= hint colour (?IFFFFFF00)
- L3=font no (style) (0)
- L4= font size in 'points' (12) (assumed same for x and y)
-
- On the first call, on entry these are set to the defaults above;
- on other calls they are unchanged.
-
- XL,YL = lower left corner of start of text units are mm
-
- IER = error return, user should set this to 98 either when one of their
- own error conditions is found or they want >MAXCHR characters
-
- *SUBROUTINE DR??? (for other object types not written yet)
-
- DR Library Utility routines
-
-
- SUBROUTINE DRCHEK(IER)
- checks that the object size is less than the page size, otherwise sets
- IER=5 on return
-
- SUBROUTINE DRHEAD(IER)
- sets up the 10 word header for the Drawfile in LBUF, sets LB, length of
- LBUF used so far, puts the page size in MINPX etc. using the 1st parameter
- of DRFILE, writes out the header to FNAME
-
- *SUBROUTINE DROBJ(ARRAY,NWDS,IER)
- writes out the NWDS os ARRAY contining an object set up by the user
-
- SUBROUTINE DRPATH(ARRAY,NPTS,L1,L2,L3,L4,IER)
- creates a DRAW Path Object in LBUF from the NPTS co-ordinate pairs in ARRAY
- setup by user routine DRPOL returns:
- dimensions of bounding box stored in MINBOX etc in COMMON/DR
- IER error flag 0 for a good write, otherwise contains error number
- appends this object to the file
-
- SUBROUTINE DRPIC(MBUF,LB,ARRAY,NPTS)
- Copies the NPTS co-ordinate pairs stored in ARRAY into MBUF, scaling them to
- mm and integers, preceding them with a command, MOVE (2) for the first
- one, and a DRAW (8) for the others. Appends a zero word to terminate the
- object. Returns LB the position in MBUF of the last word stored.
-
- SUBROUTINE DRTEXT(CHARAY,NCHARS,L1,L2,L3,L4,XL,YL,IER)
- Creates a DRAW Text Object from the NCHARS characters in CHARAY
- L1,L2 are colours of text, L3 font number, L4 size (same for x and y)
- XL,YL lower left corner of text in the picture, IER =error return
-
- DR File handling utilites
-
- SUBROUTINE DRWRIT(LBUF,NWORDS,IWORD,IER)
- Writes the NWORDS of array LBUF out to the file opened by DROPEN
- depending on the value of IWORD
-
- IWORD >= 0 writes at word IWORD
- IWORD <0 appends to the file (note: if a previous call has repositioned the file, this need not be at the end. You have been warned!)
-
- IER = error flag returned 0 for a good write, otherwise error number
-
- SUBROUTINE DROPEN(FNAME,IER)
- Opens the file FNAME ready for writing (an entry point in DRWRIT)
- IER =0 for a successful open, otherwise is error number
-
- SUBROUTINE DRCLOS
- Closes the file FNAME and makes it filetype of Drawfile (AFF)
- (an entry point in DRWRIT)
-
- SUBROUTINE SAVMEM(LBUF,LB,FNAME,IER)
- Writes an array LBUF of length LB words to filename FNAME using SWIF77
- (no longer used in DrawF)
-
- Error message numbers and meanings
- No routine meaning
- 1 DROPEN illegal pathname, cannot open the file
- 2 DROPEN file already open, cannot reopen it
- 3 DRWRIT file not open, cannot write
- 4 DRWRIT disc full, cannot write
- 5 DRCHEK path object found too big for page bounding box
- 6 DRTEXT text object too big from DRCHEK
- 99 DRPOL Error in User routine