A general stroke drawing routine has been under discussion. This routine would allow simulation of a variety of textures and facilitate graph plotting. It is possible that some special cases such as DOTTED might be absorbed.
The following is a proposal for including the facility in SPROGS:
Two routines, STYPE and STROKE, will receive the necessary parameters. STYPE will associate a filename and expansion factor with successive calls to STROKE.
STYPE (NAME('FILE'),EXP)
'FILE' should be a picture file whose horizontal dimension is some constant, SLINTH, which might correspond to standard character size. Two global variables, ISNAME and SEXP, will be necessary to retain the file and expansion factor information.
The routine STROKE will lay down copies of the stroke specified by 'FILE' between a beginning point (BPX,BPY) and an end point (EPX,EPY). .
STROKE (BPX,BPY,EPX,EPY)
For clarity, call this series of strokes a 'track'. In general, swapping the beginning and end points will not produce the same track.
Two facts have complicated the implementation of STROKE:
1. Each stroke in the track must be rotated to coincide with the slope of the line, L, between (BPX,BPY) and (EPX,EPY).
2. The last stroke may extend past (EPX,EPY) and so must be clipped, perpendicular to L.
To program these requirements, it appears necessary to have two new facilities: one to define rotated regions and another to define a new region in terms of the current region without specifying the name of the current region. In the following suggestion for the coding of STROKE, the following liberties have been taken for clarity only:
1. Region numbers greater than 1000 are temporary system regions.
2. A negative region number :means 'use the currently active region'.
3. REGROT(NREG,X,Y,THETA) causes region NREG to be defined by rotating it THETA degrees about the point (X,Y).
4. The labelled common block, GLOBAL, holds global program variables such as ISNAME, etc.
SUBROUTINE STROKE(BEGX,BEGY,ENDX,ENDY) COMMON /GLOBAL/ISNAME,SEXP,SLINTH BPX=BEGX BPY=BEGY EPX= ENDX EPY=ENDY NMBRT= DSRTNM('STROKE') IF(NPRYV .LT. LPRYV) GO TO 100 CALL STORE4(NMBRT,BPX,BPY,EPX,EPY) GO TO 500 100 DY=EPY-BPY DX=EPX-BPX SLINT2=SLINTH/2.0 THETA=ATAN(DY/DX) XLENP=SQRT(DX*DX+DY*DY) XLENR=XLENA/EXP NS=XLENR/SLINTH CALI RGLIM(1001,0.,-SLINT2,XLENR,SLINT2) XPMAX=BPX+XLENP YPMAX=BPY+SLINT2 XPMIN=BPX YPMIN=BPY-SLINT2 CALL RGPLIM(1001,-1,XPMIN,YPMIN,XPMAX,YPMAX) CALL REGROT(1001,BPX,BPY,THETA) SX=0 DO 10 I=1,NS CALL SETXY (SX,0) SX=SX+SLINTH 10 CALL DRAW(ISNAME) 500 CALL RESET RETURN END
By properly setting LPRYV, STROKE can be made to store STROKE calls away in a file, thus allowing the user to switch strokes to compare effect, etc. Some special cases, such as DOTTED, could possibly be handled at the beginning of STROKE. 'DOTTED' would merely be a special name recognised by the routine. This is really not saving much work, but it may make the system look cleaner to the user.
TYPE is presumably a simple routine to code. ISNAME might be set to -1 initially to preclude calling STROKE without having made a call to STYPE. Three sorts of fixes are possible:
1. Let the error filter down to RCNCL2 in DRAW.
2. Produce a diagnostic at the STROKE level.
3. Substitute VEC commands for the DRAW calls.
I favour some combination of 2 and 3. But diagnostics seem to be a bit of an open question at the moment.