(***********************************************************) (* *) (* TURBO GRAPHIX version 1.05A *) (* *) (* Polygon drawing module *) (* Module version 1.05A *) (* *) (* Copyright (C) 1985 by *) (* BORLAND International *) (* *) (***********************************************************) procedure DrawPolygon(A:PlotArray; I0,NPoints,Line,Scale,Lines:integer); var i,x1,x2,y1,y2,XOffset,YOffset:integer; X1RefLoc,Y1RefLoc,X2RefLoc,Y2RefLoc:integer; DeltaY,XOs1,XOs2,YOs1,YOs2:integer; AutoClip,DirectModeLoc,PlotLine,PlotSymbol:boolean; X1Loc,Y1Loc,X2Loc,Y2Loc:integer; procedure DrawPointClipped(x,y:integer); begin if (x1>X1RefGlb shl 3) and (x2Y1RefGlb) and (y2=2 then begin X1Loc := X1Glb; Y1Loc := Y1Glb; X2Loc := X2Glb; Y2Loc := Y2Glb; DirectModeLoc:=DirectModeGlb; DirectModeGlb:=true; AutoClip:=(NPoints<0); NPoints:=abs(NPoints); XOs1:=1; XOs2:=1; YOs1:=6; YOs2:=6; if AxisGlb then begin XOs1:=4; XOs2:=2; YOs1:=6; YOs2:=14; if (((X2RefGlb+7-XOs2-X1RefGlb+XOs2) > (XOs1+XOs2) shl 1) and (Y2RefGlb-YOs2-Y1RefGlb+YOs1 > (YOs1+YOs2) shl 1)) then begin X1RefLoc:=X1RefGlb; x1:=X1RefGlb+XOs1+X1Glb; Y1RefLoc:=Y1RefGlb; y1:=Y1RefGlb+YOs1+Y1Glb; X2RefLoc:=X2RefGlb; x2:=X2RefGlb-XOs2-X2Glb; Y2RefLoc:=Y2RefGlb; y2:=Y2RefGlb-YOs2-Y2Glb; ReDefineWindow(WindowNdxGlb,x1,y1,x2,y2); SelectWindow(WindowNdxGlb); AxisGlb := true; end; end; PlotLine:=(Line>=0); PlotSymbol:=(Line<>0); Line:=abs(Line); Scale:=abs(Scale); if Lines<0 then DeltaY:=trunc(1.0/(abs(Y1WldGlb)+abs(Y2WldGlb)) * abs(Y1WldGlb) * abs(Y2RefGlb-Y1RefGlb))+1 else DeltaY:=0; if (NPoints<2) and MessageGlb then writeln(': too few data pairs -> (NPoints) >= 2') else begin x1:=WindowX(A[I0,1]); y1:=Y2RefGlb+Y1RefGlb-WindowY(A[I0,2]); DrawItem(x1,y1); if Abs(Lines)=1 then if AutoClip then DrawLineClipped(x1,Y2RefGlb-DeltaY,x1,y1) else DrawLine(x1,Y2RefGlb-DeltaY,x1,y1); for i:=I0+1 to NPoints do begin x2:=WindowX(A[i,1]); y2:=Y2RefGlb+Y1RefGlb-WindowY(A[i,2]); DrawItem(x2,y2); if Abs(Lines)=1 then if AutoClip then DrawLineClipped(x2,Y2RefGlb-DeltaY,x2,y2) else DrawLine(x2,Y2RefGlb-DeltaY,x2,y2); if PlotLine then if AutoClip then DrawLineClipped(x1,y1,x2,y2) else DrawLine(x1,y1,x2,y2); x1:=x2; y1:=y2; end; end; if AxisGlb then begin ReDefineWindow(WindowNdxGlb,X1RefLoc,Y1RefLoc,X2RefLoc,Y2RefLoc); SelectWindow(WindowNdxGlb); X1Glb := X1Loc; Y1Glb := Y1Loc; X2Glb := X2Loc; Y2Glb := Y2Loc; AxisGlb:=false; end; DirectModeGlb:=DirectModeLoc; end else error(18,4); end;