home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / tegl_ii / intro / fastgrph.doc < prev    next >
Text File  |  1991-08-16  |  8KB  |  235 lines

  1. {-----------------------------------------------------------------------------}
  2. {               TEGL Windows ToolKit II                  }
  3. {          Copyright (C) 1990, 1991 TEGL Systems Corporation              }
  4. {                All Rights Reserved.                  }
  5. {-----------------------------------------------------------------------------}
  6. {$I switches.inc}
  7.  
  8. unit FastGrph;
  9.  
  10. INTERFACE
  11.  
  12. uses dos,teglfont;
  13.  
  14. TYPE
  15.     {-- typedefs for core graphics routines }
  16.  
  17.     TEGLGRFunc00 = Function:Pointer;
  18.     TEGLGRFunc01 = Function(x,y:Word):Word;
  19.     TEGLGRFunc02 = Function(x,y:Word; buffer:Pointer):Word;
  20.     TEGLGRFunc03 = Function(x,y,x1,y1:Word):longint;
  21.     TEGLGRFunc04 = Function(mode:integer):integer;
  22.     TEGLGRFunc05 = Function(x,y,borderc:word; scan:integer):Word;
  23.  
  24.     TEGLGRProc00 = Procedure(vtab:Pointer);
  25.     TEGLGRProc01 = Procedure(x,y,x1,y2,n:Word);
  26.     TEGLGRProc02 = Procedure(x,y,n:Word);
  27.     TEGLGRProc03 = Procedure(x,y:Word;buf:pointer;n:Word);
  28.     TEGLGRProc04 = Procedure(x,y,x1,y1:Word;buffer:pointer);
  29.     TEGLGRProc05 = Procedure(x,y,x1,y1:Word;buff1,buff2:Pointer);
  30.     TEGLGRProc06 = Procedure(x,y:Word;buff1,buff2:Pointer);
  31.     TEGLGRProc07 = Procedure(c,x,y,Color,bkcolor:Word);
  32.     TEGLGRProc08 = Procedure;
  33.     TEGLGRProc09 = Procedure(x,y:Word);
  34.     TEGLGRProc10 = Procedure(sx,sy,sx1,sy1,tx,ty:Word; vertlines,horzlines:integer; spage,tpage:pointer);
  35.     TEGLGRProc11 = Procedure(pagen:word);
  36.  
  37.     {-- mouse mask }
  38.     MaskPtr  = ^MaskType;
  39.     MaskType = Array[0..1, 0..15] of Word;
  40.  
  41.     VideoInfoPtr    =  ^VideoInfoRec;
  42.     VideoInfoRec    =  RECORD
  43.         ModeName        : string[21];    {Mode String Name}
  44.         ModeNumber        : Integer;    {Mode Number}
  45.         Maxx        : Word;     {Device Full Resolution in X}
  46.         Maxy        : Word;     {Device Full Resolution in Y}
  47.         StdChrWidth     : Word;     {Standard char size X}
  48.         StdChrHeight    : Word;     {Standard char size Y}
  49.         MaxColor        : Word;     {Number of colors}
  50.         MaxPages        : Word;     {Number of pages}
  51.         MaxPalette        : Word;     {Number of palettes}
  52.         ActivePage        : Word;     {buffer offset for 2 page}
  53.         ScreenSeg        : Word;     {Screen Segment}
  54.         BytesPerLine    : Word;     {bytes per line}
  55.         aspectx        : Word;     {aspect ratio x * 1000}
  56.         aspecty        : Word;     {aspect ratio y * 1000}
  57.         DriverAddr        : pointer;    {video driver start address}
  58.         DriverNamePtr    : pointer;    {video driver name pointer}
  59.         DriverJumpTable    : pointer;    {video driver Jump Table}
  60.         GraphBufferPtr    : pointer;    {Graphic Work Buffer}
  61.         GraphBufferSize    : Word;     {Graphic Size Buffer}
  62.         RmwBits        : Word;     {Read/Write modes}
  63.         transparency    : byte;     {transpanrancy on-$00/off-$ff}
  64.         Jagged        : boolean;    {jagged characters on-$01/off-$00}
  65.         FontTable        : Pointer;    {pointer to font table}
  66.         EGApaletteflag    : boolean;    {allow EGA pallete set}
  67.         RGBpaletteflag    : boolean;    {allow VGA pallete set}
  68.         proportionalfont    : Boolean;    {proportional font switch}
  69.         TeglFillMask    : Word;     {fillmask for lines}
  70.         wminx        : word;     {viewport - minx}
  71.         wminy        : word;     {viewport - miny}
  72.         wmaxx        : word;     {viewport - maxx}
  73.         wmaxy        : word;     {viewport - maxy}
  74.         clipped        : boolean;    {viewport - clipping on/off}
  75.         MouseColor        : Word;     {Mouse color}
  76.         MouseHotSpot_XOFS    : Word;     {Mouse hotspot}
  77.         MouseHotSpot_YOFS    : Word;     {Mouse hotspot}
  78.         MouseMask        : MaskPtr;    {Mouse Cursor Mask}
  79.         Nextmodeptr     : videoinfoptr; {Next VideoMode}
  80.                END;
  81.  
  82.  
  83.     DriverFilePtr   = ^DriverFileTable;
  84.     DriverFileTable = Record
  85.     NextDrvFile   : DriverFilePtr;
  86.     ModeName      : string[20];
  87.     FileName      : string[80];
  88.     end;
  89.  
  90.     BGIGdGmPtr        = ^BGIGdGmRec;
  91.     BGIGdGmRec        = Record
  92.     NextBGIPtr    : BGIGDGMPtr;
  93.     ModeName      : string[20];
  94.     GD          : integer;
  95.     GM          : integer;
  96.     end;
  97.  
  98.     BGITGIDrv        = ^BGITGIRec;
  99.     BGITGIRec        = Record
  100.     NextBGITGI    : BGITGIDrv;
  101.     TGIDriver     : string[15];
  102.     Graphdriver   : integer;
  103.     end;
  104.  
  105.     fontptr        = ^fontinfo;
  106.     fontinfo        = Record
  107.     Fontsignature     : word;
  108.     FontHeight     : byte;
  109.     FontWidth     : byte;
  110.     FontAsciiStart     : byte;
  111.     FontAsciiEnd     : byte;
  112.     FontTop      : byte;
  113.     FontBase     : byte;
  114.     FontBottom     : byte;
  115.     FontByteWidth     : byte;
  116.     end;
  117.  
  118. const
  119. {$ifdef NoGr}
  120.     lastmode__               : byte = $ff;
  121.     lastpage__               : byte = $ff;
  122. {$endif}
  123.  
  124.     GraphBufferSize           : word = 8192;
  125.     GraphBufferInit           : boolean = false;
  126.     GraphScanBuffer           : pointer = NIL;
  127.  
  128.     DrvFileTable           : DriverFilePtr     = NIL;
  129.     DrvInfoTable           : VideoInfoPtr     = NIL;
  130.     DrvBGITable            : BGIGDGMPtr     = NIL;
  131.     DrvTGITable            : BGITGIDrv     = NIL;
  132.     ActiveTEGLMode           : VideoInfoPtr     = NIL;
  133.  
  134.     UnderlineCharStatus        : boolean     = false;
  135.     LastAssignedGD           : word = 10;
  136.  
  137. {   BIOS_Data = $40; }
  138.  
  139.     { Constants for GetBiti and PutBiti }
  140.     FGNorm    = 0;
  141.     FGAnd     = $08;
  142.     FGOr      = $10;
  143.     FGXor     = $18;
  144.     FGNot     = $80;
  145.  
  146.  
  147.     { GraphResult error return codes: }
  148.     grOk           =   0;
  149.     grNoInitGraph      =  -1;
  150.     grNotDetected      =  -2;
  151.     grFileNotFound     =  -3;
  152.     grInvalidDriver    =  -4;
  153.     grNoLoadMem        =  -5;
  154.     grNoScanMem        =  -6;
  155.     grNoFloodMem       =  -7;
  156.     grFontNotFound     =  -8;
  157.     grNoFontMem        =  -9;
  158.     grInvalidMode      = -10;
  159.     grError           = -11;    { generic error }
  160.     grIOerror           = -12;
  161.     grInvalidFont      = -13;
  162.     grInvalidFontNum   = -14;
  163.  
  164. VAR
  165.    {-- Procedureal pointers. Initialized to point at the correct }
  166.    {-- graphics driver routines }
  167.  
  168.    GetVideoTable     : TEGLGRFunc00;
  169.    Getpixs         : TEGLGRFunc01;
  170.    Extractpixs         : TEGLGRFunc02;
  171.    BigImageSize      : TEGLGRFunc03;
  172.    InitVideoMode     : TEGLGRFunc04;
  173.    Scanborder         : TEGLGRFunc05;
  174.  
  175.    SetVideoTable     : TEGLGRProc00;
  176.    SetXLATTable      : TEGLGRProc00;
  177.    FastLine         : TEGLGRProc01;
  178.    Putpixs         : TEGLGRProc02;
  179.    Putbiti         : TEGLGRProc03;
  180.    GetBitI         : TEGLGRProc04;
  181.    ExtractIMG         : TEGLGRProc05;
  182.    OverlayIMG         : TEGLGRProc06;
  183.    TEGLWrtChar         : TEGLGRProc07;
  184.    MCursorOff         : TEGLGRProc08;
  185.    MCursorOn         : TEGLGRProc09;
  186.    MSetPos         : TEGLGRProc09;
  187.    MoveVideoPixels   : TEGLGRProc10;
  188.    SetTEGLVPage      : TEGLGRProc11;
  189.    SetTEGLAPage      : TEGLGRProc11;
  190.  
  191. procedure settransparency(onoff:boolean);
  192. function  RegisterTGIDriver(Driver:pointer):integer;
  193. Procedure PictSize (VAR w,h:Word; buf:Pointer);
  194. Procedure Putpict (x,y:Word; buf:Pointer;n:Word);
  195. Function  TEGLTextWidth(mystr : String) : Integer;
  196. Function  TEGLCharBase : integer;
  197. Function  TEGLCharTop : integer;
  198. Function  TEGLCharStart : integer;
  199. Function  TEGLCharBottom : integer;
  200. Function  TEGLCharRange : integer;
  201. Function  TEGLCharWidth(c : Word) : Word;
  202. Function  TEGLCharMaxWidth : integer;
  203. Function  TEGLCharHeight : Word;
  204. Procedure SetTEGLFont(p : Pointer);
  205. Function  GetTEGLFont : Pointer;
  206. Procedure SetProportional(onoff:Boolean);
  207. function  GetProportional : boolean;
  208. Procedure OutTGTextXY(x,y,color,bkcolor : Integer; mystr : String);
  209. Procedure SwapBytes(buff1,buff2:Pointer; bytestoswap:longint);
  210. Procedure XORCornerBox (x,y,x1,y1,Color : Integer);
  211. Procedure XORBox (x1,y1,x2,y2,Color : Integer);
  212. procedure FastRect(x1, y1, x2, y2, c : integer);
  213. procedure FastBar(x1,y1,x2,y2,c : integer);
  214. function  SetGraphicMode(var ModeName:string; pathtodriver:string) : integer;
  215. procedure AddDriverFileName(FileName:string; ModeName:string);
  216. function  FindBGIToModeName(GD,GM : integer) : BGIGDGMPtr;
  217. function  FindModeNameToBGI(ModeName:string) : BGIGDGMPtr;
  218. procedure AddDriverBGIModes(ModeName:string; gd,gm:integer);
  219. function  FindTGIGraphDriver(TEGLDriverName:string) : BGITGIDrv;
  220. procedure AddTGIGraphDriver(TEGLDriverName:string; gd:integer);
  221. procedure AllocateScanBuffer(BufSize : word);
  222. procedure FastScrollDown(x1,y1,x2,y2,pixlines:integer);
  223. procedure FastScrollUp(x1,y1,x2,y2,pixlines:integer);
  224. procedure FastScrollRight(x1,y1,x2,y2,pixlines:integer);
  225. procedure FastScrollLeft(x1,y1,x2,y2,pixlines:integer);
  226. function  GetRMWBits:word;
  227. Procedure SetRMWBits(rmwb:word);
  228. Function  OverLapArea(ax,ay,ax1,ay1,bx,by,bx1,by1:Word; VAR cx,cy,cx1,cy1:Word):Boolean;
  229.  
  230. {$ifdef NoGr}
  231. procedure ResetLastVideoMode(tmode,tpage : word);
  232. {$endif}
  233.  
  234. IMPLEMENTATION
  235.