123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840 |
- {
- $Id$
- This file is part of the Free Pascal run time library.
- Copyright (c) 1993-98 by Florian Klaempf & Gernot Tenchio
- members of the Free Pascal development team.
- Graph unit for BP7 compatible RTL
- See the file COPYING.FPC, included in this distribution,
- for details about the copyright.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- **********************************************************************}
- unit GRAPH;
- { $DEFINE DEBUG}
- {$I os.inc}
- interface
- uses go32,mmx;
- {$I GLOBAL.PPI}
- {$I STDCOLOR.PPI}
- procedure CloseGraph;
- function GraphResult : Integer;
- procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;const PathToDriver:String);
- procedure SetGraphMode(GraphMode : integer);
- procedure RestoreCRTMode;
- procedure SetGraphBufSize(BufSize : longint);
- function RegisterBGIdriver(driver : pointer) : integer;
- function InstallUserDriver(const DriverFileName : string;AutoDetectPtr : pointer) : integer;
- function GetDriverName: String;
- function GetModeName(Mode:Integer):String;
- function GetGraphMode:Integer;
- procedure GetAspectRatio(var _Xasp,_Yasp : word);
- procedure SetAspectRatio(_Xasp,_Yasp : word);
- function GraphErrorMsg(ErrorCode: Integer): string;
- function GetMaxMode : Integer;
- function GetMaxX : Integer;
- function GetMaxY : Integer;
- function GetX : Integer;
- function GetY : Integer;
- procedure Bar(x1,y1,x2,y2 : Integer);
- procedure bar3D(x1, y1, x2, y2 : integer;depth : word;top : boolean);
- procedure GetViewSettings(var viewport : ViewPortType);
- procedure SetActivePage(page : word);
- procedure SetVisualPage(page : word);
- procedure SetWriteMode(WriteMode : integer);
- procedure SetViewPort(x1,y1,x2,y2 : integer;clip : boolean);
- procedure Cleardevice;
- procedure ClearViewport;
- procedure Rectangle(x1,y1,x2,y2 : integer);
- { PIXEL.PPI }
- function GetPixel(x,y : integer):longint;
- procedure PutPixel(x,y : integer; Colour: longint);
- { LINE.PPI }
- procedure Line(x1,y1,x2,y2 : integer);
- procedure LineTo(x,y : integer);
- procedure LineRel(dx,dy : integer);
- procedure MoveTo(x,y : integer);
- procedure MoveRel(dx,dy : integer);
- procedure GetLineSettings(var LineInfo : LineSettingsType);
- procedure SetLineStyle(LineStyle : word;pattern : word;thickness : word);
- procedure DrawPoly(points : word;var polypoints);
- { PALETTE.PPI }
- procedure GetRGBPalette(ColorNum:byte; var RedValue,GreenValue,BlueValue:byte);
- procedure SetRGBPalette(ColorNum,RedValue,GreenValue,BlueValue:byte);
- procedure SetAllPalette(var Palette : PaletteType);
- procedure GetPalette(var Palette : PaletteType);
- { ELLIPSE.PPI }
- procedure FillEllipse(x,y:Integer;XRadius,YRadius:Word);
- procedure Circle(x,y:Integer;Radius:Word);
- { ARC.PPI }
- procedure Arc(x,y,alpha,beta:Integer;Radius:Word);
- { COLORS.PPI }
- function GetBkColor : longint;
- function GetColor : longint;
- function GetMaxColor : longint;
- procedure SetColor(Color : longint);
- procedure SetBkColor(Color : longint);
- { FILL.PPI }
- procedure FloodFill(x,y:integer; Border:longint);
- procedure GetFillSettings(var FillInfo : FillSettingsType);
- procedure GetFillPattern(var FillPattern : FillPatternType);
- procedure SetFillStyle(pattern : word;color : longint);
- procedure SetFillPattern(pattern : FillPatternType;color : longint);
- { IMAGE.PPI }
- function ImageSize(x1,y1,x2,y2 : integer) : word;
- procedure GetImage(x1,y1,x2,y2 : integer;var BitMap);
- procedure PutImage(x,y : integer;var BitMap;BitBlt : word);
- { TEXT.PPI }
- procedure GetTextSettings(var TextInfo : TextSettingsType);
- procedure OutText(const TextString : string);
- procedure OutTextXY(x,y : integer;const TextString : string);
- procedure OutText(const Charakter : char);
- procedure OutTextXY(x,y : integer;const Charakter : char);
- procedure SetTextJustify(horiz,vert : word);
- procedure SetTextStyle(Font, Direction : word; CharSize : word);
- procedure SetUserCharSize(Multx,Divx,Multy,Divy : word);
- function TextHeight(const TextString : string) : word;
- function TextWidth(const TextString : string) : word;
- function RegisterBGIfont(font : pointer) : integer;
- function InstallUserFont(const FontFileName : string) : integer;
- { extended non Borland-compatible }
- { TRIANGLE.PPI }
- procedure FillTriangle(A,B,C:Pointtype);
- procedure WaitRetrace;
- function Convert(color:longint):longint;
- implementation
- {$ASMMODE DIRECT}
- type
- PString=^String;
- PInteger=^integer;
- PWord=^word;
- PLong=^longint;
- VgaInfoBlock = record
- VESASignature: array[1..4]of Char;
- VESAloVersion: Byte;
- VESAhiVersion: Byte;
- OEMStringPtr : longint;
- Capabilities : longint;
- VideoModePtr : longint;
- TotalMem : word;
- { VESA 2.0 }
- OEMversion : word;
- VendorPtr : longint;
- ProductPtr : longint;
- RevisionPtr : longint;
- filler : Array[1..478]of Byte;
- end;
- VesaInfoBlock=record
- ModeAttributes : word;
- WinAAttributes : byte;
- WinBAttributes : byte;
- WinGranularity : word;
- WinSize : word;
- segWINA : word;
- segWINB : word;
- RealWinFuncPtr : longint;
- BPL : word;
- { VESA 1.2 }
- XResolution : word;
- YResolution : word;
- XCharSize : byte;
- YCharSize : byte;
- MumberOfPlanes : byte;
- BitsPerPixel : byte;
- NumberOfBanks : byte;
- MemoryModel : byte;
- BankSize : byte;
- NumberOfPages : byte;
- reserved : byte;
- rm_size : byte;
- rf_pos : byte;
- gm_size : byte;
- gf_pos : byte;
- bm_size : byte;
- bf_pos : byte;
- res_mask : word;
- DirectColorInfo: byte;
- { VESA 2.0 }
- PhysAddress : longint;
- OffscreenPtr : longint;
- OffscreenMem : word;
- reserved2 : Array[1..458]of Byte;
- end;
- {$I MODES.PPI}
- const
- CheckRange : Boolean=true;
- isVESA2 : Boolean=false;
- core : longint=$E0000000;
- var { X/Y Verhaeltnis des Bildschirm }
- AspectRatio : real;
- XAsp , YAsp : Word;
- { Zeilen & Spalten des aktuellen Graphikmoduses }
- _maxx,_maxy : longint;
- { aktuell eingestellte Farbe }
- aktcolor : longint;
- { Hintegrundfarbe }
- aktbackcolor : longint;
- { Videospeicherbereiche }
- wbuffer,rbuffer,wrbuffer : ^byte;
- { aktueller Ausgabebereich }
- aktviewport : ViewPortType;
- aktscreen : ViewPortType;
- { der Graphikmodus, der beim Start gesetzt war }
- startmode : byte;
- { Position des Graphikcursors }
- curx,cury : longint;
- { true, wenn die Routinen des Graphikpaketes verwendet werden d�rfen }
- isgraphmode : boolean;
- { Einstellung zum Linien zeichnen }
- aktlineinfo : LineSettingsType;
- { Fehlercode, wird von graphresult zur�ckgegeben }
- _graphresult : integer;
- { aktuell eingestellte F�llart }
- aktfillsettings : FillSettingsType;
- { aktuelles F�llmuster }
- aktfillpattern : FillPatternType;
- { Schreibmodus }
- aktwritemode : word;
- { Schrifteinstellung }
- akttextinfo : TextSettingsType;
- { momentan gesetzte Textskalierungswerte }
- aktmultx,aktdivx,aktmulty,aktdivy : word;
- { Pfad zu den Fonts }
- bgipath : string;
- { Pointer auf Hilfsspeicher }
- buffermem : pointer;
- { momentane GrӇe des Buffer }
- buffersize : longint;
- { in diesem Puffer werden bei SetFillStyle bereits die Pattern in der }
- { zu verwendenden Farbe abgelegt }
- PatternBuffer : Array[0..63]of LongInt;
- X_Array : array[0..1280]of LongInt;
- Y_Array : array[0..1024]of LongInt;
- Sel,Seg : word;
- VGAInfo : VGAInfoBlock;
- VESAInfo : VESAInfoBlock;
- { Selectors for Protected Mode }
- seg_WRITE : word;
- seg_READ : word;
- { Registers for RealModeInterrupts in DPMI-Mode }
- dregs : TRealRegs;
- AW_Bank : longint;
- { AR_Bank : Longint;}
- { Variables for Bankswitching }
- BytesPerLine : longint;
- BytesPerPixel: Word;
- WinSize : longint; { Expample $0x00010000 . $0x00008000 }
- WinLoMask : longint; { $0x0000FFFF $0x00007FFF }
- WinShift : byte;
- GranShift : byte;
- Granular : longint;
- Granularity : longint;
- graphgetmemptr,
- graphfreememptr,
- bankswitchptr :pointer;
- isDPMI :Boolean;
- SwitchCS,SwitchIP : word;
- function GraphErrorMsg(ErrorCode: Integer): string;
- Begin
- GraphErrorMsg:='';
- case ErrorCode of
- grOk,grFileNotFound,grInvalidDriver: exit;
- grNoInitGraph: GraphErrorMsg:='Graphics driver not installed';
- grNotDetected: GraphErrorMsg:='Graphics hardware not detected';
- grNoLoadMem,grNoScanMem,grNoFloodMem: GraphErrorMsg := 'Not enough memory for graphics';
- grNoFontMem: GraphErrorMsg := 'Not enough memory to load font';
- grFontNotFound: GraphErrorMsg:= 'Font file not found';
- grInvalidMode: GraphErrorMsg := 'Invalid graphics mode';
- grError: GraphErrorMsg:='Graphics error';
- grIoError: GraphErrorMsg:='Graphics I/O error';
- grInvalidFont,grInvalidFontNum: GraphErrorMsg := 'Invalid font';
- grInvalidVersion: GraphErrorMsg:='Invalid driver version';
- end;
- end;
- procedure Oh_Kacke(ErrString:String);
- begin
- CloseGraph;
- writeln('Error in Unit VESA: ',ErrString);
- halt;
- end;
- {$I MOVE.PPI}
- {$I IBM.PPI}
- procedure WaitRetrace;
- begin
- asm
- cli
- movw $0x03Da,%dx
- WaitNotHSyncLoop:
- inb %dx,%al
- testb $0x8,%al
- jnz WaitNotHSyncLoop
- WaitHSyncLoop:
- inb %dx,%al
- testb $0x8,%al
- jz WaitHSyncLoop
- sti
- end;
- end;
- procedure getmem(var p : pointer;size : longint);
- begin
- asm
- pushl 12(%ebp)
- pushl 8(%ebp)
- movl _GRAPHGETMEMPTR,%eax
- call %eax
- end;
- end;
- procedure freemem(var p : pointer;size : longint);
- begin
- asm
- pushl 12(%ebp)
- pushl 8(%ebp)
- movl _GRAPHFREEMEMPTR,%eax
- call %eax
- end;
- end;
- procedure graphdefaults;
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grnoinitgraph;
- exit;
- end;
- { Linientyp }
- aktlineinfo.linestyle:=solidln;
- aktlineinfo.thickness:=normwidth;
- { F�llmuster }
- aktfillsettings.color:=white;
- aktfillsettings.pattern:=solidfill;
- { Zeichenfarbe }
- aktcolor:=(white shl 24)+(white shl 16)+(white shl 8)+white;
- aktbackcolor:=black;
- { Viewport setzen }
- aktviewport.clip:=true;
- aktviewport.x1:=0;
- aktviewport.y1:=0;
- aktviewport.x2:=_maxx-1;
- aktviewport.y2:=_maxy-1;
- aktscreen:=aktviewport;
- { normaler Schreibmodus }
- setwritemode(normalput);
- { Schriftart einstellen }
- akttextinfo.font:=DefaultFont;
- akttextinfo.direction:=HorizDir;
- akttextinfo.charsize:=1;
- akttextinfo.horiz:=LeftText;
- akttextinfo.vert:=TopText;
- { VergrӇerungsfaktoren}
- XAsp:=10000; YAsp:=10000;
- aspectratio:=1;
- end;
- { ############################################################### }
- { ################# Ende der internen Routinen ################ }
- { ############################################################### }
- {$I COLORS.PPI}
- {$I PALETTE.PPI}
- {$I PIXEL.PPI}
- {$I LINE.PPI}
- {$I ELLIPSE.PPI}
- {$I TRIANGLE.PPI}
- {$I ARC.PPI}
- {$I IMAGE.PPI}
- {$I TEXT.PPI}
- {$I FILL.PPI}
- function GetDrivername:String;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- GetDriverName:=('internal VESA-Driver');
- end;
- function GetModeName(Mode:Integer):String;
- var s1,s2,s3:string;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- str(_maxx,s1);
- str(_maxy,s2);
- str(getmaxcolor+1,s3);
- GetModeName:=('VESA '+s1+'x'+s2+'x'+s3);
- end;
- function GetGraphMode:Integer;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- GetGraphMode:=GetVesaMode;
- end;
- procedure ClearViewport;
- var bank1,bank2,diff,c:longint;
- ofs1,ofs2 :longint;
- y : integer;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- c:=aktcolor;
- aktcolor:=aktbackcolor;
- ofs1:=Y_ARRAY[aktviewport.y1] + X_ARRAY[aktviewport.x1] ;
- ofs2:=Y_ARRAY[aktviewport.y1] + X_ARRAY[aktviewport.x2] ;
- for y:=aktviewport.y1 to aktviewport.y2 do
- begin
- bank1:=ofs1 shr winshift;
- bank2:=ofs2 shr winshift;
- if bank1 <> AW_BANK then
- begin
- Switchbank(bank1);
- AW_BANK:=bank1;
- end;
- if bank1 <> bank2 then
- begin
- diff:=((bank2 shl winshift)-ofs1) div BytesPerPixel;
- horizontalline(aktviewport.x1, aktviewport.x1+diff-1, y);
- Switchbank(bank2); AW_BANK:=bank2;
- horizontalline(aktviewport.x1+diff, aktviewport.x2, y);
- end else horizontalline(aktviewport.x1, aktviewport.x2, y);
- ofs1:=ofs1 + BytesPerLine;
- ofs2:=ofs2 + BytesPerLine;
- end;
- aktcolor:=c;
- end;
- procedure GetAspectRatio(var _Xasp,_Yasp : word);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grnoinitgraph;;
- exit;
- end;
- _XAsp:=XAsp; _YAsp:=YAsp;
- end;
- procedure SetAspectRatio(_Xasp, _Yasp : word);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grnoinitgraph;
- exit;
- end;
- Xasp:=_XAsp; YAsp:=_YAsp;
- end;
- procedure ClearDevice;
- var Viewport:ViewportType;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- Viewport:=aktviewport;
- SetViewport(0,0,_maxx-1,_maxy-1,Clipon);
- ClearViewport;
- aktviewport:=viewport;
- end;
- procedure Rectangle(x1,y1,x2,y2:integer);
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- Line(x1,y1,x2,y1);
- Line(x1,y1,x1,y2);
- Line(x2,y1,x2,y2);
- Line(x1,y2,x2,y2);
- end;
- procedure Bar(x1,y1,x2,y2:integer);
- var y : Integer;
- origcolor : longint;
- origlinesettings: Linesettingstype;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- origlinesettings:=aktlineinfo;
- origcolor:=aktcolor;
- aktlineinfo.linestyle:=solidln;
- aktlineinfo.thickness:=normwidth;
- case aktfillsettings.pattern of
- 0 : begin
- aktcolor:=aktbackcolor;
- for y:=y1 to y2 do line(x1,y,x2,y);
- end;
- 1 : begin
- aktcolor:=aktfillsettings.color;
- for y:=y1 to y2 do line(x1,y,x2,y);
- end;
- else for y:=y1 to y2 do patternline(x1,x2,y);
- end;
- aktcolor:=origcolor;
- aktlineinfo:=origlinesettings;
- end;
- procedure bar3D(x1, y1, x2, y2 : integer;depth : word;top : boolean);
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- Bar(x1,y1,x2,y2);
- Rectangle(x1,y1,x2,y2);
- if top then begin
- Moveto(x1,y1);
- Lineto(x1+depth,y1-depth);
- Lineto(x2+depth,y1-depth);
- Lineto(x2,y1);
- end;
- Moveto(x2+depth,y1-depth);
- Lineto(x2+depth,y2-depth);
- Lineto(x2,y2);
- end;
- procedure SetGraphBufSize(BufSize : longint);
- begin
- if assigned(buffermem) then
- freemem(buffermem,buffersize);
- getmem(buffermem,bufsize);
- if not assigned(buffermem) then
- buffersize:=0
- else buffersize:=bufsize;
- end;
- const
- { Vorgabegr”áe f�r Hilfsspeicher }
- bufferstandardsize = 64*8196; { 0,5 MB }
- procedure CloseGraph;
- begin
- if isgraphmode then begin
- SetVESAMode(startmode);
- DoneVESA;
- isgraphmode:=false;
- end;
- end;
- procedure InitGraph(var GraphDriver:Integer;var GraphMode:Integer;const PathToDriver:String);
- var i,index:Integer;
- begin
- { Pfad zu den Fonts }
- bgipath:=PathToDriver;
- if bgipath[length(bgipath)]<>'\' then
- bgipath:=bgipath+'\';
- if Graphdriver=detect then GraphMode:=GetMaxMode;
- { Standardfonts installieren }
- InstallUserFont('TRIP');
- InstallUserFont('LITT');
- InstallUserFont('SANS');
- InstallUserFont('GOTH');
- InstallUserFont('SCRI');
- InstallUserFont('SIMP');
- InstallUserFont('TSCR');
- InstallUserFont('LCOM');
- InstallUserFont('EURO');
- InstallUserFont('BOLD');
- GetVESAInfo(GraphMode);
- {$IFDEF DEBUG}
- {$I VESADEB.PPI}
- {$ENDIF}
- for i:=VESANumber downto 0 do
- if GraphMode=VESAModes[i] then break;
- { the modes can be refused due to the monitor ? }
- { that happens by me at home Pierre Muller }
- while i>=0 do begin
- isgraphmode:=SetVESAMode(GraphMode);
- if isgraphmode then begin
- for index:=0 to VESAInfo.XResolution do X_Array[index]:=index * BytesPerPixel;
- for index:=0 to VESAInfo.YResolution do Y_Array[index]:=index * BytesPerLine;
- SetGraphBufSize(bufferstandardsize);
- graphdefaults;
- exit;
- end;
- dec(i);
- GraphMode:=VESAModes[i];
- end;
- _graphresult:=grInvalidMode
- end;
- procedure SetGraphMode(GraphMode:Integer);
- var index:Integer;
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- if GetVesaInfo(GraphMode) then
- begin
- isgraphmode:=SetVESAMode(GraphMode);
- if isgraphmode then
- begin
- for index:=0 to VESAInfo.XResolution do
- X_Array[index]:=index * BytesPerPixel;
- for index:=0 to VESAInfo.YResolution do
- Y_Array[index]:=index * BytesPerLine;
- graphdefaults;
- exit;
- end;
- end;
- _graphresult:=grInvalidMode;
- end;
- function RegisterBGIdriver(driver : pointer) : integer;
- begin
- RegisterBGIdriver:=grerror;
- end;
- function InstallUserDriver(const DriverFileName : string;AutoDetectPtr : pointer) : integer;
- begin
- installuserdriver:=grerror;
- end;
- function GetMaxMode:Integer;
- var i:Byte;
- begin
- for i:=VESANumber downto 0 do
- if GetVesaInfo(VESAModes[i]) then
- begin
- GetMaxMode:=VESAModes[i];
- Exit;
- end;
- end;
- function GetMaxX:Integer;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- GetMaxX:=VESAInfo.XResolution-1;
- end;
- function GetMaxY:Integer;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- GetMaxY:=VESAInfo.YResolution-1;
- end;
- function GetX : integer;
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- GetX:=curx;
- end;
- function GetY : integer;
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- GetY:=cury;
- end;
- procedure SetViewPort(x1,y1,x2,y2 : integer;clip : boolean);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- exit;
- end;
- { Daten �berpr�fen }
- if (x1<0) or (y1<0) or (x2>=_maxx) or (y2>=_maxy) then exit;
- aktviewport.x1:=x1;
- aktviewport.y1:=y1;
- aktviewport.x2:=x2;
- aktviewport.y2:=y2;
- aktviewport.clip:=clip;
- end;
- procedure GetViewSettings(var viewport : ViewPortType);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- exit;
- end;
- viewport:=aktviewport;
- end;
- { mehrere Bildschirmseiten werden nicht unterst�tzt }
- { Dummy aus Kompatibilit„tsgr�nden }
- procedure SetVisualPage(page : word);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;;
- exit;
- end;
- end;
- { mehrere Bildschirmseiten werden nicht unterst�tzt }
- { Dummy aus Kompatibilit„tsgr�nden }
- procedure SetActivePage(page : word);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;;
- exit;
- end;
- end;
- procedure SetWriteMode(WriteMode : integer);
- begin
- _graphresult:=grOk;
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;;
- exit;
- end;
- if (writemode<>xorput) and (writemode<>normalput) then
- begin
- _graphresult:=grError;
- exit;
- end;
- aktwritemode:=writemode;
- end;
- function GraphResult:Integer;
- begin
- GraphResult:=_graphresult;
- end;
- procedure RestoreCRTMode;
- begin
- if not isgraphmode then
- begin
- _graphresult:=grNoInitGraph;
- Exit;
- end;
- SetVESAMode(startmode);
- isgraphmode:=false;
- end;
- begin
- InitVESA;
- if not DetectVESA then Oh_Kacke('VESA-BIOS not found...');
- startmode:=GetVESAMode;
- bankswitchptr:=@switchbank;
- GraphGetMemPtr:[email protected];
- GraphFreeMemPtr:[email protected];
- Getdefaultfont;
- if not isDPMI then begin
- wrbuffer:=pointer($D0000000);
- rbuffer:=pointer($D0200000);
- wbuffer:=pointer($D0200000);
- end else begin
- wrbuffer:=pointer($0);
- rbuffer:=pointer($0);
- wbuffer:=pointer($0);
- end;
- end.
- {
- $Log$
- Revision 1.4 1998-05-31 14:18:14 peter
- * force att or direct assembling
- * cleanup of some files
- Revision 1.3 1998/05/22 00:39:23 peter
- * go32v1, go32v2 recompiles with the new objects
- * remake3 works again with go32v2
- - removed some "optimizes" from daniel which were wrong
- }
|