SUBROUTINE SHADE( L, K, XMIN, XMAX, YMIN, YMAX, XSC, YSC) C C To shade in rectangular spaces C C This program uses the SFGL70 graphics library C C B. Z. Lederman I.T.T. World Communications C 67 Broad St. C New York, N.Y. 10004 C (212) 797-8080 C C L is the pattern 1 = horizontal bars C 2 = vertical bars C 3 = 45 degree down right C 4 = 45 degree up right C C K is the skip factor 1 = print all C 2 = print every 2nd C 3 = print every 3rd, etc. C -2 = skip every 2nd C -3 = skip every 3rd, etc. C C XMIN, XMAX, YMIN, YMAX delimit the rectangle C C XSC and YSC are the sizes of the maximum dimentions of C the window (or page) C INTEGER*4 I LOGICAL SKIP REAL*4 X(2), Y(2), X1, X2, Y1, Y2, INC EQUIVALENCE (X(1), X1), (X(2), X2) EQUIVALENCE (Y(1), Y1), (Y(2), Y2) EXTERNAL SKIP C C INC is the space between shading lines, and is taken as C 1/100 of the size of the X or Y window depending if the C lines are vertical or horizontal. C IF (L .LT. 1 .OR. L .GT. 4) RETURN ! Out of range J = 0 ! Line counter GOTO (100, 120, 140, 140) L C C Horizontal bars: very easy. Just draw from side to side. C 100 X1 = XMIN X2 = XMAX INC = YSC / 100. IF (YMIN .GT. YMAX) INC = -INC DO 110 W = (YMIN + INC), YMAX, INC IF (SKIP(J, K)) GOTO 110 Y1 = W Y2 = Y1 CALL PLOT( 2, X, Y) 110 CONTINUE RETURN C C Vertical Bars: same as horizontal but bottom to top C 120 Y1 = YMIN Y2 = YMAX INC = XSC / 150. IF (XMIN .GT. XMAX) INC = -INC DO 130 W = (XMIN + INC), XMAX, INC IF (SKIP(J, K)) GOTO 130 X1 = W X2 = X1 CALL PLOT( 2, X, Y) 130 CONTINUE RETURN C C Common calculation for slanting bars C 140 XDISP = XMAX - XMIN YDISP = XDISP * (YSC / XSC) INC = YSC / 100. IF (YMIN .GT. YMAX) INC = -INC IF (L .EQ. 4) GOTO 180 ! go to up-r C C Bars slanting down to right: harder, must not go past edges. C DO 170 W = (YMIN + INC), (YMAX + YDISP), INC IF (SKIP(J, K)) GOTO 170 X1 = XMIN X2 = XMAX Y1 = W Y2 = Y1 - YDISP IF (Y2 .GE. YMIN) GOTO 150 Y2 = YMIN X2 = XMIN + (XDISP * (Y1 - YMIN) / YDISP) 150 IF (Y1 .LE. YMAX) GOTO 160 X1 = XMIN + ((XDISP / YDISP) * (Y1 - YMAX)) Y1 = YMAX 160 CALL PLOT(2, X, Y) 170 CONTINUE RETURN C C Bars slanting up to the right C 180 DO 210 W = (YMIN + INC - YDISP), YMAX, INC IF (SKIP(J, K)) GOTO 210 X1 = XMIN X2 = XMAX Y1 = W Y2 = Y1 + YDISP IF (Y1 .GE. YMIN) GOTO 190 Y1 = YMIN X1 = XMAX - (XDISP * (Y2 - YMIN) / YDISP) 190 IF (Y2 .LE. YMAX) GOTO 200 Y2 = YMAX X2 = XMIN + (XDISP * (YMAX - W) / YDISP) 200 CALL PLOT( 2, X, Y) 210 CONTINUE RETURN C END