home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-20 | 101.6 KB | 2,679 lines |
-
- PGRAPH Version 1.10
-
- An MS-DOS C Standard Printer Interface
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Written and Distributed by:
-
- Frank van der Hulst,
- 101 Epuni St,
- Lower Hutt,
- New Zealand
-
- Electronic mail to:
- UseNet: frank@cavebbs.gen.nz
- FidoNet: frank vanderhulst at GenBoard (Node 3:771/160)
-
- Phone (Voice): 0064 4 693-481
-
- 20 June 1991
-
-
- ───────────────────────────────────────────────────────────────────────────
-
- Program and Documentation Copyright Frank van der Hulst, 1991
- All rights reserved
-
- Portions Copyright 1987, 1989 Borland International.
- Portions Copyright Microsoft Corporation.
-
- PC-DOS, PC, PC XT, PC AT, and PS/2 are trademarks of IBM Corporation.
- MS-DOS, OS/2, and Windows are trademarks of Microsoft Corporation.
-
- No part of this document may be reproduced, stored in a retrieval system,
- or transcribed, in any form or by any means, electronic, mechanical,
- photocopying, recording, scanning or otherwise, other than as stated in the
- license agreement, without the prior permission of:
-
- Frank van der Hulst,
- 101 Epuni St,
- Lower Hutt,
- New Zealand
-
- ───────────────────────────────────────────────────────────────────────────
-
-
-
- PGRAPH Printer Graphics Library Page i.
-
-
-
- TABLE OF CONTENTS
-
- Introduction..............................................................1
-
- Registration Information..................................................1
-
- PGRAPH License Agreement..................................................2
- Shareware Version:........................................................2
- Registered Version:.......................................................3
- Source Code Version:......................................................3
-
- DISCLAIMER................................................................4
-
- Technical Support.........................................................4
-
- PGRAPH Features...........................................................5
- Minimal Program Size......................................................5
- Video Support.............................................................5
- Printer Support...........................................................5
- Networks..................................................................5
- Planned Improvements......................................................5
-
- PGRAPH Files..............................................................6
- Test Driving PGRAPH.......................................................7
- Using PGRAPH in your own programs.........................................8
- Limitations and variations from GRAPHICS.LIB..............................9
-
- PGRAPH Function Reference................................................11
- p_arc....................................................................12
- p_bar....................................................................12
- p_bar3d..................................................................12
- p_circle.................................................................13
- p_cleardevice............................................................13
- p_clearviewport..........................................................13
- p_closegraph.............................................................13
- p_drawpoly...............................................................14
- p_dump...................................................................14
- p_ellipse................................................................14
- p_fillellipse............................................................14
- p_fillpoly...............................................................15
- p_floodfill..............................................................15
- p_getarccoords...........................................................15
- p_getaspectratio.........................................................15
- p_getcolor...............................................................16
- p_getdrivername..........................................................16
- p_getfillpattern.........................................................16
- p_getfillsettings........................................................16
- p_getgraphmode...........................................................16
- p_getimage...............................................................17
- p_getlinesettings........................................................17
- p_getmaxcolor............................................................17
- p_getmaxmode.............................................................17
- p_getmaxx................................................................17
- p_getmaxy................................................................17
- p_getmodename............................................................18
- p_getmoderange...........................................................18
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page ii.
-
-
- p_getpixel...............................................................18
- p_getresolution..........................................................18
- p_gettextsettings........................................................18
- p_getx...................................................................18
- p_gety...................................................................19
- p_graphdefaults..........................................................19
- _p_graphfreemem..........................................................19
- _p_graphgetmem...........................................................20
- p_graphresult............................................................20
- p_imagesize..............................................................21
- p_initgraph..............................................................21
- p_line...................................................................22
- p_linerel................................................................22
- p_lineto.................................................................22
- p_moverel................................................................23
- p_moveto.................................................................23
- p_outtext................................................................23
- p_outtextxy..............................................................23
- p_pieslice...............................................................23
- p_print..................................................................24
- p_putimage...............................................................24
- p_putpixel...............................................................25
- _p_putpixel_screen.......................................................25
- p_rectangle..............................................................25
- p_registerbgidriver......................................................26
- p_registerbgifont........................................................26
- p_registerfarbgidriver...................................................26
- p_registerfarbgifont.....................................................26
- p_sector.................................................................27
- p_setaspectratio.........................................................27
- p_setcolor...............................................................27
- p_setfillpattern.........................................................27
- p_setfillstyle...........................................................28
- p_setgraphmode...........................................................28
- p_setlinestyle...........................................................29
- p_settextjustify.........................................................29
- p_settextstyle...........................................................30
- p_setusercharsize........................................................31
- p_setviewport............................................................31
- p_setwritemode...........................................................32
- p_textheight.............................................................32
- p_textwidth..............................................................32
- p_view...................................................................32
-
- MAKING A .PGI FILE.......................................................33
- Printer Description......................................................33
- Graphics Modes Descriptions..............................................34
-
- REVISION HISTORY.........................................................38
-
- Index....................................................................39
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 1.
-
-
-
- Introduction
-
- If you're tired of re-writing your programs for the various printers
- available, you'll love PGRAPH!
-
- PGRAPH is a library of C functions designed to allow you to print graphics
- as easily as you can display them on the screen of your IBM PC or
- compatible system. It provides a BGI-like (Borland Graphics Interface) to
- your printer.
-
- PGRAPH is a library of graphics routines, similar to those provided by
- Borland in GRAPHICS.LIB. As such, it is a programmer's toolkit, and is not
- designed for the end-user. It allows you to print any graphic image,
- including Borland's stroked fonts, on a wide range of printers.
-
- These functions take the same number and type of parameters as the Borland
- functions, so that it is a simple matter to "redirect" graphics output from
- the screen to your printer.
-
- A cut-down version of PGRAPH is distributed as shareware, so that you can
- try it out before you decide whether you'd like to buy the full version.
- The complete version is available only from the author, on payment of a
- registration fee.
-
- The following pages include information on registration, the PGRAPH license
- agreement, and technical support for PGRAPH.
-
- Currently, there is no printed manual. Registered users get a copy of this
- file, formatted and ready to print on a LaserJet III, or in XyWrite format.
- If there should be sufficient demand, a printed version may be
- commissioned.
-
- Registration Information
-
- PGRAPH is a copyrighted program protected by both N.Z. and international
- copyright law. If you obtained PGRAPH from a shareware disk vendor, an on-
- line computer service or bulletin board, a friend or colleague, or another
- similar source, you have an unregistered (trial) copy. You are authorized
- to use this copy without charge for a limited period of time under the
- terms of the PGRAPH license agreement. After this time is up, you must
- register and pay for PGRAPH to continue using it.
-
- This method of distribution is known as shareware. It allows you to
- determine whether PGRAPH meets your needs before you pay for it.
-
- The registration fee for a single copy of PGRAPH is NZ$75. This is
- approximately US$50 at current exchange rates. Payment of this fee entitles
- you to:
-
- * A copy of PGRAPH, registered to you. This may be delivered either via
- a diskette, or via E-mail.
-
- * An upgrade to the next major release of PGRAPH. Upgrades may be
- delivered either via E-mail, or on diskette. If you need an upgrade on
- diskette there will be a minimal processing charge to cover my costs
- in sending it to you.
-
- * Technical support via electronic mail or telephone.
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 2.
-
-
-
- Network, site, and corporate licenses are also available; contact the
- author for more information.
-
- Source code is available at a price of NZ$125 (approximately US$100).
-
- Please make payment by transferring the correct amount to my bank account
- (number 060529-0320661-00) at the Lower Hutt branch of the National Bank of
- New Zealand.
-
-
- PGRAPH License Agreement
-
- The PGRAPH library and all programs and documentation distributed or
- shipped with it are Copyright Frank van der Hulst, 1991, and are protected
- by N.Z. and International copyright law. In the rest of this document, this
- collection of files is referred to simply as "PGRAPH". You are granted a
- license to use your copy of PGRAPH only under the terms and conditions
- specified in this license agreement.
-
- PGRAPH is distributed in three forms:
-
- * A "shareware" copy of PGRAPH is a copy distributed on diskette or via
- an electronic bulletin board, on-line service, or other electronic
- means, obtained from a shareware disk vendor, or obtained from another
- individual, and which displays the legend "shareware" on the diskette
- label (if applicable). On it, the library files are called
- PGRAPHTT.LIB and PGRAPHLM.LIB.
-
- * A "registered" copy of the PGRAPH library is a copy distributed on
- diskette or via electronic mail, purchased from F van der Hulst. It
- includes library files for all memory models, for either the Turbo-C
- or the MS-C compiler.
-
- * A "source code" copy of the PGRAPH library is a copy distributed on
- diskette or via electronic mail, purchased from F van der Hulst. It
- includes C and Assembler source code for all of the functions in the
- PGRAPH library, and utilities associated with it.
-
- "Printer Graphics Interface" files (with a .PGI extension), whether
- included in the package or developed by the user, may be freely
- distributed.
-
-
- Different conditions apply to the three versions, as follows:
-
- Shareware Version:
-
- Shareware copies of PGRAPH are distributed to allow you to try the program
- before you pay for it. They are not "free" or "public domain" software. You
- may use PGR_TCSH.LIB or PGR_MSSH at no charge for a trial period of up to
- 21 days. If you wish to continue using PGRAPH after that period, you must
- purchase a registered copy. If you choose not to purchase a registered
- copy, you must stop using PGRAPH, though you may keep copies and pass them
- along to others.
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 3.
-
-
- This document, the shareware versions of the library (PGRAPHTT.LIB and
- PGRAPHLM.LIB), and the associated header file may be freely copied provided
- that:
-
- All of the files are copied as a group (such as in a single archive).
- See below for a list of files.
-
- The files are not modified in any way (including removal or
- alteration of copyright notices or this license).
-
- No charge beyond a cost-recovery fee not to exceed $5 is made.
-
- You may NOT distribute any program which includes code derived from the
- shareware version of the package.
-
- Registered Version:
-
- Registered copies of PGRAPH are distributed to those who have purchased
- them. Just like Borland's No-Nonsense License Agreement, you may install
- PGRAPH on many computers, so long as only one version can be used at a
- time. The same applies to networks.
-
- You may copy the registered version of PGRAPH for normal backup purposes.
-
- This registration license may NOT be transferred to any other person or
- organisation without the permission of F van der Hulst.
-
- Programs created using PGRAPH should include the following acknowledgement
- in their documentation:
-
- "This program uses the PGRAPH printer graphics package developed by F van
- der Hulst, Wellington, New Zealand".
-
- If you are dissatisfied with a registered copy of PGRAPH for any reason,
- you may erase your copy of PGRAPH from your system (and if applicable,
- return the diskette) at any time up to 90 days after purchase and receive a
- full refund of your original registration fee.
-
- Registered users get a copy of this documentation file, formatted and ready
- to print on a LaserJet III, or in a word processor format of their choice
- (where possible).
-
- Source Code Version:
-
- Source Code copies of PGRAPH are distributed to those who have purchased
- them. Just like Borland's No-Nonsense License Agreement, you may install
- PGRAPH on many computers, so long as only one version can be used at a
- time. The same applies to networks.
-
- You may copy the source code version of PGRAPH for normal backup purposes.
-
- This registration license may NOT be transferred to any other person or
- organisation without the permission of F van der Hulst.
-
- Source code derived from the PGRAPH package may not be distributed in any
- way without the permission of F van der Hulst.
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 4.
-
-
- Programs created using PGRAPH should include the following acknowledgement
- in their documentation:
-
- "This program uses code derived from the PGRAPH printer graphics package
- developed by F van der Hulst, Wellington, New Zealand".
-
- If you are dissatisfied with a registered copy of PGRAPH for any reason,
- you may erase your copy of PGRAPH from your system (and if applicable,
- return the diskette) at any time up to 90 days after purchase and receive a
- full refund of your original registration fee.
-
- Registered users get a copy of this documentation file, formatted and ready
- to print on a LaserJet III, or in a word processor format of their choice
- (where possible).
-
-
- DISCLAIMER
-
- Although I have tested the code which comprises PGRAPH it is entirely
- possible that PGRAPH may malfunction in environments or under circumstances
- in which it has not been tested. This code is provided AS IS, and the
- author disclaims any and all responsibility for damages (both consequential
- and incidental) resulting from the use or misuse of PGRAPH. Sole
- responsibility for determining the suitability of the code rests with the
- user.
-
-
- Technical Support
-
- Full technical support for PGRAPH is available only to registered users. If
- you are not a registered user, support is limited to assistance with the
- installation of a shareware copy of PGRAPH for a 21 day evaluation period.
-
- The best way to contact me for support is via Electronic Mail, preferably
- via UseNet. Generally, a message will be acknowledged within one day of
- receipt. There will obviously be some delay, involved in transmitting a
- message through a network.
-
- Bulletin Boards: Primary support is via the "Local Software" Forum (Area 4)
- of Genboard BBS, Wellington, NZ 0064 4 499-0490. Genboard is attached to
- the FidoNet BBS Network as Node 3:771/160. You may expect a response within
- 3-5 days. Please note that Genboard is an independent bulletin board which
- has agreed to serve as a home base for PGRAPH support, but is not owned or
- operated by me.
-
- In addition, registered users may contact me for support by mail, or
- telephone. My address and phone number are listed on the first page of this
- manual.
-
- I prefer support via one of the electronic services listed above, or via
- electronic mail, as it allows correspondence at convenient times regardless
- of time zones and work schedules, and it provides a record of the
- communication. However, telephone support is also provided to those users
- who do not have a modem and need a quick response. Please check what time
- it is in New Zealand (usually 12 hours ahead of GMT) before you call. In
- general, support is only available between 5pm and 10pm NZ time.
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 5.
-
-
-
- PGRAPH Features
-
- PGRAPH is written for the IBM PC, PC/XT, PC/AT, PS/2 (all models), and
- compatibles. It was developed using Turbo C v2.01. Libraries are provided
- for Turbo C v2.01 and Microsoft C v5.10.
-
- PGRAPH.LIB is a library of graphics routines, similar to those provided by
- Borland in GRAPHICS.LIB. These functions perform similar tasks to, and
- take the same number and type of parameters as, the Borland functions.
-
- This library contains code which is really only useful with Turbo C or MS
- C, since it calls routines which are located in the vendor's libraries. It
- is my intention to release versions for other C compilers in the future.
-
-
- Minimal Program Size
-
- PGRAPH is split up into several small modules, so that only the required
- modules are linked to the executable program.
-
- Video Support
-
- PGRAPH allows the program to simultaneously output the image being printed
- to the video screen by using a user-provided pixel-display routine.
-
- Printer Support
-
- This version of PGRAPH includes drivers for the following printers:
-
- HP LaserJet (series II or III)
- Epson LX-400
- Star NX-10
-
- These last two are 9-pin dot-matrix printers, and support modes available
- on almost any "IBM Graphics Printer"-compatible printer.
-
- Adding support for new printers is a simple process.
-
- Networks
-
- PGRAPH outputs to the printer by printing to stdprn, and works successfully
- with programs which redirect printer output. This includes networks such as
- Novell Netware. Output can also be redirected to other devices such as disk
- files from within the user program.
-
-
- Planned Improvements
-
- Improvements will depend on registrations. If no-one registers, I'm not
- going to spend any more of my time on this package.
-
- * Make the library compiler & memory model independent.
-
- * Use XMS/EMS/Disk for memory buffers.
-
- * Create a Turbo Pascal .TPU unit which links to the C code.
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 6.
-
-
-
- * Support for colour printers, including allowing the programmer to set
- the palette and background colour.
-
- * Closer integration into Borland's BGI system, including putting code
- into the PGI driver file. This will allow support for plotters, and
- use of (for example) the line drawing features available on the
- LaserJet III.
-
- * Fix the bug in calculating start and end-points of arcs.
-
- * Fix the problem with drawing thick lines in XOR mode.
-
- I welcome feedback on the above, and suggestions of other improvements.
-
-
- PGRAPH Files
-
- The files listed below are part of PGRAPH. Depending on where you obtained
- your copy, you may find the files in a compressed form, usually in a file
- with the extension .ZIP. These files may change from time to time. See the
- file README.DOC for up to date information on which files are included with
- your copy of PGRAPH.
-
- PGRAPHTT.LIB The PGRAPH library for Tiny model Turbo C.
-
- PGRAPHLM.LIB The PGRAPH library for Large model MS C.
-
- PGRAPH.H The PGRAPH header file. This includes all the
- prototypes which allow your compiler to check that
- calls to the library are correct.
-
- *.PGI These files contain the interface information required
- for various printers.
-
- *.OBJ .PGI files converted to .OBJ, so that the drivers can
- be linked into the executable program.
-
- MAKE_PGI.EXE A program which allows you to create a new .PGI file.
-
- PGRAPH.DOC The PGRAPH manual.
-
- DEMO.EXE A demonstration program, created with the Medium memory
- model PGRAPH library, which demonstrates various
- features of the package.
-
- DEMO.C Main program source code for the above program. You
- will NOT be able to compile and link this unless you
- have the registered version.
-
- DEMO_SUB.C Subprograms for various demonstrations to link with
- DEMO.C.
-
- DEMO.PRJ Turbo C v2.0 project file used to create DEMO.EXE
-
- DEMO_CFG.TC Turbo C v2.0 IDE configuration file to create DEMO.EXE
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 7.
-
-
- MAKE.MSC Microsoft C MAKE file used to create DEMO.EXE
-
- README.DOC Last-minute revisions and bug reports.
-
- In addition, the registered version of PGRAPH includes the following:
-
- PGRAPHT?.LIB The PGRAPH library for Tiny model.
- PGRAPHS?.LIB The PGRAPH library for Small model.
- PGRAPHM?.LIB The PGRAPH library for Medium model.
- PGRAPHC?.LIB The PGRAPH library for Compact model.
- PGRAPHL?.LIB The PGRAPH library for Large model.
- PGRAPHH?.LIB The PGRAPH library for Huge model.
-
- The last character of the filename will be either an M
- or a T, depending on whether they order the MicroSoft
- or Turbo C version.
-
- BIN_ASM.C A program to convert a .PGI file to an assembler source
- file, which can then be assembled and the resulting
- .OBJ file linked into a program.
-
- Test Driving PGRAPH
-
- If you are running in a network environment, or wish to spool the printer
- output to a file, you should first set up the printer output system. For
- example, on a Novell Netware system, you should LOGIN and use CAPTURE to
- direct the output of LPT1 to your network printer.
-
- To run the demonstration program:
-
- * Change to the directory DEMO.EXE is resident in
- * Copy the BGI driver for your screen into the directory
- * Copy TRIP.CHR (the triplex font file) into the directory
- * Copy any PGI drivers (except STAR and LASERJET) required into the
- directory
- * Execute DEMO.EXE.
-
- DEMO.EXE can take the following command line options:
-
- /O=device
- /P=printer_type
- /M=mode
- /D=demos
-
- device allows you to redirect the PGRAPH output to another file; for
- example /O=STAR.PRN will output to the disk file STAR.PRN, which can later
- be printed using COPY/B STAR.PRN LPT1:
-
- The default value is PRN
-
- printer_type allows you to identify what printer is attached: valid values
- are STAR, LASERJET, LX400, USER1, and USER2. Default value is STAR
-
- mode allows you to specify which printer mode to use: valid values will
- vary, depending on what printer is selected. See the section on p_initgraph
- below. The default value depends on the printer and what modes are
- available on it -- by default, the program will select the mode which gives
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 8.
-
-
- sufficient X resolution to print the widest demonstration image (801 pixels
- wide), which on most printers will be better than 100dpi. If there are
- several modes with that X resolution, it will select the lowest Y
- resolution.
-
- demos allows you to select which parts of the demo program to run:
-
- A Draw a full page of lines, ellipses, and polygons
- B Register stroked fonts (Gothic and script), and print them in
- different sizes and orientations
- C Print default font in various sizes and orientations
- D Print stroked (Triplex) and default font horizontally, using
- various justification settings
- E Print stroked (Triplex) and default font vertically, using
- various justification settings
- F Print stroked font (Triplex) , using various scaling factors
- G Fill various shapes with various patterns
- H Fill an arbitrary shape, using floodfill()
- I Draw various lines in different directions, with a user-defined
- pattern
- J Draw circular and elliptical pie charts on the printer.
- K Display a woman's face on the printer and screen, firstly
- unscaled (it was saved as an image from a CGA screen via
- getimage), then scaled to fit the printer's aspect ratio as near
- as possible. In between, use putimage & getimage, and p_putimage
- & p_getimage, to swap characters from the printer buffer to
- screen and vice versa.
- L Draw a circular pie chart on the printer, then display it on the
- screen, without printing it.
-
- By default, each demo is run in turn. This may take a long time -- for
- example, several hours if you have selected 240*216 mode on a dot-matrix
- printer.
-
-
- Using PGRAPH in your own programs
-
- If you are test-driving PGRAPH using the shareware version, rename the
- appropriate copy of the library (PGRAPHTT.LIB for Turbo C, PGRAPHLM.LIB for
- Microsoft C) to PGRAPH.LIB. If you are using the registered version, rename
- either PGR_TC.LIB (for Turbo C) or PGR_MS.LIB (Microsoft C) to PGRAPH.LIB.
-
- The demonstration program (DEMO.C and DEMO_SUB.C) may be edited and
- compiled. Note that the shareware version of the Turbo C library is for the
- Tiny model. Therefore Turbo C programmers compiling the demonstration
- program should compile using Tiny model, which will result in certain
- functions not being included.
-
- Use #include <PGRAPH.H> or #include "PGRAPH.H" in your source file to
- include the function prototypes and structure definitions from the header
- file at compile time. Turbo C users should include PGRAPH.H after
- GRAPHICS.H (if you include that file), since PGRAPH.H includes definitions
- for various struct's which are identical to those used in the GRAPHICS.H
- header file.
-
- Then use the functions provided in PGRAPH.LIB (p_initgraph(), p_putpixel(),
- p_closegraph(), etc.) as you would the corresponding initgraph(),
- putpixel(), etc.
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 9.
-
-
- When linking, you must include PGRAPH.LIB so that code can be linked into
- the executable. A sample TCC line would be
-
- tcc -mc <other-flags> sample pgraph.lib library.lib
-
-
- Limitations and variations from GRAPHICS.LIB
-
- 1) PGRAPH only prints in black and white.
-
- 2) PGRAPH builds up a bit map of the image to be printed in memory, then
- prints it out when p_print() is called. This means that large images
- cannot be printed. An image is not limited to 64K, only to the amount
- of free memory in your machine. It is possible to print a full page of
- high-resolution graphics by printing out several strips (say) 2 inches
- high. For example, a page image on a LaserJet at 300 dpi by 300 dpi
- requires 970K of memory. This could be printed out as 5 strips, each 2
- inches high and requiring 175K.
-
- 3) Because PGRAPH prints from a bit image, it is not suitable for
- outputting to plotters. This also means it can't take advantage of the
- anti-aliasing available on (for example) the LaserJet III.
-
- 4) Because my routines are slightly different from Borland's, some images
- will be printed slightly differently from what you see on the screen.
- This is true for ellipses (and all shapes based on them -- arcs,
- circles, sectors, etc.) where I have used Kappel's ellipse-drawing
- algorithm whereas Borland appear to have used Bresenham's. Usually the
- differences are no more than one or two pixels, except where the
- radius is less than three. Similarly, my line-drawing routine
- sometimes selects different pixels from Borland's. These differences
- will almost always be invisible, except where two shapes are drawn
- close together.
-
- 5) As in GRAPHICS.LIB, arc start and end angles are expressed in degrees,
- with 0 degrees at 3 o'clock, 90 degrees at 12 o'clock, etc. There is a
- minor discrepancy in terms of calculating the start and end points of
- arcs. This may result in a small gap being left between two arcs which
- should end up at the same point.
-
- For example,
-
- p_arc(10, 10, 60, 90, 50);
- p_arc(10, 10, 0, 60, 50);
-
- may not result in a complete arc from 0 to 90 degrees.
-
- 6) GRAPHICS.LIB only allows line, linerel, lineto, rectangle, and
- drawpoly to write in XOR mode after calling setwritemode(XOR_PUT).
- PGRAPH applies the mode set by p_setwritemode() to all output.
-
- 7) When drawing thick lines in XOR mode, the lines may be partially
- erased, particularly diagonal lines and parts of arcs. This is because
- these functions simply plot a 3 by 3 grid of pixels around each point
- on the line, which often means that for a diagonal line the same point
- may be plotted an even number of times, effectively restoring it to
- its original colour.
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 10.
-
-
-
- 8) GRAPHICS.LIB allocates 4K (or some other amount set by calling
- setgraphbufsize) for use by routines within it. PGRAPH allocates and
- frees memory as it goes.
-
- 9) White is represented by the value 0 in PGRAPH, and black by 1. In
- GRAPHICS.LIB, it's the other way round.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 11.
-
-
- PGRAPH Function Reference
-
- PGRAPH.LIB contains over 70 functions. Most are similar to those in
- GRAPHICS.LIB. A few are extensions. The remainder are used within the
- library.
-
- These commands are similar to those in GRAPHICS.LIB:
-
- p_arc p_bar3d p_bar
- p_circle p_cleardevice p_clearviewport
- p_closegraph p_drawpoly p_ellipse
- p_fillellipse p_fillpoly p_floodfill
- p_getarccoords p_getaspectratio p_getcolor
- p_getdrivername p_getfillpattern p_getfillsettings
- p_getgraphmode p_getimage p_getlinesettings
- p_getmaxcolor p_getmaxmode p_getmaxx
- p_getmaxy p_getmodename p_getmoderange
- p_getpixel p_gettextsettings p_getx
- p_gety p_graphdefaults _p_graphfreemem
- _p_graphgetmem p_graphresult p_imagesize
- p_initgraph p_line p_linerel
- p_lineto p_moverel p_moveto
- p_outtext p_outtextxy p_pieslice
- p_putimage p_putpixel p_rectangle
- p_registerbgidriver p_registerbgifont p_registerfarbgidriver
- p_registerfarbgifont p_sector p_setaspectratio
- p_setcolor p_setfillpattern p_setfillstyle
- p_setgraphmode p_setlinestyle p_settextjustify
- p_settextstyle p_setusercharsize p_setviewport
- p_setwritemode p_textheight p_textwidth
-
- These commands are new:
-
- p_dump p_getresolution p_print
- _p_putpixel_screen p_view
-
-
- This section describes how to call each of the PGRAPH functions.
-
- Programmers familiar with Turbo C's or Turbo-Pascal's BGI interface, may
- wish to skip the following, with the exception of p_getresolution(),
- _p_putpixel_screen(), p_print(), p_view(), and p_dump().
-
- In addition to the functions which are described in detail below, there are
- several functions in PGRAPH which are "visible" to the linker, but not
- described in detail below. These routines are called from within the PGRAPH
- library, and should not be called by external programs.
-
- Functions are described below in alphabetical order:
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 12.
-
-
- ---------------------------------------------------------------------------
- p_arc
- void p_arc(int x, int y, int stangle, int endangle, int radius);
-
- Draws a circular arc in the current drawing colour, centred at (x,y) with
- the given radius. The arc travels from stangle to endangle, in a
- counterclockwise direction. The thickness of the line can be set using the
- thickness parameter of p_setlinestyle().
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_circle, p_ellipse, p_getarccoords, p_getaspectratio,
- p_graphresult, p_pieslice, p_setwritemode
-
- ---------------------------------------------------------------------------
- p_bar
- void p_bar(int left, int top, int right, int bottom);
-
- Draws a filled-in rectangle, using the current fill pattern and colour. The
- bar is not outlined.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_bar3d, p_fillpoly, p_floodfill, p_graphresult, p_setfillstyle
-
- ---------------------------------------------------------------------------
- p_bar3d
- void p_bar3d(int left, int top, int right, int bottom, int depth, int
- topflag);
-
- Draws a three-dimensional rectangular bar, using the current line style and
- colour. The front face is filled in using the current fill style and
- colour. The depth parameter gives the bar's depth, in pixels. A depth of 0
- gives an outlined two-dimensional bar. If topflag is non-zero, a three-
- dimensional top is put on the bar, otherwise only the front face and right
- side are drawn. (left, top) and (right, bottom) give the pixel coordinates
- of the upper left and lower right corners of the rectangle.
-
- See also: p_bar, p_setcolor, p_setfillstyle, p_setlinestyle
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 13.
-
-
- ---------------------------------------------------------------------------
- p_circle
- void p_circle(int x, int y, int radius);
-
- Draws a circle in the current drawing colour, centred at (x,y) with the
- given radius. The thickness of the line can be set using the thickness
- parameter of p_setlinestyle().
-
- The circle will always have the correct diameter in the X direction, but
- the number of pixels in the Y direction will be altered (using the current
- aspect ratio) to ensure that the circle is round.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_arc, p_ellipse, p_fillellipse, p_getarccoords, p_graphresult,
- p_setaspectratio, p_setwritemode
-
- ---------------------------------------------------------------------------
- p_cleardevice
- void p_cleardevice(void);
-
- Clears the print buffer to zeros, and moves the graphics cursor to (0, 0).
- This clears the viewport by directly writing zeros into the print buffer
- memory. As such, it quickly clears the buffer. However, it does not clear
- pixels drawn on the screen via _p_putpixel_screen.
-
- See also: p_clearviewport, _p_putpixel_screen
-
- ---------------------------------------------------------------------------
- p_clearviewport
- void p_clearviewport(void);
-
- Clears the print buffer to zeros, and moves the graphics cursor to (0, 0).
- This is done pixel by pixel, by calling p_putpixel.
-
- See also: p_cleardevice, p_getviewsettings, p_putpixel, p_setviewport
-
- ---------------------------------------------------------------------------
- p_closegraph
- void p_closegraph(void);
-
- Shuts down the PGRAPH system; deallocates the memory reserved for the print
- buffer, drivers, and fonts by calling _p_graphfreemem.
-
- Note that this does NOT print any graphics remaining in the buffer; you
- should call p_print first if necessary.
-
- See also: p_initgraph, _p_graphfreemem, p_print
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 14.
-
-
- ---------------------------------------------------------------------------
- p_drawpoly
- void p_drawpoly(int numpoints, int far *polypoints);
-
- Draws the outline of a polygon with numpoints points, using the current
- line style and colour.
-
- polypoints points to a sequence of x,y pairs of coordinates. In order to
- draw a closed polygon, the last coordinate must be the same as the first.
-
- See also: p_fillpoly, p_line, p_rectangle, p_setcolor, p_setfillstyle,
- p_setlinestyle
-
- ---------------------------------------------------------------------------
- p_dump
- void p_dump(void);
-
- Dumps the contents of the print buffer to stdout in hex. For use in
- debugging.
-
- See also: p_view, p_print
-
- ---------------------------------------------------------------------------
- p_ellipse
- void p_ellipse(int x, int y, int stangle, int endangle, int xradius, int
- yradius);
-
- Draws an elliptical arc in the current drawing colour, centred at (x,y)
- with the given x and y radii. The arc travels from stangle to endangle, in
- a counterclockwise direction. The thickness of the line can be set using
- the thickness parameter of p_setlinestyle().
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_arc, p_circle, p_fillellipse, p_getaspectratio, p_graphresult,
- p_sector, p_setwritemode
-
- ---------------------------------------------------------------------------
- p_fillellipse
- void p_fillellipse( int x, int y, int xradius, int yradius );
-
- Draws an ellipse in the current drawing colour, centred at (x,y) with the
- given x and y radii. The thickness of the line can be set using the
- thickness parameter of p_setlinestyle().
-
- The interior of the ellipse is filled with the current fill colour and
- pattern.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_ellipse, p_fillpoly, p_getaspectratio, p_graphresult,
- p_setcolor, p_setfillstyle, p_setlinestyle
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 15.
-
-
- ---------------------------------------------------------------------------
- p_fillpoly
- void p_fillpoly(int numpoints, int far *polypoints);
-
- Draws the outline of a polygon with numpoints points, using the current
- line style and colour. The interior of the polygon is filled with the
- current fill colour and pattern.
-
- polypoints points to a sequence of x,y pairs of coordinates. In order to
- draw a closed polygon, the last coordinate must be the same as the first.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -7.
-
- See also: p_drawpoly, p_floodfill, p_graphresult, p_setcolor,
- p_setfillstyle, p_setlinestyle
-
- ---------------------------------------------------------------------------
- p_floodfill
- void p_floodfill(int x, int y, int border);
-
- Fills an enclosed area of the bitmap. (x, y) is a "seed point" inside the
- area to be filled. The area bounded by the specified border colour will be
- filled with the current fill pattern and colour.
-
- Where possible, p_fillpoly should be used, since it runs much faster.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -7.
-
- See also: p_drawpoly, p_fillpoly, p_graphresult, p_setcolor, p_setfillstyle
-
- ---------------------------------------------------------------------------
- p_getarccoords
- void p_getarccoords(struct arccoordstype far *arccoords);
-
- Fills the structure pointed to by arccoords with information about the last
- arc (elliptical or circular) drawn. This includes information about the
- centre of the arc, and the coordinates of each end of the arc. These are
- useful if you need to connect a line to the end of an arc.
-
- See also: p_arc, p_ellipse, p_getaspectratio
-
- ---------------------------------------------------------------------------
- p_getaspectratio
- void p_getaspectratio(int far *xasp, int far *yasp);
-
- Returns the aspect ratio of the current printer graphics mode. The value of
- *yasp will usually be 10,000 or close to it; the value of *xasp depends on
- the relative width and height of pixels in the current mode. If pixels are
- taller than they are wide, *xasp will be less than *yasp. If pixels are
- shorter than they are wide, *xasp will be greater than *yasp. If pixels are
- square, *xasp and *yasp will be equal.
-
- See also: p_arc, p_circle, p_pieslice, p_setaspectratio
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 16.
-
-
- ---------------------------------------------------------------------------
- p_getcolor
- int p_getcolor(void);
-
- Returns the current drawing colour.
-
- See also: p_getmaxcolor, p_setcolor
-
- ---------------------------------------------------------------------------
- p_getdrivername
- char *p_getdrivername(void);
-
- Returns a pointer to a string containing the name of the current printer.
- If PGRAPH has not been initialised, returns NULL.
-
- See also: p_initgraph, p_getmodename
-
- ---------------------------------------------------------------------------
- p_getfillpattern
- void p_getfillpattern(char far *pattern);
-
- Copies the user-defined fill pattern (as set by p_setfillpattern) into the
- 8-byte area pointed to by pattern.
-
- See also: p_setfillpattern, p_getfillsettings
-
- ---------------------------------------------------------------------------
- p_getfillsettings
- void p_getfillsettings(struct fillsettingstype far *fillinfo);
-
- Fills in the structure pointed to by fillinfo, giving information about the
- current fill pattern and colour.
-
- See also: p_setfillstyle
-
- ---------------------------------------------------------------------------
- p_getgraphmode
- int p_getgraphmode(void);
-
- Returns the current graphics mode (set by p_initgraph or p_setgraphmode).
- The enumeration p_graphics_modes, defined in PGRAPH.H, gives names for the
- predefined graphics modes.
-
- See also: p_getmoderange, p_initgraph, p_setgraphmode
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 17.
-
-
- ---------------------------------------------------------------------------
- p_getimage
- void p_getimage(int left, int top, int right, int bottom, void far
- *bitmap);
-
- Copies a bit image of the specified rectangle from the print buffer to
- memory. (left, top) and (right, bottom) give the pixel coordinates of the
- upper left and lower right corners of the rectangle. bitmap points to an
- area of memory large enough to store the image. The first two words are
- used to store the width and height of the image.
-
- The image is stored in the same format as that used by getimage and
- putimage in GRAPHICS.LIB for black and white screen images, except that
- black is represented by a '1' bit, and white by a '0'.
-
- See also: p_imagesize, p_putimage
-
- ---------------------------------------------------------------------------
- p_getlinesettings
- void p_getlinesettings(struct linesettingstype far *linetypeinfo);
-
- Fills in the structure pointed to by linetypeinfo, giving information about
- the current line style and thickness.
-
- See also: p_setlinestyle
-
- ---------------------------------------------------------------------------
- p_getmaxcolor
- int p_getmaxcolor(void);
-
- Returns the highest valid colour value (always 1).
-
- See also: p_getcolor, p_setcolor
-
- ---------------------------------------------------------------------------
- p_getmaxmode
- int p_getmaxmode(void);
-
- Returns the highest valid mode number for the current driver. The minimum
- mode is always 0.
-
- See also: p_getmodename, p_getmoderange, p_setgraphmode
-
- ---------------------------------------------------------------------------
- p_getmaxx
- int p_getmaxx(void);
-
- Returns the maximum x coordinate for the current viewport. For example, if
- a viewport is 2400x600, this returns 2399.
-
- See also: p_getmaxy, p_getx, p_setviewport
-
- ---------------------------------------------------------------------------
- p_getmaxy
- int p_getmaxy(void);
-
- Returns the maximum y coordinate for the current viewport. For example, if
- a viewport is 2400x600, this returns 599.
-
- See also: p_getmaxx, p_gety, p_setviewport
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 18.
-
-
- ---------------------------------------------------------------------------
- p_getmodename
- char *p_getmodename(int mode_number);
-
- Returns a pointer to a string containing the name of the current graphics
- mode. If PGRAPH has not been initialised, returns NULL.
-
- See also: p_initgraph, p_getdrivername
-
- ---------------------------------------------------------------------------
- p_getmoderange
- void p_getmoderange(int graphdriver, int far *lomode, int far *himode);
-
- Returns the range of valid mode numbers for the specified driver. The
- minimum mode is always 0. If graphdriver is invalid, both *lomode and
- *himode are set to -1. If graphdriver is -1, the current driver's mode
- range is returned.
-
- See also: p_getgraphmode, p_getmaxmode, p_getmodename, p_graph_result,
- p_initgraph, p_setgraphmode
-
- ---------------------------------------------------------------------------
- p_getpixel
- unsigned p_getpixel(int x, int y);
-
- Returns the colour of the pixel located at (x, y).
-
- All routines which read the print buffer, except for p_print and p_dump,
- call p_getpixel.
-
- See also: p_getimage, p_putpixel
-
- ---------------------------------------------------------------------------
- p_getresolution
- void p_getresolution(int far *xres, int far *yres);
-
- Returns the resolution in dots per inch of the current printer graphics
- mode.
-
- See also: p_getaspectratio, p_initgraph
-
- ---------------------------------------------------------------------------
- p_gettextsettings
- void p_gettextsettings(struct textsettingstype far *texttypeinfo);
-
- Fills in the structure pointed to by texttypeinfo, giving information about
- the current font, direction, size, and justification of text.
-
- See also: p_outtext, p_outtextxy, p_settextjustify, p_settextstyle,
- p_setusercharsize
-
- ---------------------------------------------------------------------------
- p_getx
- int p_getx(void);
-
- Returns the graphics cursor x coordinate within the current viewport.
-
- See also: p_getmaxx, p_gety, p_moveto, p_setviewport
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 19.
-
-
- ---------------------------------------------------------------------------
- p_gety
- int p_gety(void);
-
- Returns the graphics cursor y coordinate within the current viewport.
-
- See also: p_getmaxy, p_getx, p_moveto, p_setviewport
-
- ---------------------------------------------------------------------------
- p_graphdefaults
- void p_graphdefaults(void);
-
- Resets all graphics settings to their defaults:
- Sets the viewport to 8 inches by 2 inches
- Moves the graphics cursor to (0, 0)
- Sets the drawing colour to 1 (black)
- Sets the current fill style and pattern
- Sets the text font and justification
-
- Note that changing the viewport will free the memory allocated for the
- print buffer via _p_graphfreemem, and allocate memory for the new buffer
- via _p_graphgetmem. If the memory is not available, a call to p_graphresult
- will return a value of -5.
-
- See also: p_graphresult, p_initgraph, p_setgraphmode, p_setviewport
-
- ---------------------------------------------------------------------------
- _p_graphfreemem
- void _p_graphfreemem(void far *ptr, unsigned long size);
-
- This function is called by various PGRAPH functions whenever they need to
- release memory previously allocated through _p_graphgetmem. You can define
- your own version of _p_graphfreemem to control memory management. This
- might be useful if you have routines to allocate memory to programs from
- within Extended or Expanded memory.
-
- Turbo C: The version defined in PGRAPH simply calls farfree.
- Microsoft C: The version defined in PGRAPH simply calls hfree. Programmers
- using other compilers should define _p_graphfreemem to call the equivalent
- memory allocation routine provided by their compiler vendor.
-
- Note that this differs from _graphfreemem in GRAPHICS.LIB, in that it
- allows use of blocks larger than 64K.
-
- See also: _p_graphgetmem
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 20.
-
-
- ---------------------------------------------------------------------------
- _p_graphgetmem
- void far * _p_graphgetmem(unsigned long size);
-
- This function is called by various PGRAPH functions whenever they need to
- dynamically allocate memory for various buffers. You can define your own
- version of _p_graphgetmem to control memory management. This might be
- useful if you have routines to allocate memory to programs from within
- Extended or Expanded memory.
-
- Turbo C: The version defined in PGRAPH simply calls farmalloc.
- Microsoft C: The version defined in PGRAPH simply calls halloc.
- Programmers using other compilers should define _p_graphgetmem to call the
- equivalent memory allocation routine provided by their compiler vendor.
-
- Note that this differs from _graphgetmem in GRAPHICS.LIB, in that it allows
- use of blocks larger than 64K.
-
- See also: _p_graphfreemem
-
- ---------------------------------------------------------------------------
- p_graphresult
- int p_graphresult(void);
-
- This returns an error code for the last unsuccessful graphics operation,
- and resets the error level to grOk. Therefore the result returned should be
- stored by the calling program before testing it.
-
- These codes are the same as used in GRAPHICS.LIB, therefore you can call
- grapherrormsg from there to print the corresponding error message.
-
- The following table list error codes returned by p_graphresult.
-
- Error Constant Error Message
-
- 0 grOk No error
- -1 grNoInitGraph Graphics not installed (use
- p_initgraph)
- -2 grNotDetected Graphics hardware not detected (not
- used)
- -3 grFileNotFound Device driver file not found
- -4 grInvalidDriver Invalid device driver file
- -5 grNoLoadMem Not enough memory to load driver or
- print buffer
- -6 grNoScanMem Out of memory when scanning ellipse
- -7 grNoFloodMem Out of memory in flood fill
- -8 grFontNotFound Font file not found
- -9 grNoFontMem Not enough memory to load font
- -10 grInvalidMode Invalid graphics mode for selected
- driver
- -11 grError Graphics error
- -12 grIOerror Graphics I/O error
- -13 grInvalidFont Invalid font file
- -14 grInvalidFontNum Invalid font number
- -15 grInvalidDeviceNum Invalid device number
- -16 grInvalidVersion Invalid version number
-
- See also: graph_errors in PGRAPH.H
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 21.
-
-
- ---------------------------------------------------------------------------
- p_imagesize
- unsigned p_imagesize(int left, int top, int right, int bottom);
-
- Returns the number of bytes required to store a bit image. If the size
- required is greater than 65534 (0xFFFE), p_imagesize returns 65535
- (0xFFFF).
-
- See also: p_getimage, p_putimage
-
- ---------------------------------------------------------------------------
- p_initgraph
- void p_initgraph(int far *graphdriver, int far *graphmode, char far
- *pathtodriver);
-
- This initialises the PGRAPH system by loading a graphics driver from disk
- (or using a registered driver), and putting the system into the selected
- graphics mode. Unlike initgraph in GRAPHICS.LIB, p_initgraph cannot auto-
- detect what type of printer is attached.
-
- p_initgraph first checks to see whether the selected driver has already
- been loaded, or has been registered via p_registerbgidriver or
- p_registerfarbgidriver. If not, it loads the driver (.PGI) file from disk,
- including allocating memory for it via _p_graphgetmem.
-
- p_initgraph always sets the internal error code; on success it sets it to
- 0. If an error occurred, *graphdriver is set to the same value as the
- internal error code.
-
- pathtodriver specifies the directory path where the driver file is located.
- If the file is not found in that directory, or pathtodriver is NULL,
- p_initgraph looks for the file in the current directory. This is also used
- by p_settextstyle to search for font (.CHR) files.
-
- *graphdriver is an integer between 1 and 5 which specifies the printer
- driver to be used. You give it a value using a constant of the
- p_graphics_drivers enumeration type, defined in PGRAPH.H, and listed below:
-
- Value Constant
- 1 STAR
- 2 LASERJET
- 3 LX400
- 4 USER1
- 5 USER2
-
- The constants USER1 and USER2 allow for up to 2 user-created drivers to be
- installed and used. When one of these is used, PGRAPH first checks whether
- it has been registered; if not, it loads USER1.PGI or USER2.PGI from disk.
-
- *graphmode specifies the initial graphics mode. If it is not in the correct
- range for the selected driver, the initialisation is aborted, and
- p_graphresult will return -10. It should be selected from the following
- table:
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 22.
-
-
-
- Driver Mode Value Resolution (dpi)
- STAR STAR_60_72 0 60 x 72
- STAR_120_216 1 120 x 216
- STAR_120_108 2 120 x 108
- STAR_120_72 3 120 x 72
- STAR_240_216 4 240 x 216
- STAR_80_72 5 80 x 72
- STAR_72_72 6 72 x 72
- STAR_90_72 7 90 x 72
-
- LASERJET LJ_75_75 0 75 x 75
- LJ_100_100 1 100 x 100
- LJ_150_150 2 150 x 150
- LJ_300_300 3 300 x 300
-
- LX400 LX400_60_72 0 60 x 72
- LX400_120_216 1 120 x 216
- LX400_120_108 2 120 x 108
- LX400_120_72 3 120 x 72
- LX400_240_216 4 240 x 216
- LX400_40_72 5 40 x 72
- LX400_80_72 6 80 x 72
- LX400_90_72 7 90 x 72
-
- USER1
- USER2
-
- See also: p_closegraph, p_getdrivername, p_setgraphmode, p_graphdefaults,
- _p_graphgetmem, p_graphresult, p_registerbgidriver, p_setgraphmode
-
- ---------------------------------------------------------------------------
- p_line
- void p_line(int x1, int y1, int x2, int y2);
-
- Draws a line from (x1, y1) to (x2, y2), using the current line style and
- colour. This does not change the position of the graphics cursor.
-
- See also: p_linerel, p_lineto, p_setcolor, p_setlinestyle, p_setwritemode
-
- ---------------------------------------------------------------------------
- p_linerel
- void p_linerel(int dx, int dy);
-
- Draws a line from the graphics cursor (CP) to (CP.x + dx, CP.y + dy), using
- the current line style and colour. The graphics cursor is then moved to the
- new point.
-
- See also: p_line, p_lineto, p_setcolor, p_setlinestyle, p_setwritemode
-
- ---------------------------------------------------------------------------
- p_lineto
- void p_lineto(int x, int y);
-
- Draws a line from the graphics cursor to (x, y), using the current line
- style and colour. The graphics cursor is then moved to (x, y).
-
- See also: p_line, p_linerel, p_setcolor, p_setlinestyle, p_setwritemode
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 23.
-
-
- ---------------------------------------------------------------------------
- p_moverel
- void p_moverel(int dx, int dy);
-
- Moves the graphics cursor (CP) to (CP.x + dx, CP.y + dy).
-
- See also: p_linerel, p_moveto
-
- ---------------------------------------------------------------------------
- p_moveto
- void p_moveto(int x, int y);
-
- Moves the graphics cursor to (x, y).
-
- See also: p_lineto, p_moverel, p_outtext
-
- ---------------------------------------------------------------------------
- p_outtext
- void p_outtext(char far *textstring);
-
- Displays a string at the graphics cursor in the viewport, using the current
- text settings and colour. If the horizontal justification is LEFT_TEXT and
- the direction is HORIZ_DIR, the graphics cursor's x coordinate is advanced
- by p_textwidth(textstring). Otherwise it remains unchanged. p_textwidth and
- p_textheight should be used to maintain code compatibility across several
- fonts.
-
- See also: p_outtextxy, p_settextjustify, p_settextstyle, p_textheight,
- p_textwidth
-
- ---------------------------------------------------------------------------
- p_outtextxy
- void p_outtextxy(int x, int y, char far *textstring);
-
- Displays a string at (x, y) in the viewport, using the current text
- settings and colour. The graphics cursor remains unchanged. p_textwidth and
- p_textheight should be used to maintain code compatibility across several
- fonts.
-
- See also: p_outtext, p_settextjustify, p_settextstyle, p_textheight,
- p_textwidth
-
- ---------------------------------------------------------------------------
- p_pieslice
- void p_pieslice(int x, int y, int stangle, int endangle, int radius);
-
- Draws a circular arc in the current drawing colour, centred at (x,y) with
- the given radius. The arc travels from stangle to endangle, in a
- counterclockwise direction. Lines are drawn from each end of the arc to (x,
- y). The thickness of the lines and arc can be set using the thickness
- parameter of p_setlinestyle(). The interior of the pie slice is filled
- using the current fill pattern and colour.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_arc, p_fillellipse, p_getarccoords, p_getaspectratio,
- p_graphresult, p_sector, p_setfillstyle
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 24.
-
-
- ---------------------------------------------------------------------------
- p_print
- void p_print(int out_dev);
-
- This routine actually prints the contents of the print buffer. To do this,
- it switches the printer into graphics mode, then sends each line of pixels
- to the printer. If the driver is set for a dot matrix printer, up to eight
- lines of pixels may be printed at once. Finally, the printer is returned to
- normal text mode.
-
- Only the x part of the viewport location selected using p_setviewport is
- used. Each print will begin printing at the current print position of the
- printer. This means that it is possible to print an entire page by drawing
- horizontal slices of it, and printing each one separately.
-
- The parameter out_dev is the file handle for the output device. To output
- directly to a printer, use p_print(fileno(stdprn)); Alternatively, the
- output can be sent to any file. The file should be opened in binary mode.
-
- See also: p_dump, p_setviewport, p_view
-
- ---------------------------------------------------------------------------
- p_putimage
- void p_putimage(int left, int top, void far *bitmap, int op);
-
- Copies a bit image of the specified rectangle from memory to the print
- buffer. (left, top) gives the viewport coordinates of the upper left corner
- of the rectangle. bitmap points to the area of memory used to store the
- image. The first two words contain the width and height of the image.
-
- The image is stored in the same format as that used by getimage and
- putimage in GRAPHICS.LIB for black and white screen images, except that
- black is represented by a '1' bit, and white by a '0'.
-
- The op parameter specifies how each pixel from the memory area is to be
- combined with pixels in the print buffer. You give it a value using a
- constant of the putimage_types enumeration type, defined in PGRAPH.H, and
- listed below:
-
- Value Constant Description
- 0 COPY_PUT Copy
- 1 XOR_PUT exclusive or
- 2 OR_PUT inclusive or
- 3 AND_PUT and
- 4 NOT_PUT copy inverse of source
-
- Often NOT_PUT is the most appropriate, since in PGRAPH 0 represents white
- and 1 represents black, whereas in GRAPHICS (on the screen) 0 represents
- black and 1 represents white.
-
- See also: p_getimage, p_imagesize
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 25.
-
-
- ---------------------------------------------------------------------------
- p_putpixel
- void p_putpixel(int x, int y, int colour);
-
- Plots the pixel located at (x, y) in the colour specified. Depending on the
- writing mode set via p_setwritemode, this may copy the pixel to the buffer,
- or else exclusive-or the pixel with the buffer.
-
- This also calls _p_putpixel_screen with the same parameters as were passed
- to it.
-
- All output to the print buffer, except p_cleardevice, goes via p_putpixel.
-
- See also: p_clear_device, p_getpixel, p_putimage, p_setwritemode
-
- ---------------------------------------------------------------------------
- _p_putpixel_screen
- void _p_putpixel_screen(int x, int y, int colour);
-
- This function is called by p_putpixel every time it is called.
- Turbo C users can define their own version of _p_putpixel_screen as follows
- to simultaneously output printed images to a viewport on the screen. This
- might be useful when debugging a program.
-
- void _p_putpixel_screen(int x, int y, int colour)
- {
- putpixel(x, y, colour);
- }
-
- The version defined in the library does nothing; it simply returns.
-
- People using a compiler/linker other than Turbo C could also use this as a
- mechanism to get Turbo C programs to run with their own compiler, provided
- that they have a routine which can plot a pixel on the screen. Note that
- the routines in PGRAPH are generally much slower than the equivalent
- routines in GRAPHICS.LIB, and therefore reduce the performance of programs
- run this way.
-
- See also: p_putpixel
-
- ---------------------------------------------------------------------------
- p_rectangle
- void p_rectangle(int left, int top, int right, int bottom);
-
- Draws a rectangle in the current line style, thickness, and colour. (left,
- top) and (right, bottom) identify the upper left and lower right corners of
- the rectangle.
-
- See also: p_par, p_line, p_setcolor, p_setlinestyle
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 26.
-
-
- ---------------------------------------------------------------------------
- p_registerbgidriver
- int p_registerbgidriver(void (*driver)(void));
-
- Identifies a user-loaded or linked-in graphics driver to PGRAPH. This
- routine checks that the data at the given address is a valid driver; if not
- it returns a negative number indicating the error. Otherwise it returns a
- number which you MUST use when you call p_initgraph if you wish to use this
- driver. Once its address has been passed to p_registerbgidriver,
- p_initgraph will use the registered driver (rather than loading it from
- disk) if that driver is called for.
-
- Note that .PGI files will need to be converted into .OBJ format. The BINOBJ
- program distributed by Borland as part of Turbo-Pascal is suitable for
- this, although it only generates upper-case names, and the user needs to
- add a leading underscore to the public name.
-
- See also: p_graphresult, p_initgraph, p_registerbgifont,
- p_registerfarbgidriver
-
- ---------------------------------------------------------------------------
- p_registerbgifont
- int p_registerbgifont(void (*font)(void));
-
- Identifies a user-loaded or linked-in font to PGRAPH. This routine checks
- that the data at the given address is a valid font; if not it returns a
- negative number indicating the error. Otherwise it returns a number which
- you MUST use when you call p_settextstyle if you wish to use this driver.
- Once its address has been passed to p_registerbgifont, p_settextstyle will
- use the registered font (rather than loading it from disk) if that font is
- called for.
-
- Note that fonts registered for GRAPHICS.LIB via registerbgifont may also be
- registered for PGRAPH.
-
- See also: p_graphresult, p_initgraph, p_registerbgidriver,
- p_registerfarbgifont
-
- ---------------------------------------------------------------------------
- p_registerfarbgidriver
- int p_registerfarbgidriver(void far *driver);
-
- This routine differs from p_registerbgidriver in that it allows a far
- pointer as the address of driver, thus allowing drivers to be loaded on the
- far heap.
-
- See also: p_graphresult, p_initgraph, p_registerbgidriver,
- p_registerfarbgifont
-
- ---------------------------------------------------------------------------
- p_registerfarbgifont
- int p_registerfarbgifont(void far *font);
-
- This routine differs from p_registerbgifont in that it allows a far pointer
- as the address of font, thus allowing font to be loaded on the far heap.
-
- See also: p_graphresult, p_initgraph, p_registerbgifont,
- p_registerfarbgidriver
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 27.
-
-
- ---------------------------------------------------------------------------
- p_sector
- void p_sector( int X, int Y, int StAngle, int EndAngle, int XRadius, int
- YRadius);
-
- Draws an elliptical arc in the current drawing colour, centred at (x,y)
- with the given radii. The arc travels from stangle to endangle, in a
- counterclockwise direction. Lines are drawn from each end of the arc to (x,
- y). The thickness of the lines and arc can be set using the thickness
- parameter of p_setlinestyle. The interior of the sector is filled using the
- current fill pattern and colour.
-
- This routine allocates memory via _p_graphgetmem, and frees it again
- afterwards via _p_graphfreemem. If the memory is not available, a call to
- p_graphresult will return a value of -6.
-
- See also: p_ellipse, p_fillellipse, p_getarccoords, p_getaspectratio,
- p_graphresult, p_pieslice, p_setfillstyle
-
- ---------------------------------------------------------------------------
- p_setaspectratio
- void p_setaspectratio(int xasp, int yasp);
-
- This is used to change the aspect ratio of the current printer graphics
- mode. The aspect ratio is used by PGRAPH to ensure that circles, circular
- arcs, and pie slices are drawn correctly.
-
- See also: p_arc, p_circle, p_getaspectratio, p_pieslice
-
- ---------------------------------------------------------------------------
- p_setcolor
- void p_setcolor(int color);
-
- Sets the current drawing colour to color, which can range from 0 (white) to
- p_getmaxcolor, which is set to 1 (black).
-
- The current drawing colour is used whenever pixels are set.
-
- ---------------------------------------------------------------------------
- p_setfillpattern
- void p_setfillpattern(char far *upattern, int colour);
-
- Copies the user-defined fill pattern in the 8-byte area pointed to by
- pattern into PGRAPH. This 8 by 8 pattern is tiled across any area being
- filled by p_floodfill, p_fillellipse, p_pieslice, p_sector, or p_fillpoly.
- Whenever a bit in the pattern is set to 1, the corresponding pixel is
- plotted.
-
- See also: p_bar, p_bar3d, p_fillellipse, p_fillpoly, p_getfillpattern,
- p_getfillsettings, p_pieslice, p_sector
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 28.
-
-
- ---------------------------------------------------------------------------
- p_setfillstyle
- void p_setfillstyle(int pattern, int colour);
-
- Sets the current fill pattern and colour. To set a user-defined fill
- pattern, it is better to call p_setfillpattern.
-
- Name Value Description
- EMPTY_FILL 0 Fill with background colour (0)
- SOLID_FILL 1 solid fill
- LINE_FILL 2 fill with ---
- LTSLASH_FILL 3 fill with ///
- SLASH_FILL 4 fill with ///, thick lines
- BKSLASH_FILL 5 fill with \\\, thick lines
- LTBKSLASH_FILL 6 fill with \\\
- HATCH_FILL 7 light hatch fill
- XHATCH_FILL 8 heavy cross-hatch fill
- INTERLEAVE_FILL 9 interleaving line fill
- WIDE_DOT_FILL 10 widely spaced dot fill
- CLOSE_DOT_FILL 11 closely spaced dot fill
- USER_FILL 12 user-defined fill pattern
-
- All but EMPTY_FILL fill with the current colour; EMPTY_FILL uses the
- current background colour (0).
-
- If invalid input is passed to p_setfillstyle, p_graphresult will return -
- 11, and the current fill settings will remain unchanged.
-
- See also: p_bar, p_bar3d, p_fillellipse, p_fillpoly, p_setfillpattern,
- p_getfillsettings, p_pieslice, p_sector
-
- ---------------------------------------------------------------------------
- p_setgraphmode
- void p_setgraphmode(int mode);
-
- Selects a new graphics mode. mode must be a valid mode for the current
- device driver. Unlike setgraphmode in GRAPHICS.LIB, p_setgraphmode does NOT
- clear the printer buffer, nor reset the graphics settings to their
- defaults.
-
- See also: p_getgraphmode, p_getmoderange, p_graphresult, p_initgraph
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 29.
-
-
- ---------------------------------------------------------------------------
- p_setlinestyle
- void p_setlinestyle(int linestyle, unsigned upattern, int thickness);
-
- Sets the current line width and style.
-
- linestyle specifies which style to use for subsequent lines. If it is
- USERBIT_LINE, then upattern is used, otherwise it is ignored.
-
- Name Value Description
- SOLID_LINE 0 solid line
- DOTTED_LINE 1 dotted line
- CENTER_LINE 2 centered line
- DASHED_LINE 3 dashed line
- USERBIT_LINE 4 user-defined line style
-
- upattern is a 16-bit pattern ; whenever a bit in the pattern is 1, the
- corresponding pixel in the line is drawn in the current colour.
-
- thickness specifies how wide lines are to be drawn.
-
- Name Value Description
- NORM_WIDTH 1 1 pixel wide
- THICK_WIDTH 3 3 pixels wide
-
- If THICK_WIDTH is used, nine pixels (a 3x3 block) are drawn instead of one
- for each point on a line. This has side-effects if p_setwritemode(XOR_PUT)
- has been used.
-
- If invalid input is passed to p_setlinestyle, p_graphresult will return -
- 11, and the current line settings will remain unchanged.
-
- See also: p_arc, p_bar3d, p_circle, p_drawpoly, p_ellipse, p_fillellipse,
- p_getlinesettings, p_graphresult, p_line, p_linerel, p_lineto, p_pieslice,
- p_rectangle
-
- ---------------------------------------------------------------------------
- p_settextjustify
- void p_settextjustify(int horiz, int vert);
-
- Sets text justification for p_outtext and p_outtextxy. Text will be
- justified round the designated position, as specified. The default settings
- are LEFT_TEXT and TOP_TEXT.
-
- Name Value Description
- LEFT_TEXT 0 horizontal
- CENTER_TEXT 1 horizontal and vertical
- RIGHT_TEXT 2 horizontal
- TOP_TEXT 0 vertical
- BOTTOM_TEXT 2 vertical
-
- LEFT_TEXT means that text will be left-justified relative to the designated
- position i.e. it will appear to the right of the designated position, etc.
-
- If invalid input is passed to p_settextjustify, p_graphresult will return -
- 11, and the current text settings will remain unchanged.
-
- See also: p_gettextsettings, p_graphresult, p_outtext, p_outtextxy,
- p_settextstyle
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 30.
-
-
- ---------------------------------------------------------------------------
- p_settextstyle
- void p_settextstyle(int font, int direction, int charsize);
-
- Sets the font, direction, and size of characters to be output by p_outtext
- and p_outtextxy.
-
- Fonts available include one bit-mapped font, and several 'stroked' fonts.
-
- Name Value Filename Description
- DEFAULT_FONT 0 8x8 bit-mapped font
- TRIPLEX_FONT 1 TRIP Triplex
- SMALL_FONT 2 LITT Small
- SANS_SERIF_FONT 3 SANS Sans serif
- GOTHIC_FONT 4 GOTH Gothic
- SCRIPT_FONT 5 SCRI Script
- SIMPLEX_FONT 6 SIMP Simplex
- TRI_SCR_FONT 7 TSCR Triplex script
- COMPLEX_FONT 8 COMP Complex
- EURO_FONT 9 EURO Eurostyle
- BOLD_FONT 10 BOLD Boldface
-
- The default bit-mapped font is built into the BIOS of your machine. As
- such, it may vary slightly from one machine to another. It is also probably
- slightly different from that included in GRAPHICS.LIB. You should run the
- GRAFTABL utility provided with DOS before printing any bit-mapped
- characters from the extended ASCII set (i.e. characters whose ASCII value
- is greater than 0x7F).
-
- Stroked fonts are stored in *.CHR disk files. The first four are
- distributed as part of the Turbo C package, the others are provided by
- Borland and available from various sources. Normally the *.CHR file needs
- to be loaded into memory before it can be used. To avoid this, you can link
- font files into your program. Consult your Turbo C manual on how to do
- this.
-
- direction: font directions supported are horizontal (left to right) and
- vertical (rotated 90 degrees counterclockwise, bottom to top). The default
- direction is HORIZ_DIR.
-
- Name Value Description
- HORIZ_DIR 0 left to right
- VERT_DIR 1 bottom to top
-
- The size of text can be magnified using the charsize factor.
-
- ValueBit-mapped Stroked
- 0 Invalid p_usercharsize
- 1 8x8 40%
- 2 16x16 66%
- 3 24x24 75%
- 4 32x32 100%
- 5 40x40 133%
- 6 48x48 166%
- 7 56x56 200%
- 8 64x64 250%
- 9 72x72 300%
- 10 80x80 400%
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 31.
-
-
-
- p_textheight and p_textwidth should always be used to determine the actual
- dimensions of text.
-
- See also: p_gettextsettings, p_graphresult, p_settextjustify,
- p_setusercharsize, p_textheight, p_textwidth
-
- ---------------------------------------------------------------------------
- p_setusercharsize
- void p_setusercharsize(int multx, int divx, int multy, int divy);
-
- Allows the user to independently control the x and y scaling of text output
- using stroked fonts. The scaling factors are given as a combination of
- multiplier and divider. For example, to set the width to twice normal, and
- the height to 1.5 times normal, use
-
- p_setusercharsize(2, 1, 3, 2);
-
- See also: p_gettextsettings, p_graphresult, p_settextstyle
-
- ---------------------------------------------------------------------------
- p_setviewport
- void p_setviewport(int left, int top, int right, int bottom, int clip);
-
- Establishes the size and location of the viewport onto the printed page.
- The viewport's corners are given in absolute pixel coordinates.
-
- The width of the viewport is rounded up to a multiple of eight pixels.
-
- The left coordinate is used to set the left edge of the viewport on the
- printed page. The top and bottom coordinates are used only to calculate the
- height of the viewport. They do NOT set the vertical position of the
- viewport on the page. Graphics are always printed at the current cursor
- position, so that a sequence of p_print() commands will print each viewport
- in turn down the page.
-
- This routine releases the current viewport by calling _p_graphfreemem, then
- allocates memory for the new viewport via _p_graphgetmem. If the memory is
- not available, a call to p_graphresult will return a value of -6.
-
- Because p_setviewport allocates only enough memory for the selected
- viewport, it is not possible to plot outside the current viewport.
- Therefore, the parameter clip is not used; it was included only to maintain
- similarity with setviewport in GRAPHICS.LIB.
-
- See also: p_clearviewport, p_getviewsettings, p_graphresult, p_initgraph
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 32.
-
-
- ---------------------------------------------------------------------------
- p_setwritemode
- void p_setwritemode(int mode);
-
- Sets the writing mode for printer output.
-
- Name Value Description
- COPY_PUT 0 Over-write existing pixel
- XOR_PUT 1 xor with existing pixel
-
- Two successive XOR puts to the same location will change the pixel at that
- location, then restore it again.
-
- Note that this is different from setwritemode in GRAPHICS.LIB, which works
- only with line-drawing functions.
-
- See also: p_putimage
-
- ---------------------------------------------------------------------------
- p_textheight
- int p_textheight(char far *string);
-
- Uses the current font size and scaling factor to determine the height of
- string in pixels. It is desirable to use p_textheight to compute the height
- of strings so that code is portable across several fonts and sizes.
-
- See also: p_gettextsettings, p_outtext, p_outtextxy, p_settextstyle,
- p_textwidth
-
- ---------------------------------------------------------------------------
- p_textwidth
- int p_textwidth(char far *string);
-
- Uses the current font size and scaling factor to determine the width of
- string in pixels. It is desirable to use p_textwidth to compute the width
- of strings so that code is portable across several fonts and sizes.
-
- See also: p_gettextsettings, p_outtext, p_outtextxy, p_settextstyle,
- p_textheight
-
- ---------------------------------------------------------------------------
- p_view
- void p_view(void);
-
- Displays the printer buffer on the screen. This is done by calling
- _p_putpixel_screen, which therefore must be defined by the user. This is
- designed as a debugging tool. It is the programmer's responsibility to put
- the system into graphics mode and set the appropriate viewport on the
- screen beforehand, and close down the graphics system afterwards.
-
- See also: p_dump, _p_putpixel_screen
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 33.
-
-
- MAKING A .PGI FILE
-
- MAKE_PGI.EXE is a program to allow the user to create new .PGI files,
- either for a printer for which a .PGI file has not yet been created, or
- else to take advantage of features on an existing printer which are not
- supported by the existing .PGI file.
-
- Before starting to create a PGI driver, browse through your printer manual,
- looking for information about printing graphics.
-
- A .PGI file consists of two parts -- a description of the printer, and a
- description of how to print graphics in each of its modes. MAKE_PGI leads
- the user through each of these parts by asking a series of questions.
-
- Printer Description
-
- The first question asked is
-
- What is your name ?
-
- Type in your name, or any other string you want, up to a maximum of 127
- characters. This string is used to create the "copyright" message at the
- beginning of the .PGI file. To see what the message looks like, use
-
- TYPE LASERJET.PGI
-
- to see what is contained in the descriptive header of the LaserJet .PGI
- file.
-
- Next, the program asks
-
- What is the printer's name ?
-
- Type in the name and model number of the printer, up to a total of 20
- characters. This string will be included in the descriptive header of the
- file, and a pointer to this will also be returned by the p_getdrivername
- function.
-
- Next, the program asks
-
- What printer ID number ?
-
- You may enter a number in the range 1 to 5. This will be the number used to
- select the driver when p_initgraph is called. Note that each driver
- registered must have a unique ID number. For example, if you create a
- driver called STAR2 with an ID number of 1, you cannot register both STAR
- and STAR2. Note also that PGRAPH searches only for those files it knows
- about when an unregistered driver is used, so that if you create STAR2, but
- do not register it via either p_registerbgidriver or
- p_registerfarbgidriver, then a call to p_initgraph will look for STAR.PGI
- on the disk.
-
- Next, the program asks
-
- Are numbers sent to your printer in ASCII (Y/N) ?
-
- Most dot-matrix printers require the number of graphics bytes to be printed
- to be sent as a 2-byte (16-bit) binary number. The HP LaserJet requires
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 34.
-
-
- that the number of bytes be sent as the ASCII representation of the number.
- For example, to print 375 bytes, the LaserJet requires the characters '3',
- '7', and '5' be sent to it, whereas the Star requires the bytes 77 01 (w)
- be sent to it.
-
- Press Y or N, depending on what your printer requires.
-
- The last piece of information required is how to return from graphics mode
- to text mode on the printer. The program will ask
-
- What string do you use to end graphics on your printer ?
-
- You should type in a series of up to 20 characters, as described in your
- printer manual, to return from graphics mode to text mode. At the end of
- the string, press the F10 function key. Note that if you make a mistake,
- you CANNOT use the backspace key to go back and fix the error -- you will
- have to start the MAKE_PGI program over again.
-
- Examples:
-
- STAR NX-10 9-pin dot-matrix printer
-
- What is your name ? F van der Hulst
- What is the printer's name ? Star NX-10
- What printer ID number ? 1
- Are numbers sent to your printer in ASCII (Y/N) ? N
- What string do you use to end graphics on your printer ?
- ^[A^I^[2 ESC A Ctrl-I ESC 2 F10
-
- This last command sets line spacing back to 9/72 inch, since the various
- graphics modes alter the line spacing.
-
- HP LaserJet laser printer
-
- What is your name ? F van der Hulst
- What is the printer's name ? LaserJet
- What printer ID number ? 2
- Are numbers sent to your printer in ASCII (Y/N) ? Y
- What string do you use to end graphics on your printer ?
- ^[*r0B^M ESC * r 0 B Ctrl-M F10
-
- This restores the printer to text mode, and issues a Carriage Return to
- start text at the left-hand side of the page.
-
-
- Graphics Modes Descriptions
-
- Once the overall printer description has been done, you need to describe
- how graphics is printed in each graphics modes in turn.
-
- For each mode, answer the following questions:
-
- X resolution ?
-
- The number of dots per inch in X resolution.
-
- Y resolution ?
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 35.
-
-
-
- The number of dots per inch in Y resolution.
-
- X bits per pass ?
-
- This is a number, either 1 or 8, which shows how many horizontal pixels are
- sent in one byte. On a LaserJet, this is 8; on dot-matrix printers, it is
- 1.
-
- Y bits per pass ?
-
- This is a number, either 1 or 8, which shows how many rows of pixels are
- sent in one byte. On a LaserJet, this is 1; on dot-matrix printers, it is 1
- or 8: 8 bits forces a vertical resolution the same as the vertical pin
- spacing, whereas 1 pixel-row at a time allows a different vertical
- resolution to be used.
-
- What is the mode's name ?
-
- Type in the name of the mode (usually the graphics resolution), up to a
- total of 20 characters. A pointer to this string will be returned by the
- p_getmodename function.
-
- What string do you use to start this graphics mode on your printer
-
- Type in a series of up to 20 characters, as described in your printer
- manual, to start the graphics mode. This string will be sent once, at the
- beginning of p_print. At the end of the string, press the F10 function key.
- Note that if you make a mistake, you CANNOT use the backspace key to go
- back and fix the error -- you will have to re-enter the mode again.
-
-
- A line of graphics consists of several parts:
- A string of characters
- The number of graphics bytes to be sent (ASCII/Binary)
- A string of characters
- Graphics bytes
- A string of characters
-
- You need to specify each of the strings of characters for each mode, by
- answering the following questions:
-
- What string precedes the number in this mode ?
- What string follows the number in this mode ?
- What string ends a line of graphics in this mode ?
-
- Note that entry of each of these strings is similar to entry of the "start
- graphics mode" string:
- Press F10 to terminate entry
- You cannot correct any errors
- Maximum of 20 characters
-
-
- That concludes entry of the information on a graphics mode. After each
- mode, the program will ask if it is correct:
-
- Is this mode OK (Y/N) ?
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 36.
-
-
-
- If you made a mistake, press N and then re-enter it. If everything was
- entered correctly, press Y.
-
- Finally, the program will ask:
-
- Add another mode (Y/N) ?
-
- If you press N, that will terminate entry of the driver data and the
- program will write the data entered to USER.PGI -- you should rename it to
- the correct filename.
-
-
- Examples:
-
- STAR NX-10 9-pin dot-matrix printer
-
- Mode 0:
-
- X resolution ? 60
- Y resolution ? 72
- X bits per pass ? 1
- Y bits per pass ? 8
- What is the mode's name ? 60 * 72
- What string do you use to start this graphics mode on your printer
- ^[3^X ESC 3 Ctrl-X F10
- What string precedes the number in this mode ?
- ^[K ESC K F10
- What string follows the number in this mode ?
- F10
- What string ends a line of graphics in this mode ?
- ^M^J Ctrl-M Ctrl-J F10
- Is this mode OK (Y/N) ? Y
- Add another mode (Y/N) ? Y
-
-
- Mode 1:
-
- X resolution ? 120
- Y resolution ? 216
- X bits per pass ? 1
- Y bits per pass ? 1
- What is the mode's name ? 120 * 216
- What string do you use to start this graphics mode on your printer
- ^[3^A ESC 3 Ctrl-A F10
- What string precedes the number in this mode ?
- ^[L ESC L F10
- What string follows the number in this mode ?
- F10
- What string ends a line of graphics in this mode ?
- ^M^J Ctrl-M Ctrl-J F10
- Is this mode OK (Y/N) ? Y
- Add another mode (Y/N) ? Y
-
- Continue this process for the remaining 6 modes.
-
- Notes:
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 37.
-
-
-
- The "start graphics string" sets the linefeed spacing to the correct
- number of 1/216 of an inch, the minimum unit of Y spacing on the Star
- printer. In mode 0, this is 24/216, which equals 8/72 (8 rows of
- pixels are printed at a time). In mode 1, this 1/216, and only one row
- of pixels is printed at a time. A CR-LF pair at the end of each line
- is used to advance the printer.
-
- No string of characters is sent after the number of bytes, and the
- data bytes.
-
-
- HP LaserJet laser printer
-
- Mode 0:
-
- X resolution ? 75
- Y resolution ? 75
- X bits per pass ? 8
- Y bits per pass ? 1
- What is the mode's name ? 75 * 75
- What string do you use to start this graphics mode on your printer
- ^[&s1C^[9^[*t75R^[*r1A ESC & s 1 C ESC 9 ESC * t 7 5 R ESC * r 1 A F10
- What string precedes the number in this mode ?
- ^[*b ESC * b F10
- What string follows the number in this mode ?
- W W F10
- What string ends a line of graphics in this mode ?
- F10
- Is this mode OK (Y/N) ? Y
- Add another mode (Y/N) ? Y
-
-
- Mode 1:
-
- X resolution ? 100
- Y resolution ? 100
- X bits per pass ? 8
- Y bits per pass ? 1
- What is the mode's name ? 100 * 100
- What string do you use to start this graphics mode on your printer
- ^[&s1C^[9^[*t100R^[*r1A ESC & s 1 C ESC 9 ESC * t 1 0 0 R ESC * r 1 A
- F10
- What string precedes the number in this mode ?
- ^[*b ESC * b F10
- What string follows the number in this mode ?
- W W F10
- What string ends a line of graphics in this mode ?
- F10
- Is this mode OK (Y/N) ? Y
- Add another mode (Y/N) ? Y
-
-
- Continue this process for the remaining 2 modes.
-
- Notes:
- The "start graphics string" sets the graphics mode.
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 38.
-
-
-
- The printer automatically advances at the end of each line, so no
- string of characters is sent at the end of each line.
-
-
- REVISION HISTORY
-
- Version Released Comments
-
- 1.00 01 Apr 91 Turbo C only, pre-release
- 1.01 15 Apr 91 Added MS C support.
- Minor change to p_registerfarbgidriver
- 1.10 19 Jun 91 Support for all memory models.
- p_print parameter is handle, not FILE*
- Serialisation removed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 39.
-
-
- Index
-
-
- DISCLAIMER.................................................................4
- Graphics Modes Descriptions...............................................34
- Index.....................................................................39
- Introduction...............................................................1
- Limitations and variations from GRAPHICS.LIB...............................9
- MAKING A .PGI FILE........................................................33
- Minimal Program Size.......................................................5
- Networks...................................................................5
- PGRAPH Features............................................................5
- PGRAPH Files...............................................................6
- PGRAPH Function Reference.................................................11
- PGRAPH License Agreement...................................................2
- Planned Improvements.......................................................5
- Printer Description.......................................................33
- Printer Support............................................................5
- p_arc.....................................................................12
- p_bar.....................................................................12
- p_bar3d...................................................................12
- p_circle..................................................................13
- p_cleardevice.............................................................13
- p_clearviewport...........................................................13
- p_closegraph..............................................................13
- p_drawpoly................................................................14
- p_dump....................................................................14
- p_ellipse.................................................................14
- p_fillellipse.............................................................14
- p_fillpoly................................................................15
- p_floodfill...............................................................15
- p_getarccoords............................................................15
- p_getaspectratio..........................................................15
- p_getcolor................................................................16
- p_getdrivername...........................................................16
- p_getfillpattern..........................................................16
- p_getfillsettings.........................................................16
- p_getgraphmode............................................................16
- p_getimage................................................................17
- p_getlinesettings.........................................................17
- p_getmaxcolor.............................................................17
- p_getmaxmode..............................................................17
- p_getmaxx.................................................................17
- p_getmaxy.................................................................17
- p_getmodename.............................................................18
- p_getmoderange............................................................18
- p_getpixel................................................................18
- p_getresolution...........................................................18
- p_gettextsettings.........................................................18
- p_getx....................................................................18
- p_gety....................................................................19
- p_graphdefaults...........................................................19
- p_graphresult.............................................................20
- p_imagesize...............................................................21
- p_initgraph...............................................................21
- p_line....................................................................22
- p_linerel.................................................................22
-
-
- Copyright - Frank van der Hulst/1991
- PGRAPH Printer Graphics Library Page 40.
-
-
- p_lineto..................................................................22
- p_moverel.................................................................23
- p_moveto..................................................................23
- p_outtext.................................................................23
- p_outtextxy...............................................................23
- p_pieslice................................................................23
- p_print...................................................................24
- p_putimage................................................................24
- p_putpixel................................................................25
- p_rectangle...............................................................25
- p_registerbgidriver.......................................................26
- p_registerbgifont.........................................................26
- p_registerfarbgidriver....................................................26
- p_registerfarbgifont......................................................26
- p_sector..................................................................27
- p_setaspectratio..........................................................27
- p_setcolor................................................................27
- p_setfillpattern..........................................................27
- p_setfillstyle............................................................28
- p_setgraphmode............................................................28
- p_setlinestyle............................................................29
- p_settextjustify..........................................................29
- p_settextstyle............................................................30
- p_setusercharsize.........................................................31
- p_setviewport.............................................................31
- p_setwritemode............................................................32
- p_textheight..............................................................32
- p_textwidth...............................................................32
- p_view....................................................................32
- Registered Version:........................................................3
- Registration Information...................................................1
- REVISION HISTORY..........................................................38
- Shareware Version:.........................................................2
- Source Code Version:.......................................................3
- Technical Support..........................................................4
- Test Driving PGRAPH........................................................7
- Using PGRAPH in your own programs..........................................8
- Video Support..............................................................5
- _p_graphfreemem...........................................................19
- _p_graphgetmem............................................................20
- _p_putpixel_screen........................................................25
-
-
-
-
-
-
-
-
-
-
-
- Copyright - Frank van der Hulst/1991
-
-