PNG module

Introduction and Overview

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

Technical Details

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 :

Example

The library function:

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

Becomes the SWI SWI PNG_GetChunkInfo, with R0 set to 2 (the reason code for get_gAMA).

Caveats

The cHRM (chromaticity) chunk is not currently supported. The implementation is such that this cannot work the way that the SWI interface is currently designed.

More information

Firstly, you should read the documentation supplied with PNGLib. This will provide you with most of the necessary information. More information, together with a development kit, is available on request.

SWI Calls

PNG_GetChunkInfo
Read information from a PNG chunk (example: get_gAMA)
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
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI is given as an example of the way in which the functions of the PNG library are made available. The reason code in R0 selects the function.