home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TEGA02.ZIP / TPEGA.DOC < prev    next >
Encoding:
Text File  |  1986-02-03  |  50.6 KB  |  1,611 lines

  1.  
  2.                                                         DATE:   02/01/86
  3.                                                         SYSTEM: KC-TPEGA
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.               Graphics for the IBM's Enhance Graphic Adapter (EGA)
  20.  
  21.  
  22.                               Version 02/03/86
  23.  
  24.  
  25.                            for Turbo Pascal 3.01A+
  26.  
  27.  
  28.                                                         DATE:   02/03/86
  29.                                                         SYSTEM: KC-TPEGA
  30.  
  31.  
  32.  
  33.                                  IMPORTANT NOTICE
  34.  
  35.  
  36.         The Enhanced Graphic Adapter (EGA) graphic routines for Microsoft
  37.         3.0 and Turbo Pascal 3.01A was written and is maintained by:
  38.  
  39.                                Kent Cedola
  40.                                2015 Meadow Lake Court
  41.                                Norfolk, Virginia  23518
  42.                                1-(804)-857-0613
  43.  
  44.         Users of this software are encouraged to copy and distribute the
  45.         graphics library and demonstrations programs which are a part of
  46.         this package for non-commericial purposes.
  47.  
  48.         No fee or other charges may be made in the distribution of these
  49.         programs without the written permission from Kent Cedola.
  50.  
  51.         Any program written with this graphic library may be sold, as
  52.         long as the source code for the graphic library in not included.
  53.         If you wish to include the graphic library with the product,
  54.         please contact me for more information and written permission.
  55.  
  56.         The date of release will be used in instead of a version.  When
  57.         requesting information, please included the date (version) of the
  58.         copy that you have and the amount of EGA memory.  Write the above
  59.         for the current release of the graphic library.
  60.  
  61.         If you are satified with the EGA support for Turbo Pascal you are
  62.         asked to send a donation of ten dollars ($10.00).  All registered
  63.         users will be informed of any major improvements and/or programs
  64.         developments.
  65.  
  66.                                 FREE COPY OF TPEGA
  67.  
  68.         If you send a diskette with a SASE, I will send you the current
  69.         copy of the library and programs for FREE! (360k or 1.2meg disk)
  70.  
  71.  
  72.                                                         DATE:   02/03/86
  73.                                                         SYSTEM: KC-TPEGA
  74.  
  75.  
  76.  
  77.                                       GENERAL
  78.  
  79.  
  80.         This graphic software was written to provide the general public
  81.         a means for writing graphic program for the EGA without any run-
  82.         time fee!  The software is also design to give the programmer
  83.         the most flexibility, so most graphic routines can be changed or
  84.         deleted (saving space) from the final product.
  85.  
  86.  
  87.         If you have some application that required some special high-speed
  88.         graphic routine, let me know and I'll see what I can do.  But most
  89.         routines that are not provided can be built around the standard
  90.         graphic primitives. Graphic primitives (any routine with a prefix
  91.         of GP) are low level graphic routine that are (mostly) supported
  92.         over various graphic adapters (in the future).
  93.  
  94.  
  95.         Those with the standard EGA (only 64k of memory) may have some
  96.         problems with some of the graphic primitives as I have a 128k+
  97.         EGA.  I highly recommend adding extra memory to your EGA if
  98.         you plan to do alot of graphic programming.
  99.  
  100.  
  101.             The future for Turbo Pascal (and Microsoft C):     Release
  102.  
  103.                1.  More graphic primitive (send requests).      MAR86
  104.                2.  Support Microsoft's mouse.                   MAR86
  105.                3.  Support for AT&T's ICB (digitizer).          APR86
  106.                4.  Support image processing routines (ICB)      APR86
  107.                5.  Support high-speed sprite routines.
  108.                6.  Support graphic segments to build objects.
  109.                7.  Support 3D graphic and CAD routines.
  110.                8.  Support for Microsoft C 3.0+
  111.                9.  Support for PC-EYE from Chorus Data Systems.
  112.               10.  Support for AT&T's VDA.
  113.  
  114.  
  115.                                                         DATE:   02/03/86
  116.                                                         SYSTEM: KC-TPEGA
  117.  
  118.  
  119.                            Questions & Answers
  120.  
  121.  
  122.         Q.  Do you maintain the current version of your graphic library
  123.             on a BBS?  If so, which one.
  124.         A.  Yes, the PC-CONNECTION (804) 481-1824, will always contain
  125.             the current version of ALL of my EGA software.  But user
  126.             validation is required (+money, 10 or 20 a year).  The BBS
  127.             contains two nodes and 60megs online.  Any disk with SASE
  128.             sent to me will be return with ALL my EGA software (FREE).
  129.  
  130.         Q.  Where is the assembler source code?
  131.         A.  I am holding assembler source code to try to maintain an
  132.             EGA graphic standard and to make it easier to change it
  133.             without effecting others with 'old' assembler code.  Very
  134.             little of the code is for the EGA, most is just standard
  135.             graphic code that could be used with any graphic adapter.
  136.             I will release all source code sometime in the future. I
  137.             don't know when.
  138.  
  139.         Q.  Do you know that some of your comments do not match the
  140.             code below it? (from Steve)
  141.         A.  Yes, the documentation manual will always contain the
  142.             correct information.  Don't worry about the headers.
  143.             I'm mostly worried about the code working.
  144.  
  145.         Q.  Will you re-code your routines for other graphic adapters
  146.             to form a public domain standard for graphic primitives?
  147.         A.  Yes, I am currently re-coding for the AT&T's Image Capture
  148.             Board (ICB) and adding image processing routines.
  149.  
  150.         Q.  How about BASIC support?
  151.         A.  Buy Turbo Pascal or Microsoft C 3.0+.
  152.             (Microsoft C will be supported at a later time [near June])
  153.             (C is better for writing large graphic programs).
  154.  
  155.  
  156.                                                         DATE:   02/03/86
  157.                                                         SYSTEM: KC-TPEGA
  158.  
  159.  
  160.                                 SPECIAL NOTICE
  161.  
  162.  
  163.         While trying to get as many graphic routines as possible in this
  164.         release I had to cut corners on the GPSHADE, GPFILL and GPFLOOD
  165.         graphic primitives.  The GPFILL should be used for simple objects
  166.         to be filled in and GPFLOOD for complex objects. Currently, GPFILL
  167.         calls GPFLOOD to do the fill, this will change in the future as I
  168.         will write a version of GPFILL that will execute two or three times
  169.         faster than GPFLOOD (GPFILL = Simple objects only).  GPSHADING has
  170.         a restriction for dimensions of 1,2,4 or 8 or both width and height.
  171.         Other dimensions can be used, but funny fills may happen (will be
  172.         fixed later).  The GPFLOOD routine is fast, and will fill in any
  173.         area no matter how complex (more complex more stack space), but I
  174.         will re-write it for higher speeds.
  175.  
  176.         Both the GPBOX and GPBALL primitives only do solid colors and not
  177.         shades.  Both use special EGA full byte fill modes and are fast.
  178.         BPBOX and GPBALL do NOT set the clipping flag. (Later)
  179.  
  180.         These primitives do work, but they can be better.  I will improve
  181.         the flexibility and speed of these routines in the future.
  182.  
  183.         The following routines miss this release (are in the documentation)
  184.         will be included in a future release.
  185.  
  186.                         GPSCROLL
  187.                         GPPOLY
  188.  
  189.  
  190.                                                         DATE:   02/03/86
  191.                                                         SYSTEM: KC-TPEGA
  192.  
  193.  
  194.                         List of Graphic Functions
  195.  
  196.  
  197.          Graphics Routines               Description
  198.         ----------------------------    ---------------------------------
  199.          GPPARMS;                        Setup graphic adapter parameters
  200.          GPINIT;                         Initialize graphic display
  201.          GPTERM;                         Terminate graphic display
  202.  
  203.          GPCOLOR(b);                     Set current color
  204.          GPMERGE(b);                     Set current merge mode
  205.          GPSTYLE(array);                 Set pattern for drawing lines
  206.          GPSHADE(array);                 Set pattern for shading areas
  207.          GPRDCLR;                        Return the current color
  208.  
  209.          GPPAL(p,v);                     Set a palette register
  210.          GPCPAL(p,v);                    Set a palette register using RGB
  211.          GPLDPAL(array);                 Load all palette registers
  212.          GPRDPAL(p);                     Read current palette setting
  213.  
  214.          GPPLOT(X,Y);                    Plot a point at X,Y (sets new CP)
  215.          GPRDDOT(X,Y)                    Read pixel at coordinates (X,Y)
  216.          GPMOVE(X,Y);                    Set current graphic position (CP)
  217.          GPLINE(X,Y);                    Draw a line from (CP) to X,Y
  218.          GPPOLY(array,N);                Draw a N number of lines
  219.          GPRECT(X,Y);                    Draw a rectangle between CP and (X,Y)
  220.          GPCIR(R);                       Draw a circle at CP with R radius
  221.  
  222.          GPWTROW(Array,N);               Write a row of pixels
  223.          GPWTCOL(Array,N);               Write a column of pixels
  224.          GPRDROW(Array,N);               Read a row of pixels
  225.          GPRDCOL(Array,N);               Read a column of pixels
  226.  
  227.          GPBOX(X,Y);                     Draws a solid box with color/shading
  228.          GPBAL(R);                       Draws a solid circle with color/shading
  229.  
  230.          GPSCROLL(Dir,I,N);              Scroll current viewport
  231.  
  232.          GPVIEWPORT(X1,Y1,X2,Y2);        Set current viewport
  233.          GPWINDOW(X1,Y1,X2,Y2);          Set current window
  234.          GPCLIP1(X,Y);                   Clip point in current window
  235.          GPCLIP2(X1,Y1,X2,Y2);           Clip line in current window
  236.          GPSCALE(X,Y);                   Scale from world to device
  237.  
  238.          GPFILL(Border);                 Simple object fill, color/shading
  239.          GPFLOOD(Border);                Complex object fill, color/shading
  240.  
  241.  
  242.                                                         DATE:   02/03/86
  243.                                                         SYSTEM: KC-TPEGA
  244.  
  245.  
  246.                         List of Global Variables
  247.  
  248.  
  249.          Global Variable                 Description
  250.         ----------------------------    ---------------------------------
  251.          GDTYPE:        Integer;         3 = CG, 4 = Mono, 5 = Color
  252.          GDOTHER:                        Internal Use Only
  253.          GDMEMORY:      Integer;         Amount of memory, 64 -> 256
  254.          GDMAXCOL:      Integer;         Maximum column (639 for EGA)
  255.          GDMAXROW:      Integer;         Maximum row (199/349 for EGA)
  256.          GDMAXPAL:      Integer;         Maximum palettes (4/16 for EGA)
  257.          GDMAXCLR:      Integer;         Maximum colors (63 for EGA)
  258.  
  259.          GDCOLOR:       Integer;         Current color for drawing
  260.          GDMERGE:                        Internal Use Only
  261.          GDSTYLE:                        Internal Use Only
  262.          GDSHADE:                        Internal Use Only
  263.          GDSHADE1:                       Internal Use Only
  264.          GDASPC1:       Integer;         Aspect for circles (3 for EGA)
  265.          GDASPC2:       Integer;         Aspect for circles (4 for EGA)
  266.          GDCUR_X:       Integer;         Current X coordinate
  267.          GDCUR_Y:       Integer;         Current Y coordinate
  268.  
  269.          GDGSEG:                         Internal Use Only
  270.          GDGSADR:                        Internal Use Only
  271.  
  272.          GDWD_X1:       Integer;         Window coordinate (low)
  273.          GDWD_X2:       Integer;         Window coordinate (high)
  274.          GDWD_X3:       Integer;         Window coordinate (delta+1)
  275.          GDWD_Y1:       Integer;         Window coordinate (low)
  276.          GDWD_Y2:       Integer;         Window coordinate (high)
  277.          GDWD_Y3:       Integer;         Window coordinate (delta+1)
  278.  
  279.          GDVW_X1:       Integer;         Viewport coordinate (low)
  280.          GDVW_X2:       Integer;         Viewport coordinate (high)
  281.          GDVW_X3:       Integer;         Viewport coordinate (delta+1)
  282.          GDVW_Y1:       Integer;         Viewport coordinate (low)
  283.          GDVW_Y2:       Integer;         Viewport coordinate (high)
  284.          GDVW_Y3:       Integer;         Viewport coordinate (delta+1)
  285.  
  286.          GDC_FLG:       Integer;         Last plot clipping status
  287.          GDS_FLG:       Integer;         Color/Shade or Color/Style flag
  288.          GDW_FLG:       Integer;         Enable/Disable World coordinates
  289.  
  290.          GDCURX1:       Integer;         World current X coordinate
  291.          GDCURY1:       Integer;         World current Y coordinate
  292.  
  293.  
  294.                                                         DATE:   02/03/86
  295.                                                         SYSTEM: KC-TPEGA
  296.  
  297.  
  298.  
  299.         NAME:
  300.  
  301.                 GPPARMS -- Setup current graphic adapter parameters
  302.  
  303.         SYNOPSIS:
  304.  
  305.                 P: procedure GPPARMS;
  306.  
  307.                 C: void GPPARMS();
  308.  
  309.         DESCRIPTION:
  310.  
  311.                 This procedure will initialize various global variables
  312.             on the status of the current graphic adapter.  If only needs
  313.             to be executed once in the life of a program.
  314.  
  315.         RETURNS:
  316.  
  317.             GDTYPE = 0, no ega, monochrome adapter (text mode) { maybe }
  318.                    = 1, no ega, old color graphic adapter (CG) { maybe }
  319.                    = 2, no ega, jr graphics (640x200x16) { maybe }
  320.                    = 3, EGA with old color graphic monitor (640x200x16)
  321.                    = 4, EGA with monochrome monitor (640x350x4)
  322.                    = 5, EGA with new Enhanced Color Display (640x350x16)
  323.                    = 6, ?
  324.  
  325.         CAUTIONS:
  326.  
  327.             This procedure MUST be performed before any other primitive.
  328.                            ----
  329.         EXAMPLE:
  330.  
  331.             P: GPPARMS;                    { Determine the type of Adapter }
  332.  
  333.                if GDTYPE <> 4 and GDTYPE <> 5 then   { 4 = mono, 5 = color }
  334.                  begin
  335.                  writeln('Must have IBM Enhanced Graphic Display!');
  336.                  halt(1);
  337.                  end;
  338.  
  339.             C: GPPARMS();
  340.  
  341.                if (GDTYPE != 5)
  342.                  {
  343.                  fprintf(stderr,'Must have EGA color display!\n');
  344.                  exit(1);
  345.                  };
  346.  
  347.  
  348.                                                         DATE:   02/03/86
  349.                                                         SYSTEM: KC-TPEGA
  350.  
  351.  
  352.  
  353.         NAME:
  354.  
  355.                 GPINIT -- Initialize the Enhanced Graphic Adapter
  356.  
  357.         SYNOPSIS:
  358.  
  359.                 P: PROCEDURE GPINIT;
  360.  
  361.                 C: GPINIT();
  362.  
  363.         DESCRIPTION:
  364.  
  365.                 This procedure will place the EGA in color or mono
  366.             graphic mode depending on hardware connected to the EGA.
  367.             This routine can be repeated to reset graphic state. If
  368.             you are using the standard color monitor with the EGA,
  369.             will setup in 640x200 (16 colors) mode, else 640x350.
  370.  
  371.         CAUTIONS:
  372.  
  373.                 The procedure 'GPPARMS' must be used to determine if
  374.             an EGA is available. The EGA must be placed in graphic mode
  375.             before executing the other graphic routines (not including
  376.             'GPPARMS').
  377.  
  378.         EXAMPLE:
  379.  
  380.             P: GPPARMS;                 { Determine the type of Adapter }
  381.  
  382.                if GDTYPE <> 4 and GDTYPE <> 5 then
  383.                  begin
  384.                  write('Must have IBM Enhanced Graphic Display!');
  385.                  halt;
  386.                  end
  387.                else
  388.                  begin
  389.                  GPInit;                 { Initialize the EGA           }
  390.                  end;
  391.  
  392.             C: GPPARMS();
  393.  
  394.                if (GDTYPE != 4)
  395.                  {
  396.                  fprintf(stderr,'Must have EGA monochrome display!\n');
  397.                  exit(1);
  398.                  }
  399.                else
  400.                  {
  401.                  GPINIT();
  402.                  };
  403.  
  404.         SEE ALSO:
  405.  
  406.             GPPARMS and GPTERM.
  407.  
  408.  
  409.                                                         DATE:   02/03/86
  410.                                                         SYSTEM: KC-TPEGA
  411.  
  412.  
  413.  
  414.         NAME:
  415.  
  416.                 GPTERM -- Terminate graphic mode and return to text
  417.  
  418.         SYNOPSIS:
  419.  
  420.                 P: procedure GPTERM;
  421.  
  422.                 C: void GPTERM;
  423.  
  424.         DESCRIPTION:
  425.  
  426.                 This procedure will return the EGA back to text mode.
  427.                 Mode 3 for color EGA and mode 7 for monochrome monitors.
  428.  
  429.         CAUTIONS:
  430.  
  431.                 Should not be performed on a non EGA computer.
  432.  
  433.         EXAMPLES:
  434.  
  435.             P: GPTERM;
  436.  
  437.             C: GPTERM();
  438.  
  439.         SEE ALSO:
  440.  
  441.             GPPARMS and GPINIT.
  442.  
  443.  
  444.                                                         DATE:   02/03/86
  445.                                                         SYSTEM: KC-TPEGA
  446.  
  447.  
  448.  
  449.         NAME:
  450.  
  451.                 GPCOLOR -- Set the current color
  452.  
  453.         SYNOPSIS:
  454.  
  455.                 P: procedure GPCOLOR(Value: Integer);
  456.  
  457.                 C: void GPCOLOR(Value)
  458.                      int Value;
  459.  
  460.         DESCRIPTION:
  461.  
  462.                 Set the color to be used by the other ploting routines
  463.             (GPPLOT, GPLINE, GPRECT, etc...).  The primitive GPRDCLR can
  464.             can be used to read the current color. The global GDMAXPAL will
  465.             contain the highest color value allowed.   Setting the color
  466.             will set the style/shading flag to zero, this will cause all
  467.             drawing and filling primitives to use the current color and
  468.             not the current style/shading.  Use the Turbo Pascal function
  469.             TEXTCOLOR for text coloring.
  470.  
  471.         EXAMPLE:
  472.  
  473.             P: GPCOLOR(Green);             { Set color to Green     }
  474.                GPMOVE(50,50);              { Draw a green rectangle }
  475.                GPRECT(100,100);
  476.  
  477.             C: color = GPRDCLR;            /* Save the current color */
  478.  
  479.                GPCOLOR(Red);               /* Define a new color     */
  480.  
  481.                GPMOVE(X1,Y1);              /* Draw a red line        */
  482.                GPLINE(X2,Y2);
  483.  
  484.                GPCOLOR(color);             /* Restore color          */
  485.  
  486.         SEE ALSO:
  487.  
  488.             GPRDCLR, GPSTYLE, GPSHADE.
  489.  
  490.  
  491.                                                         DATE:   02/03/86
  492.                                                         SYSTEM: KC-TPEGA
  493.  
  494.  
  495.  
  496.         NAME:
  497.  
  498.                 GPMERGE -- Set the placement of graphic data
  499.  
  500.         SYNOPSIS:
  501.  
  502.                 P: procedure GPMERGE(Value: Integer);
  503.  
  504.                 C: void GPMERGE(Value)
  505.                      int Value;
  506.  
  507.                                Merge modes, 0 - Store (default)
  508.                                             1 - AND
  509.                                             2 - OR
  510.                                             3 - XOR
  511.  
  512.         DESCRIPTION:
  513.  
  514.                 Specify the method which data is placed in the graphic
  515.             memory.  The various merge modes are performed with hardware
  516.             on the EGA.  Almost all graphic routines will be effected by
  517.             setting the merge value, but not all.
  518.  
  519.         CAUTIONS:
  520.  
  521.                 Setting non-zero merge mode can slow down some graphic
  522.            primitives. (e.g., GPFLOOD).
  523.  
  524.         EXAMPLE:
  525.  
  526.             P: GPMERGE(3);                    { Set merge mode to XOR }
  527.                GPCOLOR(Green);                { Set color to Green    }
  528.                GPMOVE(50,50);                 { XOR green box         }
  529.                GPBOX(100,100);
  530.                GPMERGE(0);                    { Return merge mode to default }
  531.  
  532.         SEE ALSO:
  533.  
  534.             GPFILL and GPFLOOD.
  535.  
  536.  
  537.                                                         DATE:   02/03/86
  538.                                                         SYSTEM: KC-TPEGA
  539.  
  540.  
  541.  
  542.         NAME:
  543.  
  544.                 GPSTYLE -- Set the current line style
  545.  
  546.         SYNOPSIS:
  547.  
  548.                 P: procedure GPSTYLE(var Style);
  549.  
  550.                 C: void GPSTYLE(Style)
  551.                      unsigned char Style[];
  552.  
  553.         DESCRIPTION:
  554.  
  555.                 Set the line style for the line drawing primitives.  The
  556.             parameter is an array of color bytes with the first byte con-
  557.             taining the length.  The style/shading flag will be set to
  558.             non-zero to flag the line routines to use the current line style
  559.             and not the current color setting.
  560.  
  561.         EXAMPLE:
  562.  
  563.             C: unsigned char Style[] =     /* Set line style to GGBB  */
  564.                  {4,Green,Green,Blue,Blue};
  565.  
  566.                GPSTYLE(Style);             /* Define the line style   */
  567.  
  568.                GPMOVE(X1,Y1);
  569.                GPLINE(X2,Y2);              /* Draw line using style   */
  570.  
  571.                GPCOLOR(color);             /* Set color               */
  572.  
  573.                GPLINE(X3,Y3);              /* Draw green line         */
  574.  
  575.                GPS_FLG := -1;              /* Goback to style setting */
  576.  
  577.                GPLINE(X4,Y4);              /* Draw line using style   */
  578.  
  579.         SEE ALSO:
  580.  
  581.             GPCOLOR.
  582.  
  583.  
  584.                                                         DATE:   02/03/86
  585.                                                         SYSTEM: KC-TPEGA
  586.  
  587.  
  588.  
  589.         NAME:
  590.  
  591.                 GPSHADE -- Set the current fill/flood shading
  592.  
  593.         SYNOPSIS:
  594.  
  595.                 P: procedure GPSHADE(var Style);
  596.  
  597.                 C: void GPSHADE(Style)
  598.                      unsigned char Style[];
  599.  
  600.         DESCRIPTION:
  601.  
  602.                 Set the shading matrix for fill/flooding primitives.  The
  603.             parameter is an array of color bytes with the first byte con-
  604.             taining the width and the second containing the height.  The
  605.             style/shading flag (GDS_FLG) will be set to a non-zero value.
  606.  
  607.         CAUTIONS:
  608.  
  609.             Although any dimension from 1 to 255 can be used, the current
  610.             version of GPFILL and GPFLOOD only works correctly with shade
  611.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  612.             restriction will be removed in the future.
  613.  
  614.         EXAMPLE:
  615.  
  616.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  617.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  618.  
  619.                GPSHADE(Shade);             /* Define the shading      */
  620.  
  621.                GPMOVE(X1,Y1);
  622.                GPFLOOD(color);             /* Flood area with border
  623.                                               defined by color        */
  624.  
  625.         SEE ALSO:
  626.  
  627.             GPCOLOR, GPSTYLE, GPFILL and GPFLOOD.
  628.  
  629.  
  630.                                                         DATE:   02/03/86
  631.                                                         SYSTEM: KC-TPEGA
  632.  
  633.  
  634.  
  635.         NAME:
  636.  
  637.                 GPRDCLR -- Read the current color
  638.  
  639.         SYNOPSIS:
  640.  
  641.                 P: function GPRDCLR: Integer;
  642.  
  643.                 C: int GPRDCLR();
  644.  
  645.         DESCRIPTION:
  646.  
  647.                 Return the current color setting.  Use to save the current
  648.             color setting.
  649.  
  650.         RETURN:
  651.  
  652.                 The current color setting.
  653.  
  654.         EXAMPLE:
  655.  
  656.             C: color = GPRDCLR;            /* Save the current color */
  657.  
  658.                GPCOLOR(Red);               /* Define a red line      */
  659.  
  660.                GPMOVE(X1,Y1);
  661.                GPLINE(X2,Y2);              /* Draw a red line        */
  662.  
  663.                GPCOLOR(color);             /* Restore color          */
  664.  
  665.         SEE ALSO:
  666.  
  667.             GPCOLOR.
  668.  
  669.  
  670.                                                         DATE:   02/03/86
  671.                                                         SYSTEM: KC-TPEGA
  672.  
  673.  
  674.  
  675.         NAME:
  676.  
  677.                 GPPAL -- Set a palette register
  678.  
  679.         SYNOPSIS:
  680.  
  681.                 P: procedure GPPAL(Palette, Color: Integer);
  682.  
  683.                 C: void GPPAL(Palette, Color)
  684.                      int Palette, Color;
  685.  
  686.         DESCRIPTION:
  687.  
  688.                 Set a palette to a given color value.  The maximum range
  689.             of the palette variable is contained in GDMAXPAL. The max
  690.             range of the color variable in contained in GDMAXCLR. These
  691.             two global variables are set by the routine 'GPPARMS'.   If
  692.             -1 is the palette value then the border is set to the given
  693.             color.
  694.  
  695.         CAUTIONS:
  696.  
  697.                 Setting the border color is not recommended for the EGA.
  698.  
  699.         EXAMPLE:
  700.  
  701.             P: GPPAL(5,20);                { Set palette 5 to color 20  }
  702.  
  703.         SEE ALSO:
  704.  
  705.             GPCPAL and GPRDPAL.
  706.  
  707.                                                         DATE:   02/03/86
  708.                                                         SYSTEM: KC-TPEGA
  709.  
  710.  
  711.  
  712.         NAME:
  713.  
  714.                 GPCPAL -- Set a palette register using R,G,B
  715.  
  716.         SYNOPSIS:
  717.  
  718.                 P: procedure GPCPAL(Palette, R, G, B: Integer);
  719.  
  720.                 C: void GPCPAL(Palette, R, G, B)
  721.                      int Palette, R, G, B;
  722.  
  723.         DESCRIPTION:
  724.  
  725.                 Set a palette to a given color using the RGB values.
  726.             The max value of each primary color can be determine by the
  727.             (cube root of (GDMAXCLR+1) - 1).  If -1 is the palette value
  728.             then the border is set to the given color.
  729.  
  730.         CAUTIONS:
  731.  
  732.                 Setting the border color is not recommended for the EGA.
  733.  
  734.         EXAMPLE:
  735.  
  736.             P: GPCPAL(5,2,1,0);            { Set palette 5 to RGB(2,1,0)}
  737.  
  738.         SEE ALSO:
  739.  
  740.             GPPAL and GPRDPAL.
  741.  
  742.                                                         DATE:   02/03/86
  743.                                                         SYSTEM: KC-TPEGA
  744.  
  745.  
  746.  
  747.         NAME:
  748.  
  749.                 GPLDPAL -- Set all the palette registers
  750.  
  751.         SYNOPSIS:
  752.  
  753.                 P: procedure GPLDPAL(var Palettes : Bytes);
  754.  
  755.                 P: void GPLDPAL(Palettes)
  756.                      unsigned char Palettes[];
  757.  
  758.         DESCRIPTION:
  759.  
  760.                 Load all the palette registers from a given array.  The
  761.             number of palettes can be determine by GDMAXPAL + 2.  The
  762.             border color is located in GDMAXPAL + 2.
  763.  
  764.         CAUTIONS:
  765.  
  766.                 Setting the border color is not recommended for the EGA.
  767.  
  768.         EXAMPLE:
  769.  
  770.             P: pals: array [0..16] of byte; { pals[0] > pals[15] colors }
  771.                                             { pals[16] border color     }
  772.  
  773.                for i := 0 to 15 do          { Reset to default colors   }
  774.                  begin
  775.                  if i < 8 then
  776.                    pals[i] := i
  777.                  else
  778.                    pals[i] := 48 + i;
  779.  
  780.                pals[16] := 0;               { Keep border Black         }
  781.  
  782.                GPLDPAL(pals);               { Set palettes and border   }
  783.  
  784.  
  785.                                                         DATE:   02/03/86
  786.                                                         SYSTEM: KC-TPEGA
  787.  
  788.  
  789.  
  790.         NAME:
  791.  
  792.                 GPRDPAL -- Set a palette register
  793.  
  794.         SYNOPSIS:
  795.  
  796.                 P: function GPRDPAL(Palette: Integer): Integer;
  797.  
  798.                 C: int GPRDPAL(Palette)
  799.                      int Palette;
  800.  
  801.         DESCRIPTION:
  802.  
  803.                 Read the setting of the specified palette register.  If
  804.             an EGA save area has not be defined then this function will
  805.             return -1 instead of a palette color.  Use the program
  806.             'KCSETPAL' to define a save area.
  807.  
  808.         RETURN:
  809.  
  810.                 Palette color or -1 if can be found. (run KCSETPAL).
  811.  
  812.         EXAMPLE:
  813.  
  814.             C: current_color = GPRDPAL(5)  /* Read palette 5  */
  815.  
  816.                if (current_color == -1)    /* Recover on null */
  817.                  current_color = 5;
  818.  
  819.         SEE ALSO:
  820.  
  821.             GPPAL.
  822.  
  823.  
  824.                                                         DATE:   02/03/86
  825.                                                         SYSTEM: KC-TPEGA
  826.  
  827.  
  828.  
  829.         NAME:
  830.  
  831.                 GPPLOT -- Plot a pixel at the given corrdinate
  832.  
  833.         SYNOPSIS:
  834.  
  835.                 P: procedure GPPLOT(x,y: Integer);
  836.  
  837.                 C: void GPPLOT(x,y)
  838.                      int x,y;
  839.  
  840.         DESCRIPTION:
  841.  
  842.                 Plot a point at the given coordinates using the current
  843.             color and merge values.  The upper left corner is (0,0) on
  844.             the graphic screen.  The specifed (X,Y) coordinate becomes
  845.             the new current position (CP).  Automatic clipping is
  846.             preformed.
  847.  
  848.         RETURN:
  849.  
  850.             GDC_FLG = 0 if point is in the current viewport.
  851.                       2 if point out of current viewport (not plotted)
  852.  
  853.         EXAMPLE:
  854.  
  855.             P: GPCOLOR(Green);          { Set color to Green            }
  856.                GPPLOT(5,5);             { Plot a Green pixels at (5,5)  }
  857.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  858.  
  859.         SEE ALSO:
  860.  
  861.             GPCOLOR, GPMERGE and GPMOVE.
  862.  
  863.  
  864.                                                         DATE:   02/03/86
  865.                                                         SYSTEM: KC-TPEGA
  866.  
  867.  
  868.  
  869.         NAME:
  870.  
  871.                 GPRDDOT -- Read the pixel at the given corrdinate
  872.  
  873.         SYNOPSIS:
  874.  
  875.                 P: function GPRDDOT(x,y: Integer): Integer;
  876.  
  877.                 C: int GPRDDOT(x,y)
  878.                      int x,y;
  879.  
  880.         DESCRIPTION:
  881.  
  882.                 Read the pixel at the given coordinates.
  883.  
  884.         CAUTIONS:
  885.  
  886.                 The global variable GDMEMORY is used to determine the
  887.             number of planes to read (two for 64k, and four 128k+)
  888.  
  889.         EXAMPLE:
  890.  
  891.             P: color: Integer;
  892.  
  893.                color := GPRDDOT(5,4)    { Read color at (5,4)           }
  894.  
  895.         SEE ALSO:
  896.  
  897.             GPPARMS.
  898.  
  899.  
  900.                                                         DATE:   02/03/86
  901.                                                         SYSTEM: KC-TPEGA
  902.  
  903.  
  904.  
  905.         NAME:
  906.  
  907.                 GPMOVE -- Move graphic cursor to new position
  908.  
  909.         SYNOPSIS:
  910.  
  911.                 P: procedure GPMOVE(x,y: Integer);
  912.  
  913.                 C: void GPMOVE(x,y)
  914.                      int x,y;
  915.  
  916.         DESCRIPTION:
  917.  
  918.                 Set the graphic cursor to the specified position to be
  919.             the new current position (CP).
  920.  
  921.         EXAMPLE:
  922.  
  923.             P: GPCOLOR(Green);          { Set color to Green            }
  924.                GPMOVE(5,5);             { Set CP to (5,5)               }
  925.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  926.  
  927.         SEE ALSO:
  928.  
  929.             GPPLOT and GPLINE.
  930.  
  931.  
  932.                                                         DATE:   02/03/86
  933.                                                         SYSTEM: KC-TPEGA
  934.  
  935.  
  936.  
  937.         NAME:
  938.  
  939.                 GPLINE -- Draw a line from CP to (X,Y)
  940.  
  941.         SYNOPSIS:
  942.  
  943.                 P: procedure GPLINE(x,y: Integer);
  944.  
  945.                 C: void GPLINE(x,y)
  946.                      int x,y;
  947.  
  948.         DESCRIPTION:
  949.  
  950.                 Draw a line from the current position (CP) to the given
  951.             coordinate using the current merge, color or line style values.
  952.             Automatic line clipping is performed in the current viewport.
  953.  
  954.         RETURN:
  955.  
  956.             GDC_FLG = 0 if line is in the current viewport.
  957.                       1 if line was clipped, but still plotted (part of)
  958.                       2 if line out of current viewport (not plotted)
  959.  
  960.         EXAMPLE:
  961.  
  962.             P: GPCOLOR(Green);          { Set color to Green            }
  963.                GPMOVE(5,5);             { Set CP to (5,5)               }
  964.                GPLINE(9,9);             { Draw line from (5,5) to (9,9) }
  965.  
  966.         SEE ALSO:
  967.  
  968.             GPCOLOR, GPMERGE, GPSTYLE and GPMOVE.
  969.  
  970.  
  971.                                                         DATE:   02/03/86
  972.                                                         SYSTEM: KC-TPEGA
  973.  
  974.  
  975.  
  976.         NAME:
  977.  
  978.                 GPPOLY -- Connect an array of points
  979.  
  980.         SYNOPSIS:
  981.  
  982.                 P: procedure GPPOLY(var points; N: Integer);
  983.  
  984.                 C: void GPLINE(points,n)
  985.                      int points[]
  986.                      int n;
  987.  
  988.         DESCRIPTION:
  989.  
  990.                 Starting from the CP, connect each point with a line.
  991.  
  992.         EXAMPLE:
  993.  
  994.             P: GPCOLOR(Green);          { Set color to Green            }
  995.                GPMOVE(5,5);             { Set CP to (5,5)               }
  996.                GPPOLY(car,50);          { Draw a car                    }
  997.  
  998.         SEE ALSO:
  999.  
  1000.             GPLINE.
  1001.  
  1002.  
  1003.                                                         DATE:   02/03/86
  1004.                                                         SYSTEM: KC-TPEGA
  1005.  
  1006.  
  1007.  
  1008.         NAME:
  1009.  
  1010.                 GPRECT -- Draw a rectangle
  1011.  
  1012.         SYNOPSIS:
  1013.  
  1014.                 P: procedure GPRECT(x,y: Integer);
  1015.  
  1016.                 C: void GPRECT(x,y)
  1017.                      int x,y;
  1018.  
  1019.         DESCRIPTION:
  1020.  
  1021.                 Draws a rectangle with CP and given x,y coordinates.
  1022.             The X,Y coordinates becomes the new CP.
  1023.  
  1024.         EXAMPLE:
  1025.  
  1026.             P: GPCOLOR(Green);          { Set color to Green            }
  1027.                GPMOVE(5,5);             { Set CP to (5,5)               }
  1028.                GPRECT(10,10);           { Draw a rectangle              }
  1029.  
  1030.         SEE ALSO:
  1031.  
  1032.             CPCOLOR, GPMOVE and GPLINE.
  1033.  
  1034.  
  1035.                                                         DATE:   02/03/86
  1036.                                                         SYSTEM: KC-TPEGA
  1037.  
  1038.  
  1039.  
  1040.         NAME:
  1041.  
  1042.                 GPCIR -- Draw a circle around the CP
  1043.  
  1044.         SYNOPSIS:
  1045.  
  1046.                 P: procedure GPCIR(radius: Integer);
  1047.  
  1048.                 C: void GPCIR(radius)
  1049.                      int radius;
  1050.  
  1051.         DESCRIPTION:
  1052.  
  1053.                 Starting from the CP, draw a circle with the given radius
  1054.             around it clipping in the current viewport.
  1055.  
  1056.         RETURN:
  1057.  
  1058.             GDC_FLG = 0 if circle is in the current viewport.
  1059.                       1 if circle was clipped, but still plotted (part of)
  1060.                       2 if circle out of current viewport (not plotted)
  1061.  
  1062.         CAUTIONS:
  1063.  
  1064.             The current line style can not be used only the color value.
  1065.  
  1066.         EXAMPLE:
  1067.  
  1068.             P: GPCOLOR(Green);          { Set color to Green            }
  1069.                GPMOVE(100,100);         { Set CP to (5,5)               }
  1070.                GPCIR(50);               { Draw a circle                 }
  1071.  
  1072.         SEE ALSO:
  1073.  
  1074.             GPMOVE.
  1075.  
  1076.  
  1077.                                                         DATE:   02/03/86
  1078.                                                         SYSTEM: KC-TPEGA
  1079.  
  1080.  
  1081.  
  1082.         NAME:
  1083.  
  1084.                 GPWTROW -- Write a row of pixels
  1085.  
  1086.         SYNOPSIS:
  1087.  
  1088.                 P: procedure GPWTROW(var Pixels: Byte; N: Integer);
  1089.  
  1090.                 C: void GPWTROW(Pixels,N)
  1091.                      unsigned char Pixels[];
  1092.                      int N;
  1093.  
  1094.         DESCRIPTION:
  1095.  
  1096.                 Write a row of pixels from the current position (CP), N
  1097.             pixels wide using the specifed byte array of colors.
  1098.  
  1099.         CAUTIONS:
  1100.  
  1101.                 If the row of pixels leave the edge of the screen, the
  1102.             rest will appear on the other side. (Can be a plus).
  1103.  
  1104.         EXAMPLE:
  1105.  
  1106.             P: Pixels: array [0.63] of byte;
  1107.  
  1108.                GPMOVE(5,5);
  1109.                GPWTROW(Pixels,64);
  1110.  
  1111.         SEE ALSO:
  1112.  
  1113.             GPMOVE, and GPWTCOL.
  1114.  
  1115.  
  1116.                                                         DATE:   02/03/86
  1117.                                                         SYSTEM: KC-TPEGA
  1118.  
  1119.  
  1120.  
  1121.         NAME:
  1122.  
  1123.                 GPWTCOL -- Write a column of pixels
  1124.  
  1125.         SYNOPSIS:
  1126.  
  1127.                 P: procedure GPWTCOL(var Pixels: Byte; N: Integer);
  1128.  
  1129.                 C: void GPWTCOL(Pixels,N)
  1130.                      unsigned char Pixels[];
  1131.                      int N;
  1132.  
  1133.         DESCRIPTION:
  1134.  
  1135.                 Write a column of pixels from the current position (CP),
  1136.             N pixels high using the specifed byte array of colors.
  1137.  
  1138.         CAUTIONS:
  1139.  
  1140.                 If the column of pixels leave the edge of the screen,
  1141.             the rest will appear on the other side. (Can be a plus).
  1142.  
  1143.         EXAMPLE:
  1144.  
  1145.             P: Pixels: array [0.63] of byte;
  1146.  
  1147.                GPMOVE(5,5);
  1148.                GPWTROW(Pixels,64);
  1149.  
  1150.         SEE ALSO:
  1151.  
  1152.             GPMOVE, and GPWTROW.
  1153.  
  1154.  
  1155.                                                         DATE:   02/03/86
  1156.                                                         SYSTEM: KC-TPEGA
  1157.  
  1158.  
  1159.  
  1160.         NAME:
  1161.  
  1162.                 GPBOX -- Fills in specified box with current color
  1163.  
  1164.         SYNOPSIS:
  1165.  
  1166.                 P: procedure GPBOX(x,y: Integer);
  1167.  
  1168.                 C: void GPBOX(x,y)
  1169.                      int x,y;
  1170.  
  1171.         DESCRIPTION:
  1172.  
  1173.                 Fills the specified area (box shaped) using the current
  1174.             color and merge value.  Normally used to clear the screen or
  1175.             reverse an area using merge XOR setting.  The CP and the
  1176.             specified X,Y coordinates are used as the corners of the box.
  1177.  
  1178.         RETURN:
  1179.  
  1180.             GDC_FLG = 0 if box is in the current viewport.
  1181.                       1 if box was clipped, but still plotted (part of)
  1182.                       2 if box out of current viewport (not plotted)
  1183.  
  1184.         EXAMPLE:
  1185.  
  1186.             P: GPCOLOR(Black);
  1187.                GPMOVE(0,0);
  1188.                GPBOX(GDMAXCOL,GDMAXROW); { Clear Screen }
  1189.  
  1190.             C: GPCOLOR(GDMAXCLR)            /* Load 0x0F to reverse bits */
  1191.                GPMERGE(3);                  /* Set merge mode to XOR     */
  1192.                GPMOVE(50,50);
  1193.                GPBOX(100,100);              /* Reverse bits in this box  */
  1194.  
  1195.         SEE ALSO:
  1196.  
  1197.             GPCOLOR, GPMERGE.
  1198.  
  1199.  
  1200.                                                         DATE:   02/03/86
  1201.                                                         SYSTEM: KC-TPEGA
  1202.  
  1203.  
  1204.  
  1205.         NAME:
  1206.  
  1207.                 GPBALL -- Fills in specified circle with color/shade
  1208.  
  1209.         SYNOPSIS:
  1210.  
  1211.                 P: procedure GPBALL(Radius: Integer);
  1212.  
  1213.                 C: void GPBALL(Radius)
  1214.                      int Radius;
  1215.  
  1216.         DESCRIPTION:
  1217.  
  1218.                 Fills the specified area (ball shaped) using the current
  1219.             color and merge value.
  1220.  
  1221.         RETURN:
  1222.  
  1223.             GDC_FLG = 0 if ball is in the current viewport.
  1224.                       1 if ball was clipped, but still plotted (part of)
  1225.                       2 if ball out of current viewport (not plotted)
  1226.  
  1227.         EXAMPLE:
  1228.  
  1229.             P: GPCOLOR(Blue);
  1230.                GPMOVE(100,100)
  1231.                GPBALL(50);
  1232.  
  1233.         SEE ALSO:
  1234.  
  1235.             GPCIR, GPCOLOR and GPSHADE.
  1236.  
  1237.  
  1238.                                                         DATE:   02/03/86
  1239.                                                         SYSTEM: KC-TPEGA
  1240.  
  1241.  
  1242.  
  1243.         NAME:
  1244.  
  1245.                 GPSCROLL -- Scroll the current viewport
  1246.  
  1247.         SYNOPSIS:
  1248.  
  1249.                 P: procedure GPSCROLL(Dir, N: Integer);
  1250.  
  1251.                 C: void GPSCROLL(Dir, N)
  1252.                      int  Dir, N;
  1253.  
  1254.         DESCRIPTION:
  1255.  
  1256.                 Scroll the viewport in the specified direction by N
  1257.             lines.  The viewport to be scrolled must be a byte boundary.
  1258.             (x coordinate only).  The direction code is defined as:
  1259.  
  1260.                             0    4   12
  1261.                             1    5   13
  1262.                             3    7   15
  1263.  
  1264.         EXAMPLE:
  1265.  
  1266.             P: GPVIEWPORT(48,50,95,100);
  1267.  
  1268.                GPSCROLL(4,1);   { Scroll the viewport up by one line }
  1269.  
  1270.         SEE ALSO:
  1271.  
  1272.             GPVIEWPORT.
  1273.  
  1274.  
  1275.                                                         DATE:   02/03/86
  1276.                                                         SYSTEM: KC-TPEGA
  1277.  
  1278.  
  1279.  
  1280.         NAME:
  1281.  
  1282.                 GPVIEWPORT -- Specified an area to plot graphic commands
  1283.  
  1284.         SYNOPSIS:
  1285.  
  1286.                 P: procedure GPVIEWPORT(x1,y1,x2,y2: Integer);
  1287.  
  1288.                 C: void GPVIEWPORT(x1,y1,x2,y2)
  1289.                      int x1,y1; /* lower left corner of viewport  */
  1290.                      int x2,y2; /* upper right corner of viewport */
  1291.  
  1292.         DESCRIPTION:
  1293.  
  1294.                 Specify an area on the screen to perform graphic function.
  1295.             The viewport parameters are in Graphic Device Units (GDU). The
  1296.             IBM's Enhance Graphic Adapter is 640x350 GDUs.  The 'GPINIT'
  1297.             function will perform viewport(0,0,639,349).  This function is
  1298.             simular to the Turbo's GraphWindow or BASIC's Viewport.  The
  1299.             basic graphic primitives are clipped using the current viewport.
  1300.  
  1301.         EXAMPLE:
  1302.  
  1303.             GPVIEWPORT(50,50,600,300); { Define viewport }
  1304.                                                  |
  1305.                 .-----------------------.        |
  1306.                 |(0,0)                  |        |
  1307.                 |   .---------------.   |        |
  1308.                 |   |(50,50)        |   |        |
  1309.                 |   |               <------------+
  1310.                 |   |               |   |
  1311.                 |   |      (600,300)|   |
  1312.                 |   `---------------'   |<--- Default Viewport
  1313.                 |              (639,349)|
  1314.                 `-----------------------'
  1315.  
  1316.         SEE ALSO:
  1317.  
  1318.             GPPLOT, GPLINE, GPCIR and GPWINDOW.
  1319.  
  1320.  
  1321.                                                         DATE:   02/03/86
  1322.                                                         SYSTEM: KC-TPEGA
  1323.  
  1324.  
  1325.  
  1326.         NAME:
  1327.  
  1328.                 GPWINDOW -- specified a set coordinates
  1329.  
  1330.         SYNOPSIS:
  1331.  
  1332.                 procedure GPWindow(x1,y1,x2,y2: Integer);
  1333.  
  1334.                 int  x1,y1;     lower left corner of window
  1335.                 int  x2,y2;     upper right corner of window
  1336.  
  1337.         DESCRIPTION:
  1338.  
  1339.                 Specify a new set of coordinates for the current viewport.
  1340.             The coordinates are signed integers (-32768 <--> +32767).  It
  1341.             is simular to the BASIC's Window function.  The graphic
  1342.             primitives GPSCALE, GPCLIP1 and GPCLIP2 can be used for scaling
  1343.             and clipping using the current window.  See the file WORLD.P
  1344.             for function that support the world coordinate system.
  1345.  
  1346.         RETURNS:
  1347.  
  1348.             None.
  1349.  
  1350.         CAUTIONS:
  1351.  
  1352.                 If the viewport and window coordinates are different then
  1353.             an extra scaling process is perform on graphic functions.  No
  1354.             checks are performed on input parameters.
  1355.  
  1356.         EXAMPLE:
  1357.  
  1358.             GPViewport(50,50,600,300);    { Define viewport }
  1359.             GPWindow(-100,-100,100,100); { Define a new set of corrdinates }
  1360.                                                  |
  1361.                 .-----------------------.        |
  1362.                 |(0,0)                  |        |
  1363.                 |   .---------------.   |        |
  1364.                 |   |(-100,-100)    |   |        |
  1365.                 |   |               <------------+
  1366.                 |   |               |   |
  1367.                 |   |      (100,100)|   |
  1368.                 |   `---------------'   |<--- Default Viewport
  1369.                 |              (639,349)|
  1370.                 `-----------------------'
  1371.  
  1372.         SEE ALSO:
  1373.  
  1374.             GPVIEWPORT, and GPSCALE.
  1375.  
  1376.                                                         DATE:   02/03/86
  1377.                                                         SYSTEM: KC-TPEGA
  1378.  
  1379.  
  1380.  
  1381.         NAME:
  1382.  
  1383.                 GPCLIP1 -- Clip a point within the current viewport
  1384.  
  1385.         SYNOPSIS:
  1386.  
  1387.                 P: function GPCLIP1(var x,y: Integer): Integer;
  1388.  
  1389.                 C: int GPCLIP1(x,y)
  1390.                      int x,y;
  1391.  
  1392.         DESCRIPTION:
  1393.  
  1394.                 Perform point clipping on the specifed point and return
  1395.             a zero (0) if the point is in the current viewport, else non-
  1396.             zero response.
  1397.  
  1398.         RETURN:
  1399.  
  1400.                 Zero, if inside viewport, else non-zero if outside.
  1401.  
  1402.         EXAMPLE:
  1403.  
  1404.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1405.  
  1406.                void PtAbs(x,y)                  /* Define WORLD routine */
  1407.                  int x,y;
  1408.                {
  1409.                  if (GPCLIP1(x,y) == 0)         /* Do boundary check    */
  1410.                    {
  1411.                    GPSCALE(x,y);                /* If inside viewport
  1412.                    GPPLOT(x,y);                      scale and plot     */
  1413.                    }
  1414.                }
  1415.  
  1416.         SEE ALSO:
  1417.  
  1418.             GPVIEWPORT, GPCLIP2, and GPSCALE.
  1419.  
  1420.  
  1421.                                                         DATE:   02/03/86
  1422.                                                         SYSTEM: KC-TPEGA
  1423.  
  1424.  
  1425.  
  1426.         NAME:
  1427.  
  1428.                 GPCLIP2 -- Clip a line within the current viewport
  1429.  
  1430.         SYNOPSIS:
  1431.  
  1432.                 P: function GPCLIP2(var x1,y1,x2,y2: Integer): Integer;
  1433.  
  1434.                 C: int GPCLIP2(x1,y1,x2,y2)
  1435.                      int *x1,*y1,*x2,*y2;
  1436.  
  1437.         DESCRIPTION:
  1438.  
  1439.                 Perform point clipping on the specifed line and return
  1440.             a zero (0) if the line is completly in the current viewport
  1441.             or an one (1) if line clipping was performed or two (2) if
  1442.             totally outside of the viewport.
  1443.  
  1444.         RETURN:
  1445.  
  1446.                 Returns zero (0) is the line is completly in the viewport
  1447.             (no clipping performed).  One (1) if the line was clip and the
  1448.             x1,y1,x2,y2 value now contain the clipped line.  Two (2) if
  1449.             the line is outside of the viewport.
  1450.  
  1451.         EXAMPLE:
  1452.  
  1453.             C: GPVIEWPORT(50,50,100,100);       /* Set current viewport */
  1454.  
  1455.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check    */
  1456.                  {
  1457.                  GPSCALE(x1,y1);                /* If inside viewport
  1458.                  GPMOVE(x1,y1);                      scale and draw     */
  1459.                  GPSCALE(x2,y2);
  1460.                  GPLINE(x2,y2);
  1461.                  }
  1462.                }
  1463.  
  1464.         SEE ALSO:
  1465.  
  1466.             GPVIEWPORT, GPCLIP1, and GPSCALE.
  1467.  
  1468.  
  1469.                                                         DATE:   02/03/86
  1470.                                                         SYSTEM: KC-TPEGA
  1471.  
  1472.  
  1473.  
  1474.         NAME:
  1475.  
  1476.                 GPSCALE -- Scale a world coordinate to viewport
  1477.  
  1478.         SYNOPSIS:
  1479.  
  1480.                 P: procedure GPSCALE(var x,y: Integer);
  1481.  
  1482.                 C: void GPSCALE(x,y)
  1483.                      int *x,*y;
  1484.  
  1485.         DESCRIPTION:
  1486.  
  1487.                 Scale the specifed point from world coordinates to the
  1488.             Device coordinates in the current viewport.
  1489.  
  1490.         RETURN:
  1491.  
  1492.                 Changes the X,Y coordinate to real (hardware) coordinates.
  1493.  
  1494.         EXAMPLE:
  1495.  
  1496.             C: GPWINDOW(0,0,1000,1000);         /* Set world coordinates */
  1497.                GPVIEWPORT(50,50,100,100);       /* Set current viewport  */
  1498.  
  1499.                if (GPCLIP2(x1,y1,x2,y2) != 2)   /* Do boundary check     */
  1500.                  {
  1501.                  GPSCALE(x1,y1);                /* If inside viewport
  1502.                  GPMOVE(x1,y1);                      scale and draw      */
  1503.                  GPSCALE(x2,y2);
  1504.                  GPLINE(x2,y2);
  1505.                  }
  1506.                }
  1507.  
  1508.         SEE ALSO:
  1509.  
  1510.             GPWINDOW, GPVIEWPORT, GPCLIP1, and GPGLIP2.
  1511.  
  1512.  
  1513.                                                         DATE:   02/03/86
  1514.                                                         SYSTEM: KC-TPEGA
  1515.  
  1516.  
  1517.  
  1518.         NAME:
  1519.  
  1520.                 GPFILL -- Fill the specified area with color/shading
  1521.  
  1522.         SYNOPSIS:
  1523.  
  1524.                 P: procedure GPFILL(Border_Color: Integer);
  1525.  
  1526.                 C: void GPFILL(Border_Color)
  1527.                      unsigned integer Border_Color;
  1528.  
  1529.         DESCRIPTION:
  1530.  
  1531.                 Fill in an area starting at the CP to the border given.
  1532.             The current color or current shading will be used depending
  1533.             on the setting of the GDS_FLG variable.  The routine is for
  1534.             simple areas only, which makes it much faster than GPFLOOD.
  1535.             If the area is too complex for GPFILL, parts of the area will
  1536.             not be filled in (but it will work).  GPFILL will not fill
  1537.             pass the current viewport setting.
  1538.  
  1539.         CAUTIONS:
  1540.  
  1541.             Although any dimension from 1 to 255 can be used, the current
  1542.             version of GPFILL and GPFLOOD only works correctly with shade
  1543.             of dimensions of 1,2,4 or 8 (x and y can be different).  This
  1544.             restriction will be removed in the future.
  1545.  
  1546.         EXAMPLE:
  1547.  
  1548.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1549.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1550.  
  1551.                GPSHADE(Shade);             /* Define the shading      */
  1552.  
  1553.                GPMOVE(X1,Y1);
  1554.                GPFILL(color);              /* Flood area with border
  1555.                                               defined by color        */
  1556.  
  1557.         SEE ALSO:
  1558.  
  1559.             GPCOLOR, GPSHADE, GPFLOOD and GPVIEWPORT.
  1560.  
  1561.  
  1562.                                                         DATE:   02/03/86
  1563.                                                         SYSTEM: KC-TPEGA
  1564.  
  1565.  
  1566.  
  1567.         NAME:
  1568.  
  1569.                 GPFLOOD -- Flood the specified area with color/shading
  1570.  
  1571.         SYNOPSIS:
  1572.  
  1573.                 P: procedure GPFLOOD(Border_Color: Integer);
  1574.  
  1575.                 C: void GPFLOOD(Border_Color)
  1576.                      unsigned integer Border_Color;
  1577.  
  1578.         DESCRIPTION:
  1579.  
  1580.                 Flood in an area starting at the CP to the border given.
  1581.             The current color or current shading will be used depending
  1582.             on the setting of the GDS_FLG variable.  The routine is for
  1583.             all complex areas, which makes it much slower than GPFILL.
  1584.             If the area is simple, try GPFILL, if it does not fill it all
  1585.             then go back to GPFLOOD.  GPFLOOD will not flood pass the
  1586.             current viewport setting.
  1587.  
  1588.         CAUTIONS:
  1589.  
  1590.             Although any dimension from 1 to 255 can be used, the current
  1591.             version of GPFLOOD only works correctly with shade of
  1592.             dimensions of 1,2,4 or 8 (x and y can be different).  This
  1593.             restriction will be removed in the future.
  1594.  
  1595.         EXAMPLE:
  1596.  
  1597.             C: unsigned char Shade[] =     /* Set fill shade to GBGB  */
  1598.                  {2,2,Green,Blue,Blue,Green};    /* 2 by 2 array */
  1599.  
  1600.                GPSHADE(Shade);             /* Define the shading      */
  1601.  
  1602.                GPMOVE(X1,Y1);
  1603.                GPFLOOD(color);             /* Flood area with border
  1604.                                               defined by color        */
  1605.  
  1606.         SEE ALSO:
  1607.  
  1608.             GPCOLOR, GPSHADE, GPFILL, and GPVIEWPORT.
  1609.  
  1610.  
  1611.