PNG module
==========

The PNG module supplies a shared interface to the PNG library. Due to
developments at many developers, including Acorn, the PNG library is quite
generic and can produce its output, or read its input, in a number of ways.

This is a quite early development version of the PNG module, and as such there
will be faults and errors in its implementation.

In general, the SWI interface is exactly the same as that of the PNG library.
When there is time this will be documented more formally, but the general
principles are :

 * Functions are split into categories which will are accessed via SWIs
 * Each SWI has as R0 giving the sub-code for the function being accessed.
   [Reason: There's not enough SWIs in a chunk for all of the functions to
            have one each]
 * Input values are in the registers going into the SWI.
   Return values come out in R0.
   Output values are in the registers coming out of the SWI at the next
   free register (R0 if there is a return parameter, or R1 if not)
 * Floating point values are returned (or passed) scaled by &10000 (ie
   converted to fixed point values with the point at bit 16.

Example
-------
png_uint_32  png_get_gAMA  (png_structp png_ptr, png_infop info_ptr, double *file_gamma)  ;

Becomes:

SWI PNG_GetChunkInfo
=> R0 = 2 (reason code for get_gAMA)
   R1 = pointer to png structure returned from create_read_struct
   R2 = pointer to png information structure returned from 
        png_create_info_struct
<= R0 = returned value (0 if no gAMA chunk, non-0 if gAMA chunk present)
   R1 = gamma value * &10000


Linking with C
--------------
When linking with C, it should be relatively easy to include h.png and link
with o.pnglib to use the module. Future changes to the SWI interface will be
reflected in the AOF library such that a recompile is all that is required.


Caveats
-------
The cHRM (chromaticity) chunk is not currently supported. The implementation
is such that this can't work the way that the SWI interface is currently
designed.

Running the PNG module on pre-RISC OS 4 machines is liable to crash. This is
due to the floating point code in the module. Floating point instructions in
SVC mode are only supported on RISC OS 4.

You must have the ZLib module loaded for PNG module to work.


More information
----------------
Firstly, you should read the documentation supplied with PNGLib. This will
provide you with most of the necessary information. If you want more
information, please email.
