














                    Ŀ
                                                          
                       Ķ   Ķ   Ŀ      Ĵ
                                                       
                       Ķ               
                                                     
                    
                      The Excellent Graphics Object Framework








                                      Index

                       2         Disclaimer, Registration, etc.
                       3         What is EGOF anyway?
                       4         Data-Types
                       7         Constants
                       10        Routines
                       13        The Bitmap Objects
                       23        The Bitmap Methods
                       28        Writing Bitmap Objects
                       30        The Palette Objects
                       33        Palette Methods
                       36        Writing Palette Objects
                       37        The Mouse
                       39        Error Checking









                           Version 1.1 - February 1994
                     Copyright (c) 1993-1994 Logi Ragnarsson
                               All rights reserved.

                          DISCLAIMER, REGISTRATION, ETC.

          This software is supplied "as is". This means that I take no
        responsibility for any defects in it, nor for any harm you may be
        able to do to yourself, your equipment, your pets, or anything
        else with this package.

          EGOF is distributed as shareware. Please make copies of it to
        give to your friends, upload to BBSes, make available on anonymous
        FTP sites, and distribute it any way you can.
          You may not distribute partial, or in any way modified versions
        of EGOF, the accompanying documentation, or the demonstration
        programs.

          You may try EGOF out for one month. If, after that time, you
        decide you want to continue using EGOF, or any programs written
        with EGOF, you must register. The registration fee is US$ 10 and
        entitles you to any future upgrades I may release. Registered
        users can also get the full source code for an additional US $20.

          When you register EGOF, send the money to me (see below) and
        make sure that I get your full name and address, and your e-mail
        addresses (if any). I will not distribute this information without
        your consent.

          The preferred way of paying is to deposit the money on my
        account number 0139-38-112299 at the bank listed below. You can
        also send a cheque directly to me.

          If you have any ideas about how EGOF can be improved, or bug
        reports, they would be most welcome. I'll do my best to find and
        exterminate any bugs, and am very likely to take up suggestions,
        although I can't promise anything.
          If you have any questions not answered in the manual try one of
        the places listed below. Or send mail directly to me.

        How to contact me:

          Internet:                     Bank:
            logir@ismennt.is              Landsbanki Islands - Mulautibu
                                          Lagmula 9
          Surface address:                108 Reykjavik
                Logi Ragnarsson           ICELAND
                Engihjalli 17
                200 Kopavogur             (swift: LAISISRE)
                ICELAND









        __________________________________________________________________
        EGOF v1.1                                                   Page 2

                               WHAT IS EGOF ANYWAY?

          I was getting very frustrated about not being able to run my
        SVGA programs on other computers than those equipped with a
        Super VGA like mine, and couldn't find any decent Turbo Pascal
        units to help me. I finally decided that I'd just have to write
        one myself, so I wrote EGOF.

          EGOF is a collection of objects for programming 256-colour bit
        mapped graphics in Turbo Pascal. It takes advantage of OOP to make
        everything more logical and flexible. It supports VGA, SVGA,
        Bitmaps in memory, static patterns and "filters" and the same
        procedures and functions can be used on nearly all the supported
        bitmaps, with the exception that some can't be written to.

          EGOF requires only Turbo Pascal 6.0, Turbo Pascal 7.0, or
        Borland Pascal 7.0 to use. The programs  you write are very likely
        to require such things as a VGA or a VESA BIOS compatible SVGA,
        but some may be run in text mode.

          EGOF can be used in either real or protected mode without any
        special considerations, and has been tested under OS/2. In fact,
        this version was developed under OS/2 2.1.
































        __________________________________________________________________
        EGOF v1.1                                                   Page 3

                                    DATA-TYPES

          These Data-types are very useful when programming with EGOF, but
        not all are really required.

        EGOF.TPU:  TYPE CASTING
          Most buffers in EGOF, such as those for scan lines are defined as
        BufP's and the required amount of memory is calculated at run time.
        If you decide that you want to read the 32nd Word from a buffer
        [B], you can use this typecast: BufWP(B)^[32]

        BufA = Array [0..65534] of Byte;
        BufP = ^BufA;                   { To access Bytes in a buffer    }

        BufWA = Array [0..32766] of Word;
        BufWP = ^BufWA;                 { Access Words in a buffer       }

        BufLA = Array [0..16382] of LongInt;
        BufLP = ^BufLA;                 { Access LongInts in a buffer    }

        BufRA = Array [0..10921] of Real;
        BufRP = ^BufRA;                 { Access Reals in a buffer       }

          This record can be used to access the segment and offset parts
        of a pointer. It can be used in two ways. First, you can define a
        variable as being of type PointR and access the full pointer in
        the field [Ptr] and the segment and offset as [Seg] and [Ofs].
        Second, it can be used to access the segment and offset parts of
        a regular pointer with typecasting. If you want to set the segment
        of the pointer [P] to $A000 you could do the following:
        PointR(P).Seg := $A000. The [Sel] field always refers to the same
        word as [Seg].

        PointR = Record
                   Case Integer of
                     0 : (Ofs :Word;
                          Case Byte of
                            0 : (Sel :Word);
                            1 : (Seg :Word););
                     1 : (Ptr :Pointer);
                 End;

        EGOF.TPU:  COLOURS
          These next types are used when manipulating palettes.

        PalR    = Record                { One colour                     }
                    R,G,B :Byte;
                  End;
        PalBufA = Array [0..255] of PalR; { Array to store full palette  }
        PalBufP = ^PalBufA;             { Pointer to palette Array       }

          This type is used in the LockColO filter and in the MakeScriptS
        routine.

        ColSet = Set of Byte;           { Used in LockColO               }
        __________________________________________________________________
        EGOF v1.1                                                   Page 4

        EGOF.TPU:  Co-ordinates

        PointType = Record              { Use an Array of these in Poly  }
                      X,Y :Word;
                    End;

          These types are used for scripts. Scripts in EGOF are data
        structures that hold information about what pixels should be
        copied. They are created in the MakeScriptX routines and used by
        the CopyMapS method.

        LineR   = Record                { One scan-line in script        }
                    SX,SY,L :Word;
                  End;
        ScriptA = Array [0..9999] of LineR;
        ScriptR = Record            { A full script                      }
                    X1,Y1,          { The offset of the region on source }
                    W,H   :Word;    { Width, Height of region            }
                    Len   :Word;    { Number of scan-lines in script     }
                    Lines :ScriptA; { The Array of scan-lines            }
                  End;
        ScriptP = ^ScriptR;         { Pointer to script                  }

        EGOF.TPU:  MISCELLANEOUS
          The function that is passed to the CopyMapI method should be of
        this type. [LineNr] is the number of the scan-line about to be
        copied, with the first scan line as number 0. The Function should
        return true if the copy should terminate.

        PerLineFunc = Function (LineNr:Word):Boolean;

          This record is used by GetPcxInfo to return information about a
        PCX file.

        PcxInfo  = Record                 { Data returned by GetPcxInfo  }
                     Ver       :Byte;     { Version     5 = v3.0         }
                     BPP       :Byte;     { Bits per pixel               }
                     XRes,YRes :Word;     { Size of picture              }
                     Pal       :Boolean;  { Does it include a palette?   }
                   End;
        PcxInfoP = ^PcxInfo;

          This set is used to hold the available video modes in display
        objects. ModeMin and ModeMax are described in the constants
        section.
          ModeSet = Set of ModeMin..ModeMax;









        __________________________________________________________________
        EGOF v1.1                                                   Page 5
        VESAU.TPU:  SVGA ADAPTER/MODE INFORMATION
          These types are used to return information about the VESA BIOS
        compatible SVGA.

        ModeA  = Array[0..100] of Word;      { Zero terminated modelist  }
        ModeAP = ^ModeA;
        AdapterInfo  = Record                { Info on VESA SVGA         }
                         VesaSign :Array[0..3] of char;         { 'VESA' }
                         VMinor   :Byte;     { Minor version #           }
                         VMajor   :Byte;     { Major version #           }
                         OemSign  :PChar;    { OEM String                }
                         Capable  :LongInt;  { Capabilities: Not defined }
                         ModeSup  :ModeAP;   { Points to supported modes }
                         MemSize  :Word;     { Amount of memory on card  }
                         Fill     :Array [$00..$EB] of Byte;    { Unused }
                       End;
        AdapterInfoP = ^AdapterInfo;

          This type is used to return information about VESA defined video
        modes supported by this SVGA.

        ModeInfo  = Record               { Info on one VESA SVGA mode    }
                      ModeAttr  :Word;   { Basic mode information        }
                      WinAAttr,          { Window (selected bank) info   }
                      WinBAttr  :Byte;
                      WinGran   :Word;   { KB between memory banks       }
                      WinSize   :Word;   { Size of window in KB          }
                      Seg       :Array[0..1] of Word;  { Seg for windows }
                      WinFunc   :Procedure;      { Procedure for Windows }
                      BPL       :Word;   { Bytes per scan-line           }
                      { INFORMATION AVAILABLE IF BIT 1 OF ModeAttr is 1  }
                      XRes,YRes :Word;   { Pixel resolution of mode      }
                      ChrX,ChrY :Byte;   { Size of character cells       }
                      Planes    :Byte;   { Number of memory planes       }
                      BPP       :Byte;   { Bits per pixel                }
                      NoBanks   :Byte;   { Number of banks               }
                      MemMod    :Byte;   { Memory Model                  }
                      BankSize  :Byte;
                   End;
        ModeInfoP = ^ModeInfo;

        MOUSE.TPU:  MOUSE EVENTS
          The mouse object uses this record to hold information about
        single mouse events. The BStat field is a bitmap of the state of
        the buttons after this event. Bits 1,2 and 3 refer to the left,
        right and middle buttons. If a bit is set, then the corresponding
        button was depressed.

        MouseEventR  = Record
                         What   :Byte;  { What happened. MeXXXX constant }
                         Who    :Byte;  { What button is involved        }
                         WhereX :Word;  { Where did it happen.           }
                         WhereY :Word;  { X and Y co-ordinates           }
                         BStat  :Byte;  { Button Status                  }
                       End;
        MouseEventP  = ^MouseEventR;
        __________________________________________________________________
        EGOF v1.1                                                   Page 6

                                    CONSTANTS

          Some essential and some merely useful constants. You should
        always use the constants rather than entering explicit values,
        since I may change the value (but not the meaning) of the
        constants in future versions of EGOF. I am very likely, for
        example, to add new video modes and error codes.

        EGOF.TPU:  VIDEO MODE INFORMATION
          These constants can be used as index in the ModeList array
        below. It is only used with the BiosO bitmap and should be
        avoided.

        AIbm      = 0;
        AATI      = 1;
        AChips    = 2;
        AGenoa    = 3;
        AParadise = 4;
        ATrident  = 5;
        ATseng    = 6;
        AVideo7   = 7;
        AVESA     = 8;

          These constants are for the available video modes in EGOF. They
        are used in the constructors of screen objects (except the BiosO,
        see above). The two numbers in the constant names are the
        horizontal and vertical resolution of that mode.

        Mode320x200    = 0;   { Standard VGA mode      }
        Mode640x400    = 1;   { VESA SVGA modes        }
        Mode640x480    = 2;
        Mode800x600    = 3;
        Mode1024x768   = 4;
        Mode1280x1024  = 5;
        Mode320x240    = 6;   { Non-standard VGA modes }
        Mode320x400    = 7;
        Mode320x480    = 8;
        Mode360x240    = 9;
        Mode360x360    = 10;
        Mode360x480    = 11;
        Mode376x282    = 12;
        Mode376x308    = 13;
        Mode376x564    = 14;

          These constants define mode sub ranges. For example, all the
        VESA modes are in the range ModeVesaMin to ModeVesaMax. This can
        be used to check if a requested mode in a VESA mode.

        ModeVesaMin    = Mode640x400;      { VESA SVGA mode range        }
        ModeVesaMax    = Mode1280x1024;
        ModeNsMin      = Mode320x240;      { Non-standard VGA mode range }
        ModeNsMax      = Mode376x564;
        ModeMax        = Mode376x564;      { Highest mode number defined }


        __________________________________________________________________
        EGOF v1.1                                                   Page 7

          This array is used to get the resolution of a specific video
        mode. The video mode should be one of the ModeXXXX constants
        defined above.

        ModeRes :Array [0..ModeMax] of Record
                                         XRes,YRes :Word;
                                       End =
          (( XRes: 320  ; YRes: 200  ),  { Requires   64Kb  }
           ( XRes: 640  ; YRes: 400  ),
           ( XRes: 640  ; YRes: 480  ),  { Requires  512Kb  }
           ( XRes: 800  ; YRes: 600  ),
           ( XRes: 1024 ; YRes: 768  ),  { Requires 1024Kb  }
           ( XRes: 1280 ; YRes: 1024 ),  { Requires 1536Kb  }
           ( XRes: 320  ; YRes: 240  ),  { Non-standard VGA }
           ( XRes: 320  ; YRes: 400  ),
           ( XRes: 320  ; YRes: 480  ),
           ( XRes: 360  ; YRes: 240  ),
           ( XRes: 360  ; YRes: 360  ),
           ( XRes: 360  ; YRes: 480  ),
           ( XRes: 376  ; YRes: 282  ),
           ( XRes: 376  ; YRes: 308  ),
           ( XRes: 376  ; YRes: 564  ));

        ModeList :Array [AIbm..AVESA,Mode320x200..Mode1280x1024] Of Word =
            { 320  640  640b 800  1024 1280 }
            (($13, $03, $03, $03, $03, $03),   { Standard IBM VGA     }
             ($13, $61, $62, $63, $03, $03),   { ATI                  }
             ($13, $78, $79, $7B, $03, $03),   { Chips'n'Technologies }
             ($13, $7E, $5C, $6C, $03, $03),   { Genoa systems        }
             ($13, $5E, $5F, $03, $03, $03),   { Paradise             }
             ($13, $5C, $5D, $03, $62, $03),   { Trident              }
             ($13, $2F, $2E, $30, $38, $03),   { Tseng Labs           }
             ($13, $66, $67, $69, $03, $03),   { Video7               }
             ($13, 100,$101,$103,$105,$107));  { VESA compatible      }

        EGOF.TPU:  ERROR CODES
          These are the error codes returned by the GetEgofError function.

        ENone       = 0;    { No error. Happy, happy. Joy, joy.          }
        EWrongCard  = 1;    { The object can't use this display adapter. }
        EWrongMode  = 2;    { Sorry, can't use the specified video mode. }
        EOutOfMem   = 3;    { Out of memory. Popular among BigMemMapOs.  }
        EOutOfDisk  = 4;    { Out of disk space.                         }
        EFile       = 5;    { File I/O error.                            }
        EFileFormat = 6;    { Wrong file format.                         }
        ENoMouse    = 7;    { No mouse driver found.                     }
        ESome       = -1;   { Something unexpected has come up.          }








        __________________________________________________________________
        EGOF v1.1                                                   Page 8

          Suggested error messages corresponding to the error codes above.

        EgofErrorStr :Array [ESome..EFileFormat] of String[36] =
          ('Unidentified graphics error',           { ESome         }
           'No graphics error',                     { ENone         }
           'Can''t handle this display adapter',    { EWrongCard    }
           'Can''t use this display mode',          { EWrongMode    }
           'Not enough memory',                     { EOutOfMem     }
           'Not disk space',                        { EOutOfDisk    }
           'File error',                            { EFile         }
           'Wrong file format',                     { EFileFormat   }
           'No mouse driver found');                { ENoMouse      }

          This is the Icelandic version of the error messages. They won't
        make sense without code-page 861, and probably not even then. If
        you know any other interesting languages, send me the error
        messages in that language and I'll start a collection.

        EgofErrorIce :Array [ESome..EFileFormat] of String[29] =
          ('ekkt skjvilla',                      { ESome         }
           'Engin villa',                           { ENone         }
           'Get ekki nota etta skjkort',         { EWrongCard    }
           'R ekki vi ennan skjham',           { EWrongMode    }
           'Ekki ng laust minni',                  { EOutOfMem     }
           'Ekki ng laust diskplss',              { EOutOfMem     }
           'Skrarvilla',                           { EFile         }
           'ekkt skrarsni',                     { EFileFormat   }
           'Finn ekki ms');                        { ENoMouse      }

        EGOF.TPU:  MISCELLANEOUS
          Convert Boolean value to a 'Yes' or a 'No'

        YN :Array [Boolean] of String[3] = ('No ','Yes');

        MOUSE.TPU:  MOUSE EVENTS
          These constants are used by the MouseO object for the [What]
        field in the MouseEventR record.

        MeDown   = 1;   { Button pressed                 }
        MeUp     = 2;   { Button released                }
        MeDouble = 3;   { Button double-clicked          }
        MeDrag   = 4;   { Mouse moved with button down   }
        MeDrop   = 5;   { Button released after dragging }












        __________________________________________________________________
        EGOF v1.1                                                   Page 9

                                     ROUTINES

          Here are some routines that you may find useful. Some were
        originally for internal use by EGOF, but It would be silly if you
        had to re-write them and have two copies in the EXE file. The
        routines are ordered by the unit where they reside and have a
        short description each.

        EGOF.TPU:  ERROR CHECKING
          IsEgofError returns true when an error has occurred, and
        GetEgofError returns the error code and resets the error flag.

        Function IsEgofError  :Boolean;
        Function GetEgofError :ShortInt;

        EGOF.TPU:  SCRIPTS
          These routines are used to create scripts. Scripts in EGOF are
        structures that store information about what pixels should be
        copied when using the CopyMapS method. They make a script that
        copies pixels in the area starting at [X1],[Y1] and extending
        [W],[H] pixels on the source bitmap [Map]. The T version will skip
        all pixels with the colour [TC] and the S version will skip all
        pixels that have a colour that is a member of [TS].

        Function MakeScriptT (Map :BitMapP; X1,Y1,W,H:Word; TC:Byte)
                 :ScriptP;
        Function MakeScriptS (Map :BitMapP; X1,Y1,W,H:Word; TS:ColSet)
                 :ScriptP;

          Scripts have dynamic sizes, so they can't be de-allocated with a
        simple call to Dispose. They should rather be destroyed by calling
        this routine.

        Procedure KillScript (S :ScriptP);

        EGOF.TPU:  MISCELLANEOUS
          GetPcxInfo returns information about the file [FN]. If [Xtra] is
        not nil, then any extra information that may be stored in the 106
        free bytes in the PCX file is read into the buffer that [Xtra] is
        assumed to point to.

        Function GetPcxInfo (FN:String; Xtra:Pointer) :PcxInfoP;

          These two routines can be used to convert an integer to a
        hexadecimal string. Hex char converts a [Number] in the range 0-15
        to one hex digit and HexStr converts the [Number] to a string that
        is at least [Len] characters long.

        Function HexChar(Number: Byte): Char;
        Function HexStr(Number: LongInt; Len:Byte): String;

          Return the larger or smaller of two integer values.

        Function MaxI (A,B :Integer) :Integer;   { Return higher integer }
        Function MinI (A,B :Integer) :Integer;   { Return lower  integer }
        __________________________________________________________________
        EGOF v1.1                                                  Page 10

          Wait for vertical retrace. This is used internally to reduce
        flicker and snow.

        Procedure VRWait;

        VGAU.TPU:  DETECTION
          These routines are used to check if there is a VGA (or MCGA) in
        the system and what video-mode it is in.

        Function IsVga :Boolean;
        Function GetMode :Byte;

        VESAU.TPU:  DETECTION
          GetAdapterInfo is used to get information about the VESA display
        adapter installed, and the GetModeInfo routines is used to get
        information about a specific VESA defined video mode. The mode
        number passed to GetModeInfo should be a real mode number (can be
        found in ModeList[AVESA]). The WriteXXXX routines below are used
        to write the information gathered by the GetXXXX routines to the
        screen in text mode.

        Function GetAdapterInfo :AdapterInfoP;
        Function GetModeInfo(Mode:Word) :ModeInfoP;
        Procedure WriteAdapterInfo (AI :AdapterInfoP);
        Procedure WriteModeInfo (MI :ModeInfoP);

          This routine returns the currently active video mode, including
        VESA specific modes. The returned value is not one of the ModeXXXX
        constants, but real video mode numbers.

        Function GetVesaMode (Var Error:Byte):Word;

        MEMORYU.TPU:  BITMAP CREATION
          These routines can be used to create memory maps. The first
        version will create a bitmap that is [XSize] by [YSize] pixels and
        leave at least [Leave] bytes of memory free. The second version
        will create a memory map just large enough to hold the PCX file in
        [FN], read the file into the map, the palette into [Pal] (unless
        [Pal] is nil) and the 106 bytes of extra information into the
        buffer pointed to by [Xtra] (unless [Xtra] is nil). both version
        will first try to create a SmallMemMapO, then a BigMemMapO and, if
        both fail, will create a DiskMapO.

        Function MakeMemMap (XSize,YSize :Word; Leave :LongInt) :MemMapP;
        Function MakeMemMapPCX (FN :String; Pal :EPalP; Leave :LongInt)
                 :MemMapP;









        __________________________________________________________________
        EGOF v1.1                                                  Page 11
        STRINSTR.TPU:  DATA PUSHING
          These routines are a high level interface to the assembly
        language string instructions. MoveXY will copy every Xth byte from
        [Source] to every Yth byte on [Dest]. [Count] is the number of
        bytes to copy, not counting the skipped ones. Move should,
        according to this system, be called Move11, since it copies every
        pixel to every pixel.

        Procedure Move    (Var Source,Dest; Count:Word);
        Procedure Move22  (Var Source,Dest; Count:Word);
        Procedure Move12  (Var Source,Dest; Count:Word);
        Procedure Move14  (Var Source,Dest; Count:Word);
        Procedure Move21  (Var Source,Dest; Count:Word);
        Procedure Move41  (Var Source,Dest; Count:Word);

          The "T" on the end of these routines means that pixels with
        colour [TC] will be skipped.

        Procedure MoveT   (Var Source,Dest; Count:Word; TC:Byte);
        Procedure Move14T (Var Source,Dest; Count:Word; TC:Byte);
        Procedure Move41T (Var Source,Dest; Count:Word; TC:Byte);

          FillX writes the value [C] to every Xth byte in [Dest]. [Count]
        is the number of bytes to write

        Procedure Fill    (Var Dest; Count:Word; C:Byte);
        Procedure Fill2   (Var Dest; Count:Word; C:Byte);
        Procedure Fill4   (Var Dest; Count:Word; C:Byte);




























        __________________________________________________________________
        EGOF v1.1                                                  Page 12

                                THE BITMAP OBJECTS

         GraphicO*                      A bitmap object is a
           BitMapO*                   rectangular grid of pixels. The
             ArcTanO                  most obvious bitmap is the screen
             CheckerO                 (descendants of ScrMapO), but
             PcxMapO                  there are also objects for using
             FracMapO*                bitmaps in memory or on disk
              SolidFracMapO*         (descendants of MemMapO) and
                JuliaO               others. All these objects are
                MandelbrotO          described in detail on the
             EBitMapO*                following few pages.
               MemMapO*                 There are three basic kinds of
                BigMemMapO           bitmap objects. All the objects
                DiskMapO             within a group are used
                SmallMemMapO         essentially the same way, except
               ScrMapO*               for some differences in the
                BiosO                constructors.
                VgaO
                ScrMpMapO*             First there are the base
                  VgaNsO             bitmaps. These can be read, but
                  VesaO              not always written to. This can
               EFilterO*              be used to create patterns such
                 ClipO                as the built-in CheckerO,
                 LockColO             MandelbrotO, and such.
                 LockMapO
                 RemapColO              There are also objects that
                 ScaleDownBO          define editable bitmaps,
                 ScaleDownO           descendants of EBitMapO. These
                 SpriteO              can be read and written and are
                 WinO                 your basic everyday bitmaps such
                 XorO                 as the screen.

           Bitmap object family-tree

          Lastly there are the Filters. The filters are not real bitmaps,
        but direct anything written to them to one or more host bitmaps
        more or less modified. The filters can, for example, XOR
        everything onto the host, re-scale it, remap the colours or lock
        specific pixels.
          The editable bitmaps are actually a special case of the base
        bitmaps, and the filters are also editable bitmaps.

          Because the editable bitmaps are descendants of the static ones,
        anything that can be done with a static bitmap can also be done
        with an editable one. For example, the GetPix method that is
        defined in BitMapO is available in all bitmaps, since all bitmaps
        are descendants of BitMapO. In the same way, PutPix that is
        defined in EBitMapO, is available in all its descendants, i.e. all
        bitmaps that can be written to.





        __________________________________________________________________
        EGOF v1.1                                                  Page 13
          The object-names in the family-tree above, and in the list
        below, that are marked with an asterix are abstract objects.
        Abstract objects don't actually do anything, but are used to give
        their offspring some common ancestor to polymorph into. This means
        that you should not use a ScrMapO, but rather one of its offspring
        such as the VgaO.

          On the following pages is a list of bitmap objects and a short
        description of each. The format of the descriptions is as follows:

        __________________________________________________________________
        ObjectNameO (AncestorO)                                  UnitNameU
          Here goes the description of what the object does.

        Method group 1         Method1A, Method1B
        Method group 2         Method2A, Method2B, Method2C, Method2D

        InitConstructor1 (Var1,Var2 :SomeType);
          Here the constructor above is described.

        DoneDestructor1;
          Here the destructor above is described.

        Field1 :SomeTypeOrOther;
          Here the field above is described.

          Methods are mentioned only in the descriptions of the objects
        where they are originally defined. Remember that all methods from
        all ancestors are inherited, so they can still be used even if
        they are not listed in the description.

        Constructors have names starting with Init and destructors have
        names starting with Done.

          For each object there is defined a pointer-to-object data-type.
        The name of the pointer is the same as that of the object, but
        with a P on the end in stead of the O. Thus VgaP points to a VgaO.

        __________________________________________________________________
        GraphicO*                                                     Egof
          This object is the ancestor of all graphics objects. These are
        currently only bitmaps, but will in the future include 2-D vector
        graphics and perhaps animations.

        Reading                ShowOn

        __________________________________________________________________
        BitMapO                                                       Egof
          This object is the ancestor of all bitmaps and defines the
        methods for reading a bitmap and for getting its dimensions.

        Reading                GetPix, GetLine, GetLineT
        File                   WritePcx



        __________________________________________________________________
        EGOF v1.1                                                  Page 14
        __________________________________________________________________
        ArcTanO (BitMapO*)                                        PatternU
          This object is a picture of rays from the centre of the bitmap
        to the edges. Not very useful, but shows what can be done with a
        BitMapO.

        Init (XSize,YSize :Word)
            Create object. Make it [XSize] by [YSize] pixels in size.

        __________________________________________________________________
        CheckerO (BitMapO*)                                       PatternU
          This object is a static checker pattern.

        Init (XSize,YSize, XSquare,YSquare :Word; C1,C2 :Byte)
          Create object. Make it [XSize] by [YSize] pixels in size and
        each square [XSquare] by [YSquare] pixels. The squares alternate
        between colours [C1] and [C2].

        __________________________________________________________________
        PcxMapO (BitMapO*)                                        PatternU
          This object is an interface to PCX files. The pixels are read
        from the file each time the bitmap is read. This results in rather
        slow performance, but takes very little memory. In most cases the
        ReadPcx method is more appropriate. Files up to 65534 pixels wide
        and 16383 pixels high can be used. Avoid reading single pixels
        from a PcxMapO; The various flavours of the CopyMap and GetLine
        methods are much more efficient, except FadeMap.

        Init (FN: String; Pal :EPalP; Xtra :BufP)
          Create an object that uses the file specified in [FN]. If [Pal]
        is not nil, then the palette is put there. If [Xtra] is not nil,
        then the extra information that may be present in PCX files is
        read into the buffer that [Xtra] is assumed to point to. Before
        calling InitPcx the first byte in the buffer specifies the number
        of bytes to read (up to 106 bytes).

        __________________________________________________________________
        FracMapO* (BitMapO*)                                      FractalU
          This object is the ancestor of all fractal bitmaps.

        Control                SetPos, Zoom, SetIter

        __________________________________________________________________
        SolidFracMapO* (FracMapO*)                                FractalU
          This object is the ancestor of all the current fractal bitmaps.
        It implements an optimised ShowOn method for fractals that are
        known to have (mathematically) solid and unbroken bands of colour.

        __________________________________________________________________
        JuliaO (SolidFracMapO*)                                   FractalU
          This object is a semi-static bitmap of the Julia set. It can't
        be written to, but can show different areas of the set.

        Control                SetParam


        __________________________________________________________________
        EGOF v1.1                                                  Page 15
        Init (XSize,YSize :Word; Cr,Ci :Double; MaxI :Word)
          Create a Julia set object that is [XSize] by [YSize] in size and
        corresponds to the point [Cr],[Ci] on the Mandelbrot Set. Set the
        maximum iterations to [MaxI] and show the full set.

        __________________________________________________________________
        MandelbrotO (SolidFracMapO*)                              FractalU
          This object is a semi-static bitmap of the Mandelbrot set. It
        can't be written to, but can show different areas of the set. It
        is optimised for use with a math co-processor.
          The per-pixel routine was written by Mark Stehr.
          Internet: mkstehr@cip.informatik.uni-erlangen.de

        Control                MakeJulia

        Init (XSize,YSize, MaxI :Word)
          Create a Mandelbrot set object that is [XSize] by [YSize] in
        size. Set the maximum iterations to [MaxI] and show the full set.

        __________________________________________________________________
        EBitMapO* (BitMapO*)                                          Egof
          This object is the ancestor of all editable bitmaps and defines
        the methods for writing to a bitmap.

        Writing               PutPix, Clear, HLine, VLine
        High level writing    Line, Box, FBox, Ellipse, FEllipse, Poly,
                              Flood
        Bit blt               CopyMap, CopyMapT, FadeMap
        File                  ReadPcx

        __________________________________________________________________
        MemMapO* (EBitMapO*)                                       MemoryU
          This object is the ancestor of all memory resident bitmaps.
        Writing to memory maps is generally much faster than writing to
        the screen. Note that all calls to FadeMap are converted to the
        much faster CopyMap equivalent, since no one will see it any way.

        Init (XSize,YSize :Word)
          Create object and make it [XSize] by [YSize] pixels in size.

        InitPcx (FN :String; Pal :PalP; Xtra :Pointer)
          Create an object just large enough to hold the picture in the

        PCX file specified in [FN] and then load the picture.
          If [Pal] is not nil, then the PCX file's palette is put there.
          If [Xtra] is not nil, then the extra information that may be
        present in PCX files is read into the buffer that [Xtra] is
        assumed to point to. Before calling InitPcx the first byte in the
        buffer specifies the number of bytes to read (up to 106 bytes).
          See also ReadPcx.






        __________________________________________________________________
        EGOF v1.1                                                  Page 16
        __________________________________________________________________
        BigMemMapO (MemMapO*)                                      MemoryU
          This object is used to store bitmaps in memory. It can not
        exceed 65520 pixels in width, 16380 pixels in height or use more
        than all available memory. It's great in protected mode under OS/2
        with lots of virtual DPMI memory.

        Init (XSize,YSize :Word)
          See MemMapO.Init.

        InitPcx (FN :String; Pal :PalP; Xtra :Pointer)
          See MemMapO.InitPcx.

        __________________________________________________________________
        DiskMapO (MemMapO*)                                        MemoryU
          This object is used to store bitmaps on disk when memory is
        sparse. It can not exceed 65535 pixels in width, 65535 pixels in
        height or use more than all available disk space. There is also
        some upper limit for file sizes in DOS, but it's generally nothing
        to worry about. This object was written by Reynir Bergman Palsson.

        Init (XSize,YSize :Word)
          See MemMapO.Init.

        InitPcx (FN :String; Pal :PalP; Xtra :Pointer)
          See MemMapO.InitPcx.

        __________________________________________________________________
        SmallMemMapO (MemMapO*)                                    MemoryU
          This object is used to store bitmaps in memory. It can not
        exceed 65520 pixels.

        Init (XSize,YSize :Word)
          See MemMapO.Init.

        InitPcx (FN :String; Pal :PalP; Xtra :Pointer)
          See MemMapO.InitPcx.

        __________________________________________________________________
        ScrMapO* (EBitMapO*)                                          Egof
          This object is the ancestor of all the screen objects.

        InitModeMap
          Create object and build the [ModeMap] list of supported modes.
        An object created this way can not be used for input/output until
        it has been re-initialised.

        Done
          Destroy object and change back to previous video-mode.

        DoneSameMode
          Destroy object and stay in this video-mode.




        __________________________________________________________________
        EGOF v1.1                                                  Page 17
        LastMode :Byte:
          This is the mode the display was in before the object was
        created. Change it before destroying the object to force a
        different mode on exit from the program.
          Also read this field to get the current video mode if you used
        the InitSameMode constructor.

        ModeMap :ModeSet:
          This is a set of the modes available for this object. To see if
        a specific mode is available just check if it is "in" the set.
          BiosO's are absolutely clueless and pretend to have all modes.

        __________________________________________________________________
        BiosO (ScrMapO*)                                             BiosU
          This object uses the BIOS for everything. It is Sssllllloooowww,
        but should work with almost anything. Even in non-256-colour
        modes, although you may see some strange results when programs
        expect 256-colours but get fewer. Try using a 16 colour mode with
        a colour re-map filter to map all 256 colours to the first 16.
        (This gives about the worst speed you'll find anywhere!)

        Init (Mode :Word; XRes,YRes :Word)
          Create object and change to [Mode]. [Mode] should be a real mode
        number, not one of the ModeXXXX constants. It may also be a VESA
        mode number. You may wish to use ModeXXXX and AXXXX constants as
        indexes in the [ModeList] array to get the real mode numbers.
        [XRes] by [YRes] is the resolution of the selected mode and can be
        obtained by using a ModeXXXX constant as index in the [ModeRes]
        array.

        __________________________________________________________________
        VgaO (ScrMapO*)                                               VgaU
          This object is used for IBM VGA/MCGA cards and compatibles in
        the 320 by 200 pixel 256 colour mode.

        Control                SetMode

        Init
          Create object and change to mode 13h.
        InitSameMode
          Create object without changing mode. (Did anyone say frame-
        grabber?)

        __________________________________________________________________
        ScrMpMapO* (ScrMapO*)                                         Egof
          This object is the ancestor of all the screen objects that can
        have more than one page of graphics in display memory at once.

        Control                SetActive, SetVisual
        Writing                ClearAll






        __________________________________________________________________
        EGOF v1.1                                                  Page 18
        __________________________________________________________________
        VgaNsO (ScrMpMapO*)                                           VgaU
          This object is for non-standard VGA modes. It can be used on any
        register compatible VGA display. It allows you to access the
        unchained 320 by 200 pixel mode, in addition to several higher
        resolution modes.
          Many of these modes have more than one page of graphics in
        display memory. Simply multiply the horizontal and vertical
        resolution to find out how much memory a page takes, and divide
        262,144 by that number and round down. This is the number of pages
        in display memory. Use the SetActive and SetVisual methods to
        change the pages.
          This object is based on code I got from Bjarni R. Einarsson and
        Anthony Wolf, and the famous articles by Michael Abrash in dr.
        Dobb's Journal.

        Init (Mode :Byte)
          Create object and change to the selected mode. [Mode] is
        Mode320x200 or one of the non-standard mode constants. See the
        chapter about constants for details

        InitSameMode (Mode :Byte)
          Create object without changing mode. [Mode] is the mode to
        assume that the display is in. This is needed since there is no
        way to detect non-standard modes.

        LastMode :Byte
          See ScrMapO.LastMode. Note that the BIOS is unable to detect the
        non-standard modes, so this field will probably contain 13h if the
        display was in such a mode when Init was called. When InitSameMode
        is used, the value in [Mode] is copied to [LastMode].

        __________________________________________________________________
        VesaO (ScrMpMapO*)                                           VesaU
          This object is used for VESA BIOS compatible SVGA cards or those
        with a suitable driver loaded. So far, resolutions up to 1280 by
        1024 pixels have been defined by VESA. The VesaO needs  version
        1.1 of the VESA BIOS specification to use more than one page of
        graphics simultaneously.

        Init (Mode :Word)
          Create object and change to [Mode]. [Mode] should be one of
        the ModeXXXX constants and not a VESA mode number. Valid values
        are from Mode640x400 to Mode1280x1024, but not all SVGA's
        support all the modes.

        InitSameMode (Var Mode :Word)
          Create object without changing mode and return the current mode
        in [Mode]. The returned mode is not one of the ModeXXXX constants,
        but a real mode number.






        __________________________________________________________________
        EGOF v1.1                                                  Page 19
        TwoWin :Boolean
          This field is by default only true on those adapters that have
        two memory banks active at a time, one to read from and one to
        write to the screen. Having two banks allows fast bit block
        transfers in display memory. You can change the value of [TwoWin]
        to true if you are absolutely certain that you will not have to
        copy directly from the screen to another portion of the screen,
        and so speed bit block transfers up a bit.

        __________________________________________________________________
        EFilterO* (EBitMapO*)                                      FilterU
          This object is the ancestor of all filter objects.

        Control                ChangeHost

        __________________________________________________________________
        ClipO (EFilterO*)                                          FilterU
          This filter is used to define a rectangular area on the host
        that can be written to. All writes outside of this area is clipped
        off.

        Control                ChangeWin

        Init (Host :EBitMapP; X1,Y1, X2,Y2 :Word)
          Create a window on [Host] from [X1],[Y1] to [X2],[Y2].

        __________________________________________________________________
        LockColO (EFilterO*)                                       FilterU
          This filter is used to lock pixels with specific colours. All
        pixels with colours that are members of the set passed to Init are
        locked.

        Init (Host :EBitMapP; Locked :ColSet)
          Create a filter for [Host]. Lock all members of [Locked].

        Locked :ColSet
          This is the set of locked colours. Change it to free or lock
        more colours.

        __________________________________________________________________
        LockMapO (EFilterO*)                                       FilterU
          This filter is used to lock pixels by using a separate key map.
        All pixels where the pixel in the same position in the key have a
        value higher than the specified key colour are locked. It is up to
        you to destroy the key when done. This means that a key colour of
        255 will unlock everything and a key colour of 0 will lock all
        pixels but those of colour 0 in the key.

        Control                ChangeKey

        Init (Host :EBitMapP; Key :BitMapP; KeyCol :Byte)
          Create a filter for [Host]. Lock all pixels on [Host] where the
        value of the corresponding pixel on [Key] is greater than
        [KeyCol].


        __________________________________________________________________
        EGOF v1.1                                                  Page 20
        __________________________________________________________________
        SpriteO (EFilterO*)                                        FilterU
          This filter displays a sprite 'on top' of the host bitmap. The
        sprite can be moved with the SetPos and Move methods and can be
        made to move over the host without destroying its content. Also,
        anything written to the Sprite filter will 'pass through' the
        sprite to the host. This means that the  host can be written to
        without worrying about the sprite.

        Control                On, Off, SetPos, Move, ChangeSprite

        Init (Host :EBitMapP; Sprite :BitMapO; Script :ScriptP)
          Display a sprite on [Host]. [Sprite] is the bitmap to use for
        the sprite and [Script] contains information about what pixels to
        copy from the sprite to the screen (see the MakeScriptT and
        MakeScriptS routines).

        __________________________________________________________________
        RemapColO (EFilterO*)                                      FilterU
          This filter re-maps colours written to it or read from it using
        a pair of look-up tables. One table is used when reading, and the
        other when writing.
          The tables are arrays of 256 bytes. When a colour C is read from
        the host, the value ReadTable^[C] is returned. Likewise, writing
        colour C to the filter results in colour WriteTable^[C] being
        written to the host.
          Pointers to the two tables are passed to Init. It is then up to
        you to maintain the tables, including destroying them when done.

        Control                ChangeTables

        Init (Host :EBitMapP; ReadTable,WriteTable :BufP)
          Create a colour re-map filter for [Host] using [ReadTable] for
        re-mapping read colours and [WriteTable] for re-mapping writes.

        __________________________________________________________________
        ScaleDownBO (EFilterO*)                                    FilterU
          This filter is similar to ScaleDownO. It differs in that it also
        keeps a full-size backup of the data written to it. Anything read
        from the filter is read from this backup. In Init you supply, in
        addition to the host, an object to hold the backup. The size of
        the backup becomes the size of the filter. The backup is destroyed
        along with the filter.
          This object can be used to simulate higher resolution than is
        actually available, although the result tends not to be too
        pretty.

        Init (Host, Buffer :EBitMapP)
          Create a filter for [Host]. [Buffer] holds the backup data.







        __________________________________________________________________
        EGOF v1.1                                                  Page 21
        __________________________________________________________________
        ScaleDownO (EFilterO*)                                     FilterU
          This filter scales everything down that is written to it and
        writes it to the host. This object can be used to simulate higher
        resolution than is actually available, although the result tends
        not to be too pretty.

        Init (Host :EBitMapP; XSize,YSize :Word)
          Create a filter for [Host]. Pretend to have the resolution
        [XSize] by [YSize] pixels.

        __________________________________________________________________
        WinO (EFilterO*)                                           FilterU
          This filter is used to create windows onto editable bitmaps.
        Anything written to a WinO is written to the region on the host
        bitmap specified in Init.

        Control        ChangeWin

        Init (Host :EBitMapP; X1,Y1, X2,Y2 :Word)
          Create a window on [Host] from [X1],[Y1] to [X2],[Y2].

        __________________________________________________________________
        XorO (EFilterO*)                                           FilterU
        This filter XORs all pixels written to it onto the host instead of
        writing them.

        Init (Host :EBitMapP)
          Create a XorO filter for [Host].



























        __________________________________________________________________
        EGOF v1.1                                                  Page 22

                                THE BITMAP METHODS

          On the next few pages is a categorical list of the methods
        defined for bitmaps. Each item has syntax, where it was first
        defined, and a description listed.


                                    DIMENSIONS

        Function GetMaxX :Word                                    BitMapO*
          Return the highest X co-ordinate of pixels on the bitmap. 319 on
        a 320x200 pixel bitmap.

        Function GetMaxY :Word                                    BitMapO*
          Return the highest Y co-ordinate of pixels on the bitmap. 199 on
        a 320x200 pixel bitmap.

        Function GetCenX :Word                                    BitMapO*
          Return the X co-ordinate of the centre pixel on the bitmap. 159
        on a 320x200 pixel bitmap.

        Function GetCenY :Word                                    BitMapO*
          Return the Y co-ordinate of the centre pixel on the bitmap. 99
        on a 320x200 pixel bitmap.

        Function RealX (X :Word) :Word                            BitMapO*
          Convert a resolution independent X co-ordinate into a real one.
        [X] is a number from 0 to 39999 and the function returns a number
        from 0 to GetMaxX (see above) depending on [X]. RealX(9600) would
        on a 320x200 pixel bitmap return 9600*320 Div 40000 = 76.

        Function RealY (Y :Word) :Word                            BitMapO*
          Convert a resolution independent Y co-ordinate into a real one.
        [Y] is a number from 0 to 29999 and the function returns a number
        from 0 to GetMaxY (see above) depending on [Y]. RealY(9600) would
        on a 320x200 pixel bitmap return 9600*200 Div 30000 = 64.


                                     READING

        Function GetPix(X,Y :Word) :Byte                          BitMapO*
          Return the value of the pixel at [X],[Y].

        Procedure GetLine (Buf :BufP; X,Y,W :Word)                BitMapO*
          Copy the pixel at [X],[Y] and the next [W] number of pixels to
        the right of it to the buffer pointed to by [Buf].

        Procedure GetLineT (Buf :BufP: X,Y,W :Word; TC :Byte)     BitMapO*
          Copy the pixel at [X],[Y] and the next [W] number of pixels to
        the right of it to the buffer pointed to by [Buf] excluding pixels
        of colour [TB].




        __________________________________________________________________
        EGOF v1.1                                                  Page 23

                                     WRITING

        Procedure PutPix (X,Y :Word; C :Byte)                    EBitMapO*
          Plot the pixel at [X],[Y] with colour [C].

        Procedure Clear (C :Byte)                                EBitMapO*
          Clear the bitmap to colour [C].

        Procedure ClearAll (C :Byte)                            ScrMpMapO*
          Clear all the pages to colour [C].

        Procedure HLine (X,Y,L :Word; C :Byte)                   EBitMapO*
          Draw a horizontal line right [L] pixels (inclusive) from [X],[Y]
        in colour [C].

        Procedure VLine (X,Y,L :Word; C :Byte)                   EBitMapO*
          Draw a vertical line down [L] pixels (inclusive) from [X],[Y] in
        colour [C].


                                HIGH-LEVEL WRITING

        Procedure Line (X1,Y1, X2,Y2 :Word; C :Byte)             EBitMapO*
          Draw a straight line from [X1],[Y1] to [X2],[Y2] (inclusive) in
        colour [C].
          Bresenham's algorithm.

        Procedure Box (X1,Y1, X2,Y2 :Word; C :Byte)              EBitMapO*
          Draw a box with [X1],[Y1] and [X2],[Y2] as opposite corners in
        colour [C].

        Procedure FBox (X1,Y1, X2,Y2 :Word; C :Byte)             EBitMapO*
          Draw a filled box with [X1],[Y1] and [X2],[Y2] as opposite
        corners in colour [C].

        Procedure Ellipse (X,Y, XR,YR :Word; C :Byte)            EBitMapO*
          Draw an ellipse centred on [X],[Y] with vertical radius [XR] and
        horizontal radius [YR] in colour [C].
          Bresenham's algorithm.

        Procedure FEllipse (X,Y, XR,YR :Word; C :Byte)           EBitMapO*
          Draw a filled ellipse centred on [X],[Y] with vertical radius
        [XR] and horizontal radius [YR] in colour [C].
          Bresenham's algorithm.

        Procedure Poly                                           EBitMapO*
        (NoP :Word; Var P; Close :Boolean; C :Byte)
          Draw a polygon in colour [C] with  [NoP] number of vertices. The
        vertices are listed in [P]. If [Close] is true, then Poly draws a
        line from the last to the first point. [P] is an array of
        PointType.




        __________________________________________________________________
        EGOF v1.1                                                  Page 24
        Procedure Flood (X,Y :Word; C :Byte)                     EBitMapO*
          Fills the continuous one-coloured area on the bitmap at the
        point [X],[Y] with colour [C]. The flood-fill algorithm depends on
        being able to read the bitmap to see if it has written to a
        specific pixel, and will break down of it's writes are filtered
        out, so take care when filling LockColO and LockMapOs. You'll be
        OK if you can make sure that the Flood routine will not try to
        write to any of the locked pixels.


                               BIT BLOCK TRANSFERS

        Procedure CopyMap                                        EBitMapO*
        (X,Y :Word; Source :BitMapP; X1,Y1, W,H :Word)
          Copy a region [W] pixels wide and [H] pixels high form position
        [X1],[Y1] on the bitmap [Source] to [X],[Y]. This is done by using
        GetLine on [Source] to move a scan-line at a time.
          CopyMap can be used for bit block transfers from any bitmap.

        Procedure CopyMapI                                       EBitMapO*
        (X,Y :Word; Source :BitMapP; X1,Y1, W,H :Word; I: PerLineFunc)
          This is the same as the CopyMap procedure, except that it calls
        the function [I] once for each scan-line. This procedure takes as
        its only parameter the line number of the line about to be copied,
        where the first copied line is number 0. If [I] returns true, then
        CopyMapI terminates.

        Procedure CopyMapT                                       EBitMapO*
        (X,Y :Word; Source :BitMapP; X1,Y1, W,H :Word; TC :Byte)
          This is the same as CopyMap, except that all pixels of colour
        [TC] are skipped.
          CopyMapT is useful to copy partly transparent bitmaps, such as
        mouse pointers, to the screen or other EBitMapO.

        Procedure CopyMapS                                       EBitMapO*
        (X,Y :Word; Source :BitMapP; S :ScriptP)
          Copy the area defined by the script [S] from [Source] to the
        region starting at [X],[Y]. The script is created using either
        MakeScriptT or MakeScriptS. CopyMapS is faster than CopyMapT and
        can be used in its stead. The script need only be rebuilt when the
        bitmap to be copied changes, so the script can be built before
        entering a tight loop to improve speed significantly.

        Procedure FadeMap                                        EBitMapO*
        (X,Y :Word; Source :BitMapP; X1,Y1, W,H :Word)
          This is the same as CopyMap, except that the pixels are
        transferred in a seemingly random order resulting in a dissolve
        effect.
          From the book Graphics Gems. Algorithm by Mike Morton.







        __________________________________________________________________
        EGOF v1.1                                                  Page 25
                                       FILE

        Procedure ReadPcx                                        EBitMapO*
        (X,Y :Word; FN :String; Pal :PalP; Xtra :BufP)
          Load the image from the PCX file named in [FN] onto the bitmap
        at location [X],[Y] and put the palette in [Pal] if [Pal] is not
        nil.
          If [Xtra] is not nil the first byte in the buffer it points to
        is read, and that many bytes (up to 106) is read from the unused
        space in the PCX header into the buffer. Some of this space was
        added to the header to make it an even 128 bytes and allow later
        enhancements to the format. The rest is where the 16 colour
        palette used to be. The palette is now appended to the end of the
        file.
          ReadPcx will only read 256 colour PCX files version 3.0 (All 256
        colour files I've encountered)

        Procedure WritePcx                                        BitMapO*
        (FN :String; X1,Y1, W,H :Word; Pal :PalP; Xtra :BufP; Count :Byte)
          Write a region [W] pixels wide and [H] pixels high starting at
        [X1],[Y1] to a PCX file and call it [FN]. If [Pal] is not nil, it
        is saved in the file as well. Many programs will not read PCX
        files without a palette.
          If you have any information you would like to save in the file
        along with the image data, pass a pointer to it in [Xtra] and put
        the number of bytes (up to 106) to save in [Count]. This is
        skipped if [Xtra] is nil or if [Count] is zero.
          WritePcx will always create a 256 colour PCX v3.0 file.


                                      CONTROL

        Procedure SetMode                                             VgaO
          Change the video-mode to 13h, the 320 by 200 pixel 256 colour
        VGA/MCGA mode. Can be used following InitSameMode if the "same
        mode" turns out not to be mode 13h.

        Procedure SetActive (P :Byte)                           ScrMpMapO*
          Set the active page to number [P]. The active page is the one
        that all read and writes are directed to.

        Procedure SetVisual                                     ScrMpMapO*
          Set the visual page to number [P]. The visual page is the one
        that is shown on the screen.

        Procedure SetIter (I :Word)                              FracMapO*
          Set the maximum iterations for the calculations. This is how
        many iterations of the calculations should at most be performed
        before deciding what colour a pixel is. Increasing this number
        will drastically slow down rendering, but is sometimes necessary
        to get adequate detail.

        Procedure SetPos (X,Y, Mag :Double)                      FracMapO*
          Select the area on the fractal that the bitmap should represent.
        [X] and [Y] are the co-ordinates of the centre pixel on the
        fractal. [Mag] decides how much to magnify the fractal.
        __________________________________________________________________
        EGOF v1.1                                                  Page 26
        Procedure Zoom (X,Y, Mag :Double)                        FracMapO*
          Zoom in on some area on the fractal. [X] and [Y] are the
        co-ordinates of the pixel that should be in the centre of the
        bitmap. The co-ordinates are interpreted with (0,0) being the
        upper-left corner and (1,1) as the bottom right corner of the area
        of the fractal currently represented by the bitmap. [Mag] decides
        how much to increase magnification. As an example, the call
        Zoom (0.5, 0.5, 2) will zoom in on the exact same spot that is
        currently represented and double the magnification.

        Procedure SetParam (X,Y :Double)                            JuliaO
          Set the point on the Mandelbrot set that the Julia set should
        relate to. This changes the whole set, rather than just showing a
        different part of it.

        Function MakeJulia (XSize,YSize, MaxI :Word)                JuliaO
          Create a Julia set object corresponding to the pixel on the
        centre of the Mandelbrot Set bitmap. The object will be [XSize] by
        [YSize] pixels and the maximum iterations will be set to [MaxI]

        Procedure ChangeHost (Host :EBitMapP)                    EFilterO*
          Change the host of the filter to [Host]. The old host is not
        destroyed.

        Procedure ChangeKey (Key :EBitMapP KeyCol :Byte)          LockMapO
          Change the key of the filter to [Key]. All pixels in Host with
        corresponding pixels on [Key] with values higher than [KeyCol]
        will be locked. The old key is not destroyed.

        Procedure On                                               SpriteO
          Make the sprite visible.

        Procedure Off                                              SpriteO
          Make the sprite invisible.

        Procedure SetPos (X,Y :Word)                               SpriteO
        Set the position of the sprite to [X],[Y].

        Procedure ChangeSprite (Sprite :BitMapP; Script :ScriptP)  SpriteO
          Select [Sprite] as the bitmap to use as the sprite. [Script]
        tells what pixels to copy.

        Procedure ChangeTables (ReadTable,WriteTable :BufP)      RemapColO
          Change the colour remap tables to [ReadTable] for reading and
        [WriteTable] for writing. The old tables are not affected, and
        must be deallocated separately if desired.

        Procedure ChangeWin (X1,Y1, X2,Y2 :Word)                      WinO
          Change the size and/or position of the window. The window will
        now have [X1],[Y1] as its upper-left corner and [X2],[Y2] as its
        bottom-right corner.





        __________________________________________________________________
        EGOF v1.1                                                  Page 27

                              WRITING BITMAP OBJECTS

          No one can think of everything, so I have probably left out
        some, to you, indispensable bitmap object that you are going to
        want to write your self. Here are a few guide lines:

          Pick a good ancestor. Is there another object that does
        something similar to what your new object will do? if so, make
        them closely related.

          You must re-define GetPix and PutPix for most new objects.
        Having done that, you should be able to use your new object.
          If speed is any issue you should also re-define the HLine
        method, and perhaps VLine, GetLine, GetLineT, CopyMap, CopyMapT,
        CopyMapI and CopyMapS. If you do not re-define these methods, your
        object will inherit the pixel-by-pixel approach to bit-blt
        operations from EBitMapO and that is SLOW.
          There is no need to re-define high-level methods such as line or
        FBox unless you are writing an object for an accelerator-card or
        other such exotic objects.

          Every bitmap object contains two fields called [XRes] and
        [YRes]. They contain the size of the bitmap. You must set these
        fields when initialising your own objects, or strange things may
        happen.

          If you are writing a descendant to MemMapO, there is probably no
        need to re-define the constructors Init and InitPcx. They call a
        method called MakeMap to allocate memory for the bitmap, so if you
        just re-define MakeMap you'll be able to use InitPcx to read PCX
        files. Here is the definition for MakeMap:

          MakeMap (XSize,YSize :Word);  Virtual;
          Where [XSize] by [YSize] is the size of the bitmap to create.

          If you are writing a filter object that doesn't use the hosts
        resolution as its own, you must re-define the ChangeHost method.
        It must contain the line: HostMap := Host. That's it. You'll also
        want to set [XRes] and [YRes], but that depends on the object.

          There are endless possibilities for writing bitmap objects.
        Here is a quick list:
          ScrMaps:        XGA, 8514/A, S3, W32, P9000 etc.
          Filters:        ScaleUpO, ScaleUpBO, AddColO, BlendColO.
          MemMaps:        XmsMapO, EmsMapO
          Fractals:       There is an infinite number of these infinite
                          shapes, so anything I list will be an
                          infinitesimal part of the whole, so I won't
                          bother.






        __________________________________________________________________
        EGOF v1.1                                                  Page 28
          If you write an object you think may be of interest to others
        please e-mail it to me if you can. I will then (probably) include
        it in a future version of EGOF and mention you in the objects
        description. I do reserve every right to modify any objects I
        receive if that will make them fit better into the framework
        and/or make them faster, more flexible or easier to use.
          Also, if you have code to set up and use more non-standard
        video-modes, I would love to get a copy. I will then add to
        VgaNsO.

          It is strongly recommended that you get the EGOF source code if
        you are going to write your own palette objects. If you get into
        trouble writing bitmap objects, just drop me a message and I'll do
        my best to help.










































        __________________________________________________________________
        EGOF v1.1                                                  Page 29

                               THE PALETTE OBJECTS

         PalO*                          Palette objects are used to
           GreyPalO                   modify palettes (really!). There
           BigMemMapO                 are three kinds of palette
           EPalO*                     objects. Those for modifying the
             MemPalO                  screen (dscendants of RealPalO),
              MemPal8O               those for  modifying palettes in
             RealPalO*                memory (MemPalO and descendants)
               BiosPalO               and static palettes.
               VgaPalO                  The same methods are used for
                                         all, except that the static
           Palette object family-tree.   palettes can not be written to.
                                         In addition, the ReadPal method
        and the InitRead constructor are only available in descendants of
        RealPalO.

          The objects marked with an asterix in the family tree above and
        in the list below are abstract objects. Abstract objects are not
        used directly. You would not create an instance of the RealPalO
        for example, but rather of VgaPalO.

          As with the bitmap objects there is defined a pointer-to-object
        data-type for each palette object. The name of the pointer is the
        same as that of the object, but with a P on the end in stead of
        the O. Thus VgaPalP points to a VgaPalO.

          Next is a list of all the palette objects and a description of
        each. The format for the object descriptions is the same as that
        for the bitmap objects.

          The methods categorised as internal should not be used in the
        main program. They are listed to make it possible for you to write
        your own descendant objects.

        __________________________________________________________________
        PalO*                                                         Egof
          This object is the ancestor of all palette objects.

        Get single colour      GetCol, GetCol8, GetClosest, GetClosest8
        Transfer               CopyTo, FadeTo

        Init
          Create the object.

        Done
          Destroy object.

        __________________________________________________________________
        GreyPalO (PalO*)                                              PalU
          This object is a static grey-scale palette. The colours range
        from black at number 0 to white at number 255.



        __________________________________________________________________
        EGOF v1.1                                                  Page 30
        __________________________________________________________________
        CCubePalO (PalO*)                                             PalU
          This object is a static colour-cube. The colours make up a
        three-dimensional grid with equal spacing between colours. This
        means that any colour you want will be represented in this
        palette, although probably not exactly. A colour number can be
        broken down into 3 bits for each red and green and 2 bits for
        blue.

        __________________________________________________________________
        EPalO* (PalO*)                                                Egof
          This object is the ancestor of all editable palette objects.

        Set single colour      SetCol, SetCol8, MixCol
        Colour range           BlackPal, FadeOut, Range, Range8
        Transfer               CopyPal, CopyPal8, FadePal, FadePal8
        File                   ReadPcx, ReadMap

        __________________________________________________________________
        MemPalO (EPalO*)                                              PalU
          This object is used to manipulate palettes off-screen. All fades
        are converted to the much faster copy equivalents, since no-one
        will see it any way.

        __________________________________________________________________
        MemPal8O (MemPalO)                                            PalU
          This object is similar to the MemPalO except that it stores 8
        bits per colour component in stead of 6. This gives higher colour
        resolution, but is not very useful if the final output is 6 bits
        per component as in all standard VGA palettes.
          You should use the methods ending with "8" with this object
        whenever possible, since the plain variants lose colour depth and
        are slower when used on MemPal8Os.

        __________________________________________________________________
        RealPalO* (EPalO*)                                            PalU
          This object is the ancestor of all objects for the palette
        actually on the display.

        Transfer               ReadPal
        Internal               SetOut, CopyOut

        InitRead
          Create the palette object and read the palette from the screen.
        If  the normal Init constructor is used, reading the palette
        object will return random results until it has been written to.
        This is not true if InitRead is used.

        __________________________________________________________________
        BiosPalO (RealPalO*)                                          PalU
          This object uses the BIOS to change the palette. This will work
        on XGAs in non-320x200 modes (although badly), whereas VgaPalO
        will not.



        __________________________________________________________________
        EGOF v1.1                                                  Page 31
        __________________________________________________________________
        VgaPalO (RealPalO*)                                           PalU
          This object is used to access the VGA palette registers
        directly.




















































        __________________________________________________________________
        EGOF v1.1                                                  Page 32

                                 PALETTE METHODS

          Here are the methods defined for palettes. All parameters called
        [C], [C1] or [C2] can have values from 0 to 255. Parameters called
        [R], [G] or [B] can have values from 0 to 63 except when the
        method name ends with an 8. Then they can have values from 0 to
        255.
          Unless you have a good reason, you should not use the "8"
        Methods, since they tend to be slower and no more useful than the
        plain variants.
          Unless specified these methods are all available in every
        palette object.


                                GET SINGLE COLOUR

        Procedure GetCol (C :Byte; Var R,G,B :Byte)                   PalO
          Returns the red, green, and blue components of the colour [C] in
        [R], [G] and [B].

        Procedure GetCol8 (C :Byte; Var R,G,B :Byte)                  PalO
          Returns the red, green, and blue components of the colour [C] in
        [R], [G] and [B].

        Function GetClosest (RW,GW,BW :Byte) :Byte                    PalO
          Returns the number of the colour closest to having red component
        [RW], green component [GW], and blue component [BW].

        Function GetClosest8 (RW,GW,BW :Byte) :Byte                   PalO
          Returns the number of the colour closest to having red component
        [RW], green component [GW], and blue component [BW].

        Function GetDifferent (RW,GW,BW :Byte) :Byte                  PalO
          Returns the number of the colour furthest from having red
        component [RW], green component [GW], and blue component [BW].

        Function GetDifferent8 (RW,GW,BW :Byte) :Byte                 PalO
          Returns the number of the colour furthest from having red
        component [RW], green component [GW], and blue component [BW].


                                SET SINGLE COLOUR

        Procedure SetCol (C, R,G,B :Byte)                            EPalO
          Set colour [C] to [R], [G], [B].

        Procedure SetCol8 (C, R,G,B :Byte)                           EPalO
          Set colour [C] to [R], [G], [B].

        Procedure MixCol (C, C1,C2 :Byte)                            EPalO
          Set colour [C] to the average of colours [C1] and [C2].




        __________________________________________________________________
        EGOF v1.1                                                  Page 33

                                   COLOUR RANGE

        Procedure BlackPal (C1,C2 :Byte)                             EPalO
          Make colours [C1] through [C2] black.

        Procedure FadeOut (C1,C2 :Byte)                              EPalO
          Make colours [C1] through [C2] fade to black.

        Procedure Range (C1, R1,G1,B1, C2, R2,G2,B2 :Byte)           EPalO
          Set colour [C1] to [R1], [G1], [B1], colour [C2] to [R2], [G2],
        [B2] and blend the colours in between to make a smooth transition
        from [C1] to [C2].

        Procedure Range8 (C1, R1,G1,B1, C2, R2,G2,B2 :Byte)          EPalO
          Set colour [C1] to [R1], [G1], [B1], colour [C2] to [R2], [G2],
        [B2] and blend the colours in between to make a smooth transition
        from [C1] to [C2].


                                     TRANSFER

        Procedure CopyPal (C, C1,C2 :Byte; P :PalBufP)               EPalO
          Copy the colours [C1] through [C2] from the buffer [P] to the
        colours starting with [C].

        Procedure CopyPal8 (C, C1,C2 :Byte; P :PalBufP)              EPalO
          Copy the colours [C1] through [C2] from the buffer [P] to the
        colours starting with [C].

        Procedure FadePal (C, C1,C2 :Byte; P :PalBufP; Steps :Word)  EPalO
          The net result is the same as in CopyPal, but the change is made
        smoothly and in [Steps] number of  steps.

        Procedure FadePal8 (C, C1,C2 :Byte; P :PalBufP; Steps :Word) EPalO
          The net result is the same as in CopyPal8, but the change is
        made smoothly and in [Steps] number of steps.

        Procedure CopyTo (P :PalP; C, C1,C2 :Byte)                    PalO
          Copy the colours [C1] through [C2] to the colours starting with
        [C] in the palette [P].

        Procedure FadeTo (P :PalP; C, C1,C2 :Byte; Steps :Word)       PalO
          The net result is the same as in CopyTo, but the change is made
        smoothly and in [Steps] number of steps.

        Procedure ReadPal                                         RealPalO
          This method is available only in the RealPalOs. It is used to
        read the palette from the screen to the objects internal list.







        __________________________________________________________________
        EGOF v1.1                                                  Page 34

                                       FILE

        Procedure ReadPcx (FN :String; C, C1,C2 :Byte)               EPalO
          Read the palette from the 256 colour PCX file named in [FN] and
        copy colours [C1] through [C2] from the file to the colours
        starting with [C] in the palette.

        Procedure ReadMap (FN :String; C ,C1,C2 :Byte)               EPalO
          Read the palette from the 256 colour FractInt-style colour-map
        file named in [FN] and copy colours [C1] through [C2] from the
        file to the colours starting with [C] in the palette.
          Map files are text files with one colour per row and three
        numbers from 0 to 255 in each to show the amount of red, green and
        blue in the colour. The numbers are right-justified in three
        character columns with one space between columns. Anything after
        the third number is ignored.







































        __________________________________________________________________
        EGOF v1.1                                                  Page 35

                             WRITING PALETTE OBJECTS

          Here are some hints for those who want to write palette objects:

          Each palette object has a field called [Data] of the type
        PalBufP. This field contains the palette values.

          Is it a RealPal? That is, is it a palette on-screen. If so, all
        you really have to do is to re-define the methods SetOut, CopyOut
        and ReadPal. SetOut and CopyOut take the same parameters as SetPal
        and CopyPal and are called by those methods. They handle the
        actual output of  colour information to the display-adapter. The
        ReadPal method reads the colours from the screen and puts them in
        [Data].

          Does it store 8-bits per colour component? If it does, then you
        will have to re-define all the methods that take RGB triples or
        pointers to RGB triples as parameters. Those methods that have an
        "8" on the end have to be re-defined to store the values directly,
        rather than shifting them 2-bits right as is the default, and
        those without an "8" on the end have to be re-defined to shift
        everything 2-bits left before storing.

          Is it a static palette? Static palettes can sometimes be sped up
        by writing customised GetClosest and GetDifferent methods that
        calculate the return values rather than looking through the [Data]
        field.

          Static palettes must also initialise the [Data] field. One way
        to do this is to define a constant array with the values and just
        set [Data] to a pointer to that array. This is faster, and only
        one copy of the data is kept in memory if there are several
        palette objects of the same type. If you do this, you must also
        re-define the destructor Done, so that it doesn't try to
        de-allocate the memory taken up by [Data^].

          It is strongly recommended that you get the EGOF source code if
        you are going to write your own palette objects. If you get into
        trouble writing palette objects, just drop me a message and I'll
        do my best to help.















        __________________________________________________________________
        EGOF v1.1                                                  Page 36

                                    THE MOUSE

          The mouse object is not part either of the main families, so it
        gets its own chapter.

        __________________________________________________________________
        MouseO                                                      MouseU
          This object handles the control of the mouse. It is a sort of
        add-on to the sprite object, and will control the sprite according
        to the movement of the mouse. The sprite object has the feature of
        allowing you to write 'through' the sprite - the mouse pointer in
        this case.

        Control                SetPos, Move, SetMinMaxX, SetMinMaxY
                               SetDTime
        Events                 NewEvent, NextEvent

        Init (Host :SpriteP; HSX, HSY :Integer);
          Create the mouse object and have it control the sprite on
        [Host]. This must have been created before the mouse is
        initialised. [HSX],[HSY] is the co-ordinates of the hot spot on
        the sprite relative to the upper left corner. The hot spot is the
        point on the sprite that corresponds to the actual mouse position.

        Event :EventP:
          This is a pointer to the event being handled. When NextEvent is
        called this pointer changes, so it can not be copied to a variable
        and be expected to stay valid.



























        __________________________________________________________________
        EGOF v1.1                                                  Page 37

                                  MOUSE METHODS

          Here are the methods defined for the mouse object.

        Procedure SetPos (X, Y :Word)                               MouseO
          Move the mouse pointer to the point [X],[Y] on the host.

        Procedure Move (dX, dY :Integer)                            MouseO
          Move the mouse pointer [dX],[dY] pixels, for example Move(1,-1)
        will move the mouse one pixel right and one pixel up.

        Procedure SetMinMaxX (MinX, MaxX :Word)                     MouseO
          Set the limits for horizontal movement for the mouse. The mouse
        will be able to move from column [MinX] to column [MaxX]
        inclusive.

        Procedure SetMinMaxY (MinY, MaxY :Word)                     MouseO
          Set the limits for vertical movement for the mouse. The mouse
        will be able to move from row [MinY] to row [MaxY] inclusive.

        Procedure MouseO.SetDTime (DT:Byte);                        MouseO
          Set the maximum time between clicks for them to be considered a
        double-click.

        Function NewEvent :Boolean                                  MouseO
          Returns true if there is a mouse event waiting in the queue.

        Procedure Next Event                                        MouseO
          Move on to the next mouse event. This is done by pointing
        [Event] to the next event in the queue. This should only be called
        when NewEvent returns true.
          [Event] points to a MouseEventR record. The main field of this
        record is [What] and tells what event it is. It can take one of
        the following values:
        MeDown     You pressed a button.
        MeUp       You released a button.
        MeDouble   You have pressed a button twice, rapidly. Double-
                   clicking generates three events: MeDown + MeUp for the
                   first click, and MeDouble + MeUp for the second click.
        MeDrag     You have pressed a button (generating a button pressed
                   event) and then moved the mouse without releasing the
                   button. A drag event is generated every time the mouse
                   is moved while the button is down, so the path can be
                   followed.
        MeDrop     You have released a button after dragging with that
                   button pressed.









        __________________________________________________________________
        EGOF v1.1                                                  Page 38

                                  ERROR CHECKING

          I suppose a few words on EGOF's error checking mechanism are in
        order.
          All Constructors are likely to return errors, as are file I/O
        methods and the fill method. The methods that do not return errors
        don't reset the error-status either.
          The error status can be read by using the functions IsEgofError
        and GetEgofError. IsEgofError returns true when an error has
        occurred, and GetEgofError returns the current error-status and
        sets it to ENone. The error code constants are listed in the
        section on constants. None of the objects do any range-checking,
        so you can accidentally write outside a bitmap and destroy
        whatever was there before. (this is sometimes trapped in protected
        mode.)
          An error-message can be created by using the value returned by
        GetEgofError as an index in [EgofErrorStr] or, on the off chance
        that you are Icelandic,  getur  nota [EgofErrorIce].
          Note that if a VesaO returns a EWrongCard, then you may have
        forgotten to load the VESA driver for your card.



































        __________________________________________________________________
        EGOF v1.1                                                  Page 39
