 _________________________________________________________________________
/#########################################################################\
|#####...####..######..######......####...####..#####..##......##......###|
|####.....###..######..########..#####.....###...####..##..######..#######|
|###..###..##..######..########..####..###..##....###..##..######..#######|
|###..###..##..######..########..####..###..##..#...#..##..######......###|
|###.......##..######..########..####.......##..##.....##..######..#######|
|###..###..##..######..########..####..###..##..###....##..######..#######|
|###..###..##...#####...#######..####..###..##..####...##..######..#######|
|###..###..##......##......##......##..###..##..#####..##......##......###|
|#########################################################################|
|####################################################################{RB}#|
|=========================================================================|
|									  |
|		           ----> PRESENTS <----				  |
|									  |
|			THE ABACUS SERIES - VOLUME 2		          |
|									  |
|            AMIGA GRAPHICS INSIDE AND OUT - THE COMPLETE BOOK            |
|									  |
| Typed / Scanned / Edited By : RAZOR BLADE.			          |
| Additional Typing by        : GLITCH ( + 8 pages by Asterix ! ).	  |
| Menu Coded by 	      : RAISTLIN				  |
| Original Supplied by	      : VIPER					  |
|									  |
|-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|
| 		CALL THE ALLIANCE WORLD HQ -> THE PLACE TO BE             |
|       UNKNOWN PLEASURES --> +44 (0) 823 322 891 --> SYSOP: BARBARIAN    |
|_________________________________________________________________________|


       
       
                      GRAPHIC PROGRAMMING IN 'C'
                      ==========================
       
You have probably noticed that although BASIC can create fantastic graphics,
it is quite slow. It is obvious that BASIC just doesnt have the speed that 
we need to create fast graphics. However, if we use machine code, we could
gain more speed, but machine language can be difficult to program.
       
The high level language 'C' is perfct for this type of programming. This 
language offers the speed usually attained only with machine language and
the simplicity of a programming language like BASIC.
       
Since we do not want to repeat the infomation provided in the first section
of this book, in this chapter, we will only discuss the C characteristics
for graphic programming.
       
The programs in this section were written using three compilers. Aztec C 
V3.6a, Lattice C V5 and one using the Lattice C V3.10 compiler. Minor 
changes may have to be made to compile the prorams on different compilers.
See you compiler documentation for more information. Please remember to 
raise the system stack to 1024 bytes (CLI Command: stack 1024). Now we will
present the required elements for graphic programming in 'C'.
       
       
                            PAGE 315
       
----------------------------------------------------------------------------
       
       
The Amiga Libraries.
====================
       
Since learning a new computr language can be difficult, we will concentrate
only on graphic programming with C and not on learning the C langauge. If
certain terms such as Cast and Struct are confusing, please refer to the 
Abacus book, Amiga C for Beginners (** Complete Book is one *-ALLIANCE-* Dox
Disk One !!...hehehe) or another book on Amiga C.
       
Before you can use C's graphic functions, which are not part of the standard
C functions, first you have to learn about the Amiga libraries.
       
Each library contains a series of jump addresses for the individual graphic
ROM routines. Since there are different ROM versions (kickstarts) for the 
Amiga, the library concept is very useful. Every library has its own memory  
section that places a routine at a specific address. This means that a 
routine can be at a different address in each KickStart version. These 
addresses are found in the libraries. This allows a program to work with 
Kickstart 1.2 and 1.3 (and now 2.0) even though the routines are in 
different locations.
       
There are libraries for many different purposes. For us, the most important 
library is the graphics library. You open the graphics library like this:
       
       GfxBase = (struct GfxBase *)OpenLibrary("graphics.library",0)
       
GfxBase is the structure that contains all the important library 
information. The OpenLibrary funtion passes a pointer for this information 
to an initialised GfxBase structure that must be named GfxBase. At the same
time, the string "graphics.library" is the name of the graphics library. 
The zero in the parameter list for OpenLibrary specifies the current version
of the library, which is the one that we want to open.
       
Now that we have opened the graphics library we can return to graphic
programming. First we must create an area where we can display and save
our graphics.
       
Let's compare our operations to those of a large factory.
       
       
                                   PAGE 316
       
-----------------------------------------------------------------------------