home *** CD-ROM | disk | FTP | other *** search
- {
- Printer BGI driver C interface
- Copyright (c) 1991 A. Resztak
- }
-
- unit PRTGraph;
-
- Interface
-
- (* Header file *)
-
- const PRT_NO_MEMORY = 1;
- const PRT_WRONG_PARAMETERS = 2;
- const PRT_NOT_INITIALIZED = 3;
- const PRT_IO_ERROR = 4;
- const PRT_ERROR = 5;
-
- {$ifdef These_constants_are_defined_in_ PDrivers.pas file }
-
- (* drivers *)
-
- const Star_SR9 = 0;
- IBM9 = 1; (* IBM GraphPrinter *)
- EPSON9 = 1; (* EPSON, IBM ProPrinter *)
- PANASONIC9 = 2; (* Panasonic KX-P1124 - not tested *)
- IBM9c = 3; (* IBM ProPrinter (color) *)
- EPSON9c = 3; (* EPSON (color) *)
- EPSON24 = 4; (* 24 pins EPSON compatible printer *)
- IBM24 = 5; (* 24 pins IBM compatible printer *)
- EPSON24c = 6; (* 24 pins EPSON compatible color printer *)
- (* not tested *)
- IBM24c = 7; (* 24 pins IBM compatible color printer *)
- (* not tested *)
- HPPaintJet = 8; (* HP Paint Jet - not tested *)
- HPLJII = 9; (* HP Laser Jet *)
-
- (* modes for particular drivers *)
-
- (* EPSON9 *)
- const EPSON9_60x72 = 0;
- const EPSON9_120x72 = 1;
- const EPSON9_120x216 = 2;
- const EPSON9_240x216 = 3;
- (* STAR_SR9 *)
- const STAR_SR9_60x72 = 0;
- const STAR_SR9_120x72 = 1;
- const STAR_SR9_120x144 = 2;
- const STAR_SR9_240x144 = 3;
- (* IBM9 *)
- const IBM9_60x72 = 0;
- const IBM9_120x72 = 1;
- const IBM9_120x216 = 2;
- const IBM9_240x216 = 3;
- (* EPSON24 *)
- const EPSON24_60x180 = 0;
- const EPSON24_120x180 = 1;
- const EPSON24_180x180 = 2;
- const EPSON24_360x180 = 3;
- const EPSON24_360x360 = 4;
- (* IBM24 *)
- const IBM24_60x180 = 0;
- const IBM24_120x180 = 1;
- const IBM24_180x180 = 2;
- const IBM24_360x180 = 3;
- (* HPPJ *)
- const HPPJ_90x90 = 0;
- const HPPJ_180x180 = 1;
- const HPPJ_90x90c = 2;
- const HPPJ_180x180c = 3;
- (* HPLJII *)
- const HPLJII_75x75 = 0;
- const HPLJII_100x100 = 1;
- const HPLJII_150x150 = 2;
- const HPLJII_300x300 = 3;
-
- {$endif }
-
- (* P R O C E D U R E S P R O T O T Y P E S *)
-
- Type
- stringPtr = ^string;
-
- (* Procedures which may be called before initializing PBGI *)
- Function PRT_SetDriver ( drv, mode, width, height, options: word ): integer;
- Const
- PRT_NORMAL = 0;
- PRT_ROTATE = 1;
- PRT_INVERSE = 2;
- PRT_REVERSE = 2;
-
- Function PRT_Buffer ( address: Pointer; size: longint; usable: integer ) : integer;
- Function PRT_EMSBuffer ( handle: integer; size: longint; usable: integer ) : integer;
- Function PRT_XMSBuffer ( handle: integer; size: longint; usable: integer ): integer;
- Function PRT_SetBuffer ( size: longint; BufOpt: word ) : integer;
- Const NotUseEMS = 1;
- NotUseXMS = 2;
- { Function PRT_DefineWorld ( MaxX, MaxY: word ) : integer; }
- Function PRT_SetOutName ( DeviceName: string ) : integer;
- Function PRT_SetMargins ( left, top: integer ) : integer;
- Function PRT_RescaleFillPattern ( r: integer ) : integer;
- (* 0 = never, 1 = always , -1 = at high densities only *)
-
- (* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
- closes PBGI, prints picture, and frees the buffer.
- All above is done neccesary number of times to print
- entire picture. *)
- Type DrawFuncT = function(UserPointer:pointer): integer;
- Function PRT_PrintBGI ( var graphdriver, graphmode: integer;
- pathtodriver: string;
- Draw: DrawFuncT; UserPointer: pointer ): integer;
-
-
- (* Various informing procedures *)
- (* May be allways called *)
- Function PRT_MaxDriver: integer;
- Function PRT_DriverName ( driverno: word; var name_ptr: stringPtr ): integer;
- Function PRT_MaxMode ( driverno: word; var maxmode: integer ): integer;
- Function PRT_ModeName ( driverno: word; modeno: integer;
- var name_ptr: stringPtr ): integer;
- Function PRT_DriverNo: integer;
- Function PRT_ModeNo: integer;
- Function PRT_errormsg ( errorcode: integer ): string;
-
- Function PRT_BufferNeeded ( x1, y1, x2, y2: integer ): longint;
- Function PRT_XMSBufferNeeded ( x1, y1, x2, y2: integer ): longint;
- Function PRT_Resolution ( var Xres, Yres: integer ): integer;
-
-
- (* Procedure initializes PBGI, calls Draw(), closes PBGI,
- DOES NOT print picture, and DOES NOT allocate or free the buffer *)
- Function PRT_BuildBitMap ( var graphdriver, graphmode: integer;
- var pathtodriver: string;
- x1,y1, x2,y2: integer;
- Draw: DrawFuncT; UserPointer: pointer ): integer;
-
- (* Procedures which may be called before freeing the buffer *)
- Function PRT_GetDriverAddress ( drv: integer ): pointer;
-
- Function PRT_InitPrt ( var handle: file ): integer;
- Function PRT_EndPrt ( var handle: file ): integer;
- Function PRT_Send( s: string; slen: word): integer;
- Function PRT_PrintBuffer ( var handle: file ): integer;
- Function PRT_getpixel ( x, y: integer ): word;
- Procedure setcharsize_Pix ( width,height: integer );
- Procedure setfillpattern16 ( upattern: pointer; color: integer );
- Procedure getfillpattern16 ( upattern: pointer );
-
- Function PRT_AllocateBuffer: integer;
- Function PRT_FreeBuffer: integer;
-
-
- Function PRT_installuserdriver ( name: string; detectFunc: pointer ): integer;
- Function PRT_registerbgidriver ( driver: pointer ): integer;
- Function PRT_Unregisterbgidriver ( driver: pointer ): integer;
- Function PRT_SetViewSize( x1, y1, x2, y2: integer ): integer;
- Function PRT_initgraph( var graphdriver, graphmode: integer;
- pathtodriver: string ): integer;
-
- Function PRT_closegraph: integer; { DOES NOT free the buffer }
-
- Type
- PRT__FilePtr = ^file;
- PRT__ErrorFuncT = Function ( var handle:file): integer;
- PRT__OpenFuncT = Function ( outname: string ): PRT__FilePtr;
- PRT__CloseFuncT = Function ( var handle: file ): integer;
- PRT__WriteFuncT = Function ( var handle: file; buf: pointer;
- len: word ): integer;
- PRT__ErrorFuncP = ^PRT__ErrorFuncT;
- PRT__OpenFuncP = ^PRT__OpenFuncT;
- PRT__CloseFuncP = ^PRT__CloseFuncT;
- PRT__WriteFuncP = ^PRT__WriteFuncT;
-
- Function PRT_SetErrorFunc ( WrErrFunc: PRT__ErrorFuncT ): PRT__ErrorFuncP;
- Function PRT_SetOpenFunc ( f: PRT__OpenFuncT ): PRT__OpenFuncP;
- Function PRT_SetCloseFunc ( f: PRT__CloseFuncT ): PRT__CloseFuncP;
- Function PRT_SetWriteFunc ( f: PRT__WriteFuncT ): PRT__WriteFuncP;
-
- Function CloseCallerBGI: integer;
- Function RestoreCallerBGI ( var graphdriver, graphmode: integer;
- pathtodriver: string ): integer;
-
-
- Procedure BitImage; { link our bit image BGI driver }
-
-