home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / prbgi097.zip / C.ZIP / PRTGRAPH.H < prev    next >
C/C++ Source or Header  |  1992-12-15  |  13KB  |  317 lines

  1. /*
  2.    Printer BGI driver C interface
  3.    Copyright (c) 1991 A. Resztak
  4.  */
  5.  /*   Header file */
  6.  
  7. #ifndef __PRTGRAPH_H__
  8. #define __PRTGRAPH_H__
  9.  
  10. #if   !defined(__LARGE__) && !defined(__HUGE__)
  11.    #error PRTgraph library will run only in LARGE memory model.
  12. #endif
  13.  
  14.  
  15. #if   !defined(_PRT__pascal)
  16.       #define  _PRT__pascal
  17. #endif
  18.  
  19.  
  20.  #define PRT_NO_MEMORY           1
  21.  #define PRT_WRONG_PARAMETERS    2
  22.  #define BGI_WRONG_PARAMETERS    2
  23.  #define PRT_NOT_INITIALIZED     3
  24.  #define PRT_IO_ERROR            4
  25.  #define PRT_ERROR               5
  26.  #define PRT_NO_FILE             6
  27.  #define PRT_USER_INTERRUPT      7
  28.  
  29.  
  30.  /*   drivers  */
  31.  
  32.  #define STAR_SR9    1     /* Epson ????, Star SR  */
  33.  #define IBM9        2     /* IBM GraphPrinter, ProPrinter  */
  34.  #define EPSON9      2     /* EPSON,CITIZEN ( graphic mode: Esc,'K'/'L'/'Y'/'Z' ) */
  35.  #define EPSON9II    3     /* EPSON,CITIZEN ( graphic mode: Esc,'*',n )     */
  36.  #define PANASONIC9  4     /* Panasonic KX-P1124 - not tested */
  37.  #define IBM9c       5     /* IBM ProPrinter (color) */
  38.  #define EPSON9c     5     /* EPSON (color) (graphic mode: Esc,'K'/'L'/'Y'/'Z') */
  39.  #define EPSON9IIc   6     /* EPSON (color) - (graphic mode: Esc,'*',n) */
  40.  #define EPSON24     7     /* 24 pins EPSON compatible printer */
  41.  #define IBM24       8     /* 24 pins IBM compatible printer */
  42.  #define EPSON24c    9     /* 24 pins EPSON compatible color printer */
  43.                            /*  not tested */
  44.  #define IBM24c     10     /* 24 pins IBM compatible color printer */
  45.                            /*  not tested */
  46.  #define PaintJet    11    /* general Paint Jet  */
  47.  #define HPPaintJet  12    /* HP Paint Jet */
  48.  #define HPLJ        13    /* Laser Jet    */
  49.  #define HPLJII      14    /* HP Laser Jet */
  50.  /* #define HPLJIII     12  */
  51.  /* #define POSTSCRIPT  13  */
  52.  /* #define ROLANDP  14     */
  53.  
  54.  /* modes for particular drivers */
  55.    /* EPSON9   */
  56.       #define  EPSON9_60x72      0
  57.       #define  EPSON9_120x72     1
  58.       #define  EPSON9_120x216    2
  59.       #define  EPSON9_240x216    3
  60.    /* STAR_SR9    */
  61.       #define  STAR_SR9_60x72        0
  62.       #define  STAR_SR9_120x72       1
  63.       #define  STAR_SR9_120x144      2
  64.       #define  STAR_SR9_240x144      3
  65.    /* IBM9     */
  66.       #define  IBM9_60x72        0
  67.       #define  IBM9_120x72       1
  68.       #define  IBM9_120x216      2
  69.       #define  IBM9_240x216      3
  70.    /* EPSON24  */
  71.       #define  EPSON24_60x180     0
  72.       #define  EPSON24_120x180    1
  73.       #define  EPSON24_180x180    2
  74.       #define  EPSON24_360x180    3
  75.       #define  EPSON24_360x360    4
  76.    /* IBM24    */
  77.       #define  IBM24_60x180     0
  78.       #define  IBM24_120x180    1
  79.       #define  IBM24_180x180    2
  80.       #define  IBM24_360x180    3
  81.    /* PaintJet   */
  82.       #define  PaintJet_90x90        0
  83.       #define  PaintJet_180x180      1
  84.       #define  PaintJet_90x90c       2
  85.       #define  PaintJet_180x180c     3
  86.    /* HPPJ   */
  87.       #define  HPPJ_90x90        0
  88.       #define  HPPJ_180x180      1
  89.       #define  HPPJ_90x90c       2
  90.       #define  HPPJ_180x180c     3
  91.    /* HP LaserJet   */
  92.       #define  HPLJ_75x75        0
  93.       #define  HPLJ_100x100      1
  94.       #define  HPLJ_150x150      2
  95.       #define  HPLJ_300x300      3
  96.    /* HPLJII   */
  97.       #define  HPLJII_75x75        0
  98.       #define  HPLJII_100x100      1
  99.       #define  HPLJII_150x150      2
  100.       #define  HPLJII_300x300      3
  101.  
  102.  
  103.  
  104. #include "BGI2.h"
  105.  
  106.  
  107. typedef  unsigned char  byte;
  108.  
  109.  
  110. #define PRT_HaltValue 100
  111. extern volatile byte PRT_DATA pascal PRT_HaltPrinting;
  112.  
  113.  
  114.  /*   F U N C T I O N S    P R O T O T Y P E S  */
  115.  
  116. #ifdef __cplusplus
  117. extern "C" {
  118. #endif
  119.  
  120. int  PRT_FUNC PRT_LinkDrivers(void);
  121. int  PRT_FUNC PRT_ReadDrivers
  122.      ( const char PRT__FAR_PTR* path, const char PRT__FAR_PTR* filename );
  123. int PRT_FUNC PRT_End(void);
  124.  
  125. int PRT__HUGE_PROC pascal PRT_SetPrinterDrv ( unsigned drv, unsigned mode );
  126. int PRT__HUGE_PROC pascal PRT_SetPictureInch ( unsigned width, unsigned height,
  127.                                            unsigned options );
  128. int PRT__HUGE_PROC pascal PRT_SetPicturePix ( unsigned hPix, unsigned vPix,
  129.                                               unsigned options );
  130. int PRT_FUNC PRT_SetDriver ( unsigned drv, unsigned mode,
  131.                             unsigned width, unsigned height,
  132.                             unsigned options );
  133.    #define  PRT_NORMAL     0
  134.    #define  PRT_ROTATE     1
  135.    #define  PRT_INVERSE    2
  136.    #define  PRT_REVERSE    2
  137.  
  138. int PRT_FUNC PRT_SetDriverFName ( const char PRT__FAR_PTR* fname );
  139.  
  140. int PRT_FUNC  PRT_FormFeedNeeded ( int ffneeded );
  141.  
  142. // #if ForPascal
  143.    typedef int far *PRT__handleT; /* pointer to Pascal File */
  144. // #else
  145. //   typedef int   PRT__handleT;
  146. // #endif
  147.  
  148. unsigned PRT_FUNC PRT_Version(void);
  149.  
  150.  
  151.  /* Procedures which may be called before initializing PBGI */
  152. int  PRT_FUNC PRT_Buffer ( void far *address, long size, int usable );
  153. int  PRT_FUNC PRT_EMSBuffer ( int EMShandle, long size, int usable );
  154. int  PRT_FUNC PRT_XMSBuffer ( int XMShandle, long size, int usable );
  155. int   PRT_FUNC   PRT_SetBuffer ( long size, unsigned BufOpt );
  156.       #define  NotUseEMS   1
  157.       #define  NotUseXMS   2
  158.  // int PRT_FUNC PRT_DefineWorld ( unsigned MaxX, unsigned MaxY );
  159.  int  PRT_FUNC   PRT_SetOutName ( const char PRT__FAR_PTR * DeviceName );
  160.  const char PRT__FAR_PTR *   PRT_FUNC   PRT_GetOutName ( void );
  161.  int  PRT_FUNC   PRT_SetMargins ( int left, int top );
  162.  int  PRT_FUNC PRT_RescaleFillPattern ( int r );
  163.                         /* 0 = never, 1 = always , -1 = at high densities only */
  164.  
  165.  /* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  166.     closes PBGI, prints picture, and frees the buffer.
  167.     All above is done neccesary number of times to print
  168.     entire picture. */
  169. int PRT_FUNC PRT_PrintBGI ( int far * graphdriver, int far *graphmode,
  170.                                const char far *pathtodriver,
  171.                             int ( PRT_CFUNC *Draw)
  172.                                   (void PRT__FAR_PTR * UserPointer),
  173.                             void PRT__FAR_PTR* UserPointer );
  174.  
  175.        /* Various informing procedures */
  176.    /* May be allways called   */
  177.  int  PRT_FUNC   PRT_MaxDriver ( void );
  178.  int  PRT_FUNC   PRT_DriverName ( unsigned driverno, const char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr  );
  179.  int  PRT_FUNC   PRT_MaxMode ( unsigned driverno, int PRT__FAR_PTR *maxmode );
  180.  int  PRT_FUNC   PRT_ModeName ( unsigned driverno, int modeno,
  181.                               const char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr );
  182.  int PRT_FUNC PRT_ModeParms ( unsigned drv, unsigned mode,
  183.                               unsigned far *Xres, unsigned far *Yres,
  184.                               unsigned far *colors );
  185.  int  PRT_FUNC   PRT_DriverNo ( void );
  186.  int  PRT_FUNC   PRT_ModeNo ( void );
  187.  char far * PRT_FUNC   PRT_grapherrormsg ( int errorcode );
  188.  
  189.     /*  May be called only after PRT_SetDriver */
  190.  long PRT_FUNC   PRT_BufferNeeded ( int x1, int y1, int x2, int y2 );
  191.  long PRT_FUNC   PRT_EMSBufferNeeded ( int x1, int y1, int x2, int y2 );
  192.  long PRT_FUNC   PRT_XMSBufferNeeded ( int x1, int y1, int x2, int y2 );
  193.  int  PRT_FUNC   PRT_MaxFitArea ( int far *dxPtr, int far *dyPtr,
  194.                                 int far *adj_xPtr, int far * adj_yPtr );
  195.  
  196.  int  PRT_FUNC   PRT_Resolution ( int PRT__FAR_PTR *Xres, int PRT__FAR_PTR *Yres );
  197.  
  198.  
  199.  /* Procedure initializes PBGI, calls Draw(), closes PBGI,
  200.     DOES NOT print picture, and DOES NOT allocate or free the buffer */
  201. int PRT_FUNC  PRT_BuildBitMap (
  202.                               int far * graphdriver, int far *graphmode,
  203.                                         const char far *pathtodriver,
  204.                               int x1,int y1, int x2,int y2,
  205.                               int ( PRT_CFUNC *Draw)
  206.                                   (void PRT__FAR_PTR * UserPointer),
  207.                               void PRT__FAR_PTR* UserPointer );
  208.  
  209. #if ForPascal
  210.    int PRT_FUNC PRT_Send( const char far *s);
  211. #else
  212.    int PRT_FUNC PRT_Send( const char far *s, unsigned slen);
  213. #endif
  214.  
  215. /* Procedures which may be called before freeing the buffer */
  216. int PRT_FUNC PRT_InitPrt ( PRT__handleT handle );
  217. int PRT_FUNC PRT_EndPrt ( PRT__handleT handle );
  218. int PRT_FUNC  PRT_FirstPicPart ( void );
  219. int PRT_FUNC  PRT_LastPicPart ( void );
  220. int PRT_FUNC PRT_PrintBuffer (PRT__handleT *handlePPtr);
  221. int PRT_FUNC   PRT_WritePCX ( PRT__handleT *handlePPtr );
  222.  
  223. unsigned PRT_FUNC  PRT_getpixel ( int x, int y );
  224. void far * PRT_FUNC  PRT_getpixeladdress( int far* bitno, int Bufx, int Bufy,
  225.                                           int planeno );
  226. void  PRT_FUNC   setfillpattern16 ( char PRT__FAR_PTR * upattern, int color );
  227. void  PRT_FUNC   getfillpattern16 ( char PRT__FAR_PTR * upattern );
  228. void  PRT_FUNC   setcharsize_Inch (int width, int height);
  229.       /* Sets char size in 1/1000 inch but is version dependent.
  230.          Might cause link errors in versions other than BC++ 2.0 or 3.0 */
  231. void  PRT_FUNC   setcharsize_Pix (int width, int height);
  232.  
  233. int   PRT_FUNC   PRT_AllocateBuffer ( void );
  234. int   PRT_FUNC   PRT_FreeBuffer (void);
  235. void  PRT_FUNC   PRT_SetHaltVariable(const byte far *haltVariable);
  236.  
  237.  
  238.     int PRT_FUNC PRT_installuserdriver ( const char far * name, int huge (*detect)(void) );
  239.    int PRT_FUNC PRT_registerfarbgidriver ( void far pascal (*driver)(void) );
  240.    int PRT_FUNC PRT_Unregisterfarbgidriver ( void far pascal(*driver)(void) );
  241.    int PRT_FUNC PRT_SetBuildSize( int x1, int y1, int x2, int y2 );
  242.    int PRT_FUNC PRT_initgraph( int far * graphdriver, int far *graphmode,
  243.                                                     const char far *pathtodriver );
  244.    int PRT_FUNC PRT_closegraph(void); /* DOES NOT free the buffer   */
  245.  
  246.    typedef int PRT_CFUNC ( * pascal PRT_ErrorFuncP) ( PRT__handleT handle );
  247.    typedef PRT__handleT PRT_CFUNC ( * pascal PRT_OpenFuncP)
  248.                                   ( const char far* outname, int omode );
  249.    typedef int PRT_CFUNC ( * pascal PRT_CloseFuncP)( PRT__handleT handle );
  250.    typedef int PRT_CFUNC ( * pascal PRT_WriteFuncP)( PRT__handleT handle, const void PRT__FAR_PTR * b,
  251.                                                            unsigned len );
  252. PRT_ErrorFuncP PRT_FUNC PRT_SetErrorFunc ( int           PRT_CFUNC WrErrFunc(PRT__handleT handle) );
  253. PRT_OpenFuncP  PRT_FUNC PRT_SetOpenFunc  ( PRT__handleT  PRT_CFUNC
  254.                                            f(const char far* outname,int omode) );
  255. PRT_CloseFuncP PRT_FUNC PRT_SetCloseFunc ( int          PRT_CFUNC f(PRT__handleT handle) );
  256. PRT_WriteFuncP PRT_FUNC PRT_SetWriteFunc ( int PRT_CFUNC
  257.                                                  f(PRT__handleT handle,
  258.                                                    const void PRT__FAR_PTR * b,
  259.                                                    unsigned len) );
  260.  
  261. typedef int _PRT__pascal PRT_UserPrintFuncT( void far* UserPtr,
  262.                                                   PRT__handleT   *handlePPtr,
  263.                                              const char far* BGIpath);
  264. PRT_UserPrintFuncT far * PRT_FUNC
  265.      PRT_SetUserPrintFunc(PRT_UserPrintFuncT far* func);
  266.  
  267. typedef int _PRT__pascal PRT_UserBeforeBuildFuncT( void far* UserPtr );
  268. PRT_UserBeforeBuildFuncT* PRT_FUNC
  269.         PRT_SetUserBeforeBuildFunc(PRT_UserBeforeBuildFuncT far* func);
  270.  
  271. int PRT_FUNC PRT_PreviewPossible(int driver);
  272.  
  273.  
  274. int PRT_FUNC BGIactive ( int BGIgroup );
  275. int PRT_FUNC CloseCallerBGI ( void );
  276. int PRT_FUNC RestoreCallerBGI ( int far * graphdriver, int far *graphmode,
  277.                               const char far *pathtodriver );
  278.  
  279.  
  280. extern void far pascal BitImage(void);  /* link our bit image BGI driver */
  281.  
  282. #ifdef __cplusplus
  283.    }
  284. #endif
  285.  
  286.  
  287. #ifdef __cplusplus
  288. extern "C" {
  289. #endif
  290. int PRT_FUNC MoveToScrn ( int graphdriver, int graphmode,
  291.                             int BufLeft, int BufTop,
  292.                             int ScrnLeft, int ScrnTop,
  293.                             int width, int height );
  294. int PRT_FUNC PRT_MoveToScrn ( int BufLeft, int BufTop,
  295.                               int ScrnLeft, int ScrnTop,
  296.                               int width, int height );
  297. int PRT_FUNC PRT_ScrollScrn
  298.     (int *dxPtr, int *dyPtr );
  299. #ifdef __cplusplus
  300. }
  301. #endif
  302.  
  303.  
  304. #ifdef __cplusplus
  305. extern "C" {
  306. #endif
  307.       PRT__handleT PRT_CFUNC __PRT_Open(const char far* outname,int omode);
  308.       int          PRT_CFUNC __PRT_Close( PRT__handleT handle );
  309.       int          PRT_CFUNC __PRT_Write( PRT__handleT handle, const void PRT__FAR_PTR * b, unsigned len );
  310. #ifdef __cplusplus
  311.            }
  312. #endif
  313.  
  314. #endif  // __PRTGRAPH_H__
  315.  
  316.    /* end of PRTGRAPH.H  */
  317.