Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Library for Clipper - <b>screen, graph and graphics functions</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                SCREEN, GRAPH and GRAPHICS FUNCTIONS

   GRAPHICS MODES

   In the IBM PC/XT/AT/PS2 and compatible environment the screen can be
   addressed in a number of different modes, the modes available on any
   particular machine being governed by the hardware, particularly the
   graphics adaptor.

   Modes are differentiated by, among other characteristics,:

   a)  Resolution.

   b)  The number of colours available.

   c)  Text or graphics display.


  Resolution:

   A programmer who is used to programming for a screen in a text mode
   (e.g. the @ SAY GET construction) will think of the screen in terms
   of character rows and columns.  That is, in mode 3, a text mode, the
   screen is considered as being 25 characters deep by 80 characters wide.

   For graphics modes, however, it is more useful to think of the
   resolution of the screen in terms of pixels.

   Pixels, or picture elements, are the quanta of graphics screen
   writing.  In other words they are little dots.  The more little dots
   that can fit on the screen the greater is its resolution.  So that
   mode 18 with 480 rows of pixels by 640 columns has a much greater
   resolution than mode 13 which can provide only 200 rows by 320 columns.

   Low resolution screens tend to produce jagged images which lack the
   smoothness and clarity of higher resolutions.


   GRAPHICS ADAPTORS

   The hardware standards supported by The Library which give colour
   graphics capabilities are:

   a) Colour Graphics Adaptor (CGA).

   b) Enhanced Graphics Adaptor (EGA).

   c) Video Graphics Array (VGA).


   Colour Graphics Adaptor:

   The IBM PC/XT/AT series of computers had no in built capacity for
   accessing the screen.  Screen access was achieved by a printed circuit
   board called the video adaptor.  The earliest of these video systems
   supported by 'The Library' is the CGA.  Apart from a number of text
   modes the CGA provided three graphics modes, 4, 5 and 6. Although mode
   5 provided four shades of grey with a resolution of 200 x 320 and mode
   6 the higher resolution of 640 x 200 in black and white the only true
   color graphics capability provided by the CGA was in mode 4 which gave
   the ability to produce four colors with a resolution of 200 x 320.
   For this reason the graphics routines in .The Library. support CGA mode 4.


   Enhanced Graphics Adaptor:

   A more advanced system than the CGA, the EGA offers all the modes of
   the earlier adaptor with the addition of four new graphics modes.
   Supported by .The Library. graphics functions are modes 13, 14 and 16
   which now make sixteen colors available and have resolutions of 200 x
   320, 200 x 640 and 350 x 640 respectively.  Mode 15 gives black and
   white and is not supported by 'The Library'.


   Video Graphics Array:

   Unlike the PC series the PS/2 group of computers have their own innate
   video subsystem. In the PS/2 models 50, 60 and 80 this is the Video
   Graphics Array.  The VGA can also be fitted as an adaptor on the PC/XT
   PC/AT and PS/2 model 30.  Once again the newer system offers all the
   capabilities of the earlier ones.  Modes 1 to 7 and 13 to 16 are as on
   the CGA or EGA.  Mode 17 is a two color mode and is not supported by
   'The Library'.  Mode 19 is the VGA.s two hundred and fifty six color
   low resolution mode and is not supported.  'The Library' does ,however,
   make use of mode 18 which provides sixteen colors at the high resolution
   of 480 x 640.

   Modes 8 to 12:

   So what happened to modes 8 to 12?  Modes 8 to 10 are used by the PCjr
   only and modes 11 and 12 are used internally by the EGA.

   Screen Colours:

   CGA mode 4 gives the user the ability to have four different colors on
   the screen at any one time.  The EGA and VGA graphics modes supported
   by The Library allow a selection of up to sixteen colors.  See
   Appendix C for further details.


   SCREEN, GRAPHS AND GRAPHICS FUNCTIONS

   Screen Functions:

   The screen functions are written in a mixture of .C., Clipper and
   Assembler.  The range of functions covers things such as saving and
   restoring text screens to and from disk, finding out the specific
   foreground, enhanced foreground, background and  enhanced background
   color attributes and changing the shape of the text cursor.

   Graph Functions:

   The graph functions of the Library are written in .C..  They will
   accept data from Clipper in the form of arrays.  Other parameters
   passed to the functions allow the Clipper programmer to specify how
   the screen output is to be formatted.  Functions are available to
   display data in the form of bar graphs, both horizontal and vertical,
   xy graphs and pie charts.  There are also functions in 'The Library'
   which will allow the programmer to attach legends and titles to these
   graphs.

   Graphics functions:

   Lower level functions, also written in .C., are provided.  These allow
   the user to draw points, lines, boxes, filled boxes, circles, filled
   circles and grids of lines on the graphics screen.  These, together
   with the functions which allow the placement of text on the graphics
   screen, can be combined in a variety of ways allowing considerable
   flexibility to enhance the graphing capabilities provided by 'The
   Library', or, indeed, the programmer also has the freedom to construct
   his own graphing functions using these graphics primitives.

   Co-ordinate convention:

   The graphics functions make heavy use of co-ordinates.  The convention
   we have adopted for the graphics is that the x co-ordinate is the
   vertical screen reference the y co-ordinate is the horizontal reference.
   The x co-ordinate is specified first followed by the y co-ordinate.
   The origin of the screen is the top left hand corner of the screen,
   represented by (0,0).

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson