Unit graph2; INTERFACE Uses Graph; Const DrivePath = 'c:\windows\asztal\tp70\bgi'; Type AblakTulTip = Object X1,Y1,X2,Y2 : Integer; {ablakpoziciok: bal also, jobb felso sarok} FejlecHSzin : Word; {fejlec hatterszine} FejlecSzSzin : Word; {fejlec szovegenek szine} FejLecSzov : String[50]; {fejlec szovege} MunkaTerHSzin : Word; {munkaterulet hatterszine} Procedure Rajz; {ablak megrajzolasa, elozo ablak adatainak elmentese} Procedure Be; {munkaterulet ablakpozicioinak beallitasa} Procedure Ki; {elozo ablak adatainak visszaallitasa} Private FejLecMag : Byte; {fejlec magassaga} EA : ViewPortType; {elozo ablak adatai} ERajzSzin : Word; {elozo rajzolo szin} end{Object}; Var WinMaxX : Integer; WinMaxY : Integer; Function YFordit(Y:Integer):Integer; {bal also, jobb felso sarok koordinatai} Procedure SetViewPort2(X1,Y1,X2,Y2:Integer; Clip:Boolean); Procedure GetViewSettings2(var ViewPort:ViewPortType); Procedure Arc2(X,Y:Integer; StAngle,EndAngle,Radius:Word); Procedure Bar2(X1,Y1,X2,Y2:Integer); Procedure Bar3D2(X1,Y1,X2,Y2:Integer;Depth:Word;Top:Boolean); Procedure Circle2(X,Y:Integer; Radius:Word); Procedure MoveTo2(X,Y:Integer); Procedure ClearDevice2; Procedure ClearViewPort2; Function GetY2:Integer; Procedure Line2(X1,Y1,X2,Y2:Integer); Procedure LineRel2(Dx,Dy:Integer); Procedure LineTo2(X,Y:Integer); Procedure MoveRel2(Dx,Dy:Integer); Procedure OutText2(TextString:String); Procedure OutTextXY2(X,Y:Integer; TextString:String); Procedure Rectangle2(X1,Y1,X2,Y2:Integer); Procedure PutPixel2(X,Y:Integer;Pixel:Word); IMPLEMENTATION Procedure GraphBekapcs; var Gd,Gm : Integer; begin DetectGraph(Gd,Gm); InitGraph(Gd,Gm,DrivePath); end{GraphBekapcs}; Procedure ClearViewPort2; begin Bar2(0,0,WinMaxX,WinMaxY); MoveTo2(0,0); end{KepernyoTorles}; Function YFordit(Y:Integer):Integer; var szemet : Integer; begin szemet:=WinMaxY; szemet:=WinMaxY-Y; YFordit:=WinMaxY-Y; end{YFordit}; {bal also (1), es jobb felso (2) sarok koordinatai} Procedure SetViewPort2(X1,Y1,X2,Y2:Integer; Clip:Boolean); begin SetViewPort(X1,GetMaxY-Y2,X2,GetMaxY-Y1,Clip); WinMaxX:=abs(X2-X1); WinMaxY:=abs(Y2-Y1); end{SetViewPort2}; Procedure GetViewSettings2(var ViewPort:ViewPortType); begin GetViewSettings(ViewPort); ViewPort.Y2:=GetMaxY-ViewPort.Y1; ViewPort.Y2:=GetMaxY-ViewPort.Y2; end{GetViewSettings2}; Procedure Arc2(X,Y:Integer; StAngle,EndAngle,Radius:Word); begin Arc(X,YFordit(Y),StAngle,EndAngle,Radius); end{Arc2}; Procedure Bar2(X1,Y1,X2,Y2:Integer); begin Bar(X1,YFordit(Y2),X2,YFordit(Y1)); end{Bar2}; Procedure Bar3D2(X1,Y1,X2,Y2:Integer;Depth:Word;Top:Boolean); begin Bar3D(X1,YFordit(Y2),X2,YFordit(Y1),Depth,Top); end{Bar2}; Procedure Circle2(X,Y:Integer; Radius:Word); begin Circle(X,YFordit(Y),Radius); end{Circle2}; Procedure MoveTo2(X,Y:Integer); begin MoveTo(X,YFordit(Y)); end{MoveTo2}; Procedure ClearDevice2; begin ClearDevice; MoveTo2(0,0); end; Function GetY2:Integer; var Sv : Integer; begin Sv:=GetY; Sv:=YFordit(Sv); end{GetY}; Procedure Line2(X1,Y1,X2,Y2:Integer); begin Line(X1,YFordit(Y1),X2,YFordit(Y2)); end{Line2}; Procedure LineRel2(Dx,Dy:Integer); begin LineRel(Dx,-Dy); end{LineRel2}; Procedure LineTo2(X,Y:Integer); begin LineTo(X,YFordit(Y)); end{LineTo2}; Procedure MoveRel2(Dx,Dy:Integer); begin MoveRel(Dx,-Dy); end{MoveRel2}; Procedure OutText2(TextString:String); var Mag : Integer; Y : Integer; begin Mag:=TextHeight(TextString); Y:=YFordit(GetY)+Mag; MoveTo2(GetX,Y); OutText(TextString); end{OutText2}; Procedure OutTextXY2(X,Y:Integer; TextString:String); var Mag : Integer; begin Mag:=TextHeight(TextString); OutTextXY(X,YFordit(Y)-Mag,TextString); end{OutTextXY2}; Procedure Rectangle2(X1,Y1,X2,Y2:Integer); begin Rectangle(X1,YFordit(Y1),X2,YFordit(Y2)); end{Rectangle2}; Procedure AblakTulTip.Rajz; var FillInfo : FillSettingsType; begin {Megelozo adatok elmentese:} GetViewSettings(EA); ERajzSzin:=GetColor; FejlecMag:=17; SetViewPort2(X1, Y1, X2, Y2, True); {munkaterulet hatterszine} GetFillSettings(FillInfo); SetFillStyle(1,MunkaTerHSzin); Bar2(0,0,WinMaxX,WinMaxY); SetFillStyle(1,FejlecHSzin); Bar2(0,WinMaxY-FejlecMag,WinMaxX,WinMaxY); SetFillStyle(FillInfo.Pattern,FillInfo.Color); {keretek:} Line2(0,0,0,WinMaxY); Line2(0,0,WinMaxX,0); Line2(WinMaxX,0,WinMaxX,WinMaxY); Line2(WinMaxX,WinMaxY,0,WinMaxY); Line2(0,WinMaxY-FejlecMag,WinMaxX,WinMaxY-FejLecMag); {felirat:} SetColor(FejlecSzSzin); OutTextXY2((WinMaxX Div 2) - (TextWidth(FejlecSzov) Div 2),WinMaxY-FejlecMag+3,FejlecSzov); { Inc(X1);Inc(Y1);Dec(X2);Dec(Y2);} {Elmentett adatok visszaallitasa:} SetViewPort(EA.X1,EA.Y1,EA.X2,EA.Y2,EA.Clip); SetColor(ERajzSzin); end{AblakTulTip.Rajz}; Procedure AblakTulTip.Be; begin FejlecMag:=17; {munkaterulet:} Inc(X1); Inc(Y1); Dec(X2); Dec(Y2); Y2:=Y2-FejlecMag; SetViewPort2(X1, Y1, X2, Y2, True); end{AblakTulTip.Be}; Procedure AblakTulTip.Ki; begin {Elmentett ablak visszaallitasa} SetViewPort(EA.X1,EA.Y1,EA.X2,EA.Y2,EA.Clip); end{AblakTulTip.Ki}; Procedure PutPixel2(X,Y:Integer;Pixel:Word); begin PutPixel(X,YFordit(Y),Pixel); end{PutPixel2}; Begin GraphBekapcs; ClearViewPort2; WinMaxX:=GetMaxX; WinMaxY:=GetMaxY; End.